These are chat archives for FreeCodeCamp/Help

21st
Nov 2018
kinopotato
@kinopotato
Nov 21 2018 00:38
Hello guys, quick question. I'm new to DOM manipulation so I don't get what's happening here .
<p>going bananas</p>
let a = document.querySelector("p");
console.log(a.length); //undefined
console.log(a); //<p>going bananas</p>
why is it returning undefined??
Johnny
@JohnnyBizzel
Nov 21 2018 01:43
Any Firebase ninjas about?
@kinopotato Because it's not an array?
Just thinking of the best way to use Firebase for book trader. I want to have the records stored users/<userID>/<book array>
But using set overwrites the last record
Niraj Nandish
@Nirajn2311
Nov 21 2018 02:12
@kinopotato querySelector returns an object
Check :point_up_2: for more info on querySelector
kinopotato
@kinopotato
Nov 21 2018 02:13
@Nirajn2311 yes thanks, I tried getting deeper and got the length that way by adding .textContent
Karma Drukpa
@coderkarma
Nov 21 2018 02:45
:
:wave:
I am trying to sort each first ascii value of the word but sorting is not working?
kinopotato
@kinopotato
Nov 21 2018 02:50
is there a way to accept user input in codepen without resorting to alerts and prompts?
Claudio Restifo
@Marmiz
Nov 21 2018 03:03
@kinopotato a classic input with an event listener?
Claudio Restifo
@Marmiz
Nov 21 2018 03:11
@coderkarma how was your sorting function?
If it were for me I'd convert the string into the ASCII number and then sort by number, it've found it more reliable that alphabetical sort
Claudio Restifo
@Marmiz
Nov 21 2018 03:41
which in retrospective is not actually sorting, since I've solved it without the use of a Array.sort :)
kinopotato
@kinopotato
Nov 21 2018 03:49
@Marmiz I'm new to DOM manipulation. so if for example a text box with a submit button, if I click submit the text on the text box can be selected and manipulated?
Aditya
@ezioda004
Nov 21 2018 03:50
@kinopotato Yes, you can check after the "submit/click" even has happened, check the .value property of the input.
kinopotato
@kinopotato
Nov 21 2018 03:51
@ezioda004 ohhh, that makes what I'm planning waaaay simpler then. thanks! 8D
Bjorn van de Peut
@bjorno43
Nov 21 2018 03:56
Morning :wave:
Any of you here good with Materialize CSS? And I mean good, cuz I don't ask easy questions :laughing:
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:02
This is what I'm working on: https://codepen.io/bjorno43/pen/PxOmQG Click on the big blue circle to add a user. Ignore the fields and just click the Next button. Now, when you try to select a gender, you'll notice that "Female" can't be selected due to the underlaying element. A bit of a workaround to fix that issue, is by adding position: relative to ul as this will force the underlaying element to go down when the select menu is open. However, this is causing other issues with the script (like the design being messed up at the bottom). So I'm looking for a real fix and not some workaround..
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:08
I believe the same sort of issue is happening with the birthday selection menu. Works perfectly fine. But after selecting a date and opening the menu again, you can no longer change the month or year. It closes the menu instead of showing the select options.
Claudio Restifo
@Marmiz
Nov 21 2018 04:08
@bjorno43 have you tried giving the dropdown a container option when initializing?
kinopotato
@kinopotato
Nov 21 2018 04:09
I'm a very stupid guy, but won't z-index fix this?
Claudio Restifo
@Marmiz
Nov 21 2018 04:10

this is not a materialize per se, but all the dropdown library i've see create them in body by default.
but all of them accept a new container option to know where to render the element.

You usually notice this if you have dropdowns in modals, that the drop is "detached" .from the modal

Bjorn van de Peut
@bjorno43
Nov 21 2018 04:13
@Marmiz I believe materialize doesn't do this. It automaticly uses the parent as its wrapper: https://materializecss.com/select.html#properties Materialize replaces the select HTML with its own generated html so there's not much you can do with it. However, it does allow you to pass a custom css class so you can change stuff
@kinopotato No I've tried that. The z-index are like Photoshop layers. It's not like the underlaying element is on top of the menu. If that was the case, the menu wouldn't be visible
Claudio Restifo
@Marmiz
Nov 21 2018 04:15
@bjorno43 select has a dropDown options, and dropdown listcontainer` as one of its option
https://materializecss.com/dropdown.html
dyon gerwen
@fullstackinprogress_gitlab
Nov 21 2018 04:15
hello all !! can someone tell me why the value of my mongoose object not updating to the new value ?
 .then(charge => {
        User.findOneAndUpdate({googleId: req.user.googleId}).then((currentUser) => {
         currentUser.premiumTimer = Date.now()
         console.log(currentUser)
        })
        console.log("this issssss",req.user._id)
        res.render("charge")}); // render the charge view: views/charge.pug

});
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:16
@Marmiz Ahh I missed that part! Lemme check that out
Claudio Restifo
@Marmiz
Nov 21 2018 04:16
@bjorno43 all the CSS library are mostly the same ^^
const elem =  document.getElementById('your-select')
M.FormSelect.init(elem, {dropdownOptions:{container: 'the-card'}});
something like this?
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:26

@Marmiz I tried this (using jQuery):

var obj = {
    dropdownOptions: document.getElementById('select-container')
}

$('select').formSelect({
    dropdownOptions: obj
});

And then giving the card the id select-container. But it had no effect at all

Oh wait..
Nah, doesn't seem to work. Noticed I forgot container but it makes no difference:
var obj = {
    dropdownOptions: {
        container: document.getElementById('select-container')
    }
}

$('select').formSelect({
    dropdownOptions: obj
});
Oops
Never mind.. dubble dropdownOptions. Works perfectly! Thanks @Marmiz :D
Claudio Restifo
@Marmiz
Nov 21 2018 04:29
is it working??
@bjorno43
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:29
Yup
Claudio Restifo
@Marmiz
Nov 21 2018 04:29
:sparkles: :sparkles:
final code? now i'm curious
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:31
var obj = {
    container: document.getElementById('select-container')
}

$('select').formSelect({
    dropdownOptions: obj
});
And changed <div class="card alt"> to <div class="card alt" id="select-container">
Claudio Restifo
@Marmiz
Nov 21 2018 04:32
:bomb: :fire: :fireworks:
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:32
Now for the birthdate selection.. That's a different library so might be trickier
I know materialize provides its own calendar date selector, but about 60% of my 250+ users couldn't work with it. So I had to replace that one
Problem with Materialize is that the "year" selector is very unclear and it blocks users from manually writing or editing the date
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:40
Appearently that library (Pikaday js) also provides a container option. However, it just adds the date picker to the container at the bottom if you use that, lol
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:49
Never mind, it's my own stupidity in this case
Fixed it
Bjorn van de Peut
@bjorno43
Nov 21 2018 04:55
Btw, any of you here a streamer?
I bought the Logitech c922 Pro Streaming webcam today and it came with 3 months of free XSplit premium (streaming software). As I'm not a streamer, I have no use for it. So if I decide to keep the webcam after testing it, I'll give that away to someone that can use it
Claudio Restifo
@Marmiz
Nov 21 2018 05:09
never stremed, but I thought about it.
That is either videogames or coding session :)
like right now I'm making a aside navigation in scss.
Maybe someone would watch it ^^
Bjorn van de Peut
@bjorno43
Nov 21 2018 05:36
Ghehe
I'm fighting with Regex right now, lol
Works fine on regex101, but of course JS doesn't like it..
^(0[1-9]|[12][0-9]|3[01])[-](0[1-9]|1[012])[-](19|20)\d\d$ -> 10-10-2010 = Match. JS: No Match
Oh never mind
JS wants to escape \d => \\d
kinopotato
@kinopotato
Nov 21 2018 05:46
you need to watch hackerman for inspiration, I wish to be him someday
https://www.youtube.com/watch?v=fQGbXmkSArs
Aditya
@ezioda004
Nov 21 2018 05:50
from future import time_machine
Claudio Restifo
@Marmiz
Nov 21 2018 05:52
@ezioda004 not supported yet. You need require
:laughing:
Aditya
@ezioda004
Nov 21 2018 05:53
Petition to change JS to python :D
Claudio Restifo
@Marmiz
Nov 21 2018 05:54
never fiddled with python. Is it fun?
so far I'm investing some time in Go since it reminds me of C
I like the name bc of Harry Potter
kinopotato
@kinopotato
Nov 21 2018 05:55
only hackerman can use python and JS at the same time on the same editor
overload the computer with so much math that it evolves into a time machine
Aditya
@ezioda004
Nov 21 2018 05:56
Oh yeah, its more expressive - little to no syntax clobber and quite powerful. I'm doing some ML with python. I'll still take JS over python because of the syntax, I'm too used to C/JS type syntax (curly braces, semicolons), python still feels weird.
kinopotato
@kinopotato
Nov 21 2018 06:15

What is wrong with my logic??

let button = document.querySelector("button");

    button.addEventListener("click", function() {
        if (button.style.color = "red"){
      color = button.style.color = "blue";
    } else {
      color = button.style.color = "red";
    }

    });

it's only turning blue, there is no css, button color is default color. I feel like I'm missing something new with DOM manipulation that I didn't encounter learning vanilla js

Aditya
@ezioda004
Nov 21 2018 06:17
if (button.style.color = "red")
Assignment operator instead of equality.
kinopotato
@kinopotato
Nov 21 2018 06:17
so basically I'm still dumb as a rock :|
it's working now, :|
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:32
@kinopotato Nah, it means nothing. I'm writing complicated stuff like websocket chatsystems over here and yet I can't even get a damn checkbox to work.. :laughing:
kinopotato
@kinopotato
Nov 21 2018 06:34
@bjorno43 haha, thanks, it's really difficult to consolidate everything. I went back to HTML and now I've forgotten JS stuff.
that's 4 days after getting the JS certificate, something is wrong with my head. lol
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:38
Well, there's a saying in schools here about that
The more you learn, the more you know.
The more you know, the more you forget.
The more you forget, the less you know.
Why bother learning in the first place?
kinopotato
@kinopotato
Nov 21 2018 06:41
haha, that's a good argument. Though since learning JS I've now had ideas pop into my head like a button that you have to click but keeps moving and other stupid things like that that I want to build. So I guess it's worth forgetting. #deepShitBroInCamelCase
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:42
Ghehe those things are childsplay :P Have you worked with canvas yet?
kinopotato
@kinopotato
Nov 21 2018 06:42
is that like flexbox/grid?
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:43
No canvas is HTML5 / JS. Like drawing paper on your website where you can draw upon with JS
kinopotato
@kinopotato
Nov 21 2018 06:43
I'm still at the very early stages of dom manipulation, this is the first time that I'm really having fun (outside of solving sorta difficult challenges during FCC JS)
I've always thought of that as a webapp
you can make something like that with just js?
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:44
No canvas is supposed to be the replacement of Flash / Java. You can write games in it if you want to and they can actually run as smooth as any real pc game
Aditya
@ezioda004
Nov 21 2018 06:45
Just use unreal engine in the browser :D
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:45
:joy:
@kinopotato Anyway, I mentioned it because with Canvas you can really do stupid shit like what you said. Making buttons jump etc
kinopotato
@kinopotato
Nov 21 2018 06:47
I was thinking of using grid and figuring out how to make it jump at a pseudo random spot. but canvas sounds awesome!
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:47
I mean, you could do it without. But it'll be a bit more challenging.. especially if you have other stuff on your website as well
kinopotato
@kinopotato
Nov 21 2018 06:48
just thinking of using codepen,
will it run there??
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:49
Yes. I actually did something with Canvas there myself: https://codepen.io/bjorno43/pen/bMyppJ
You can drag the black box around :P
It looks really simple. But it was actually very challenging to make that, haha
kinopotato
@kinopotato
Nov 21 2018 06:52
there seems to be a ton of things here that didn't make it to the dom??
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:52
Canvas really is like a piece of paper. The things you draw upon it, aren't objects. So you can't interact with them. The only way to do stuff like that is by erasing the canvas on every frame and re-draw the entire paper. That's what's happening over there. Every pixel you move while dragging with your mouse, the canvas is re-drawn. You just cant see it :P
Every piece of code you see there is being used in the dom :)
kinopotato
@kinopotato
Nov 21 2018 06:53
this is exciting stuff O.O
I want to make games eventually
I didn't even know this existed
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:54
Well then you've got some learning and experimenting to do
I've had a lot of fun playing around with canvas, so ye, definitely worth it
kinopotato
@kinopotato
Nov 21 2018 06:55
I'll definitely check this out, though right now I need to learn DOM manipulation xD I keep getting sidetracked
Bjorn van de Peut
@bjorno43
Nov 21 2018 06:55
:joy:
It's not really that hard. You basicly create some kind of grid. Then use JS to create some button element. Add it somewhere to your dom. Then just create a custom event handler on mouseover which will remove the button and adds it somewhere else :P
Aditya
@ezioda004
Nov 21 2018 07:00
@bjorno43 Its a real thing
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:00
I actually once saw a "joke virus" for Windows that did that with the Start button. Everytime you moved your mouse on it, the button would go somewhere else, lol
Aditya
@ezioda004
Nov 21 2018 07:00
I cant seem to find the one where you can explore too, but yeah browsers can run unreal engine with wasm
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:00
@ezioda004 Almost.. "Downloaded a compressed file UE4Game-HTML5-Shipping.js.gz without the necessary HTTP response header "Content-Encoding: gzip" specified!
Please configure gzip compression on this asset on the web server to serve gzipped assets!"
Aditya
@ezioda004
Nov 21 2018 07:02
Lol, thats unfortunate - works in mine tho
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:02
But ye, I know it exists. Unity also has this option to compile for the web
Aditya
@ezioda004
Nov 21 2018 07:03
Yeah, wasm is exciting technology but I hope it doesnt replace JS lol
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:03
Though Unity still requires the visitor to have Unity player installed. I guess Unreal has something simular which might be why it doesn't work for me
Nah that'll never happen. JS is simply too big to be replaced
kinopotato
@kinopotato
Nov 21 2018 07:05
no need to worry about JS, AI will replace us all anyway :|
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:10
I don't think that'll happen either. If we were to actually proceed with AI on such a level, it would be to create an utopia for mankind. Trouble is, if machines take over everything, humans become very, very bored. We'd destroy any AI long before it gets to the level where it would destroy us :P
kinopotato
@kinopotato
Nov 21 2018 07:11
I honestly don't think AI will destroy us even if they become capable of doing so, and to be honest, I want to have AI control much of the government
Aditya
@ezioda004
Nov 21 2018 07:11
But what if AI can already anticipate that and plays along until the moment it can finally destroy us!
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:12
Or we'll end up with something like The Matrix where everyone basicly becomes a God in their own virtual world
kinopotato
@kinopotato
Nov 21 2018 07:12
I don't mind living in a virtual world full of waifus, I'm not an anime addict, but I can't say the idea is not enticing
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:14
@ezioda004 It would still first need to reach that level and as suspicious as we are, we'd be monitoring every single line of code an AI writes like hawks, lol
I'm most definitely an anime addict. Gimme the waifus already!
kinopotato
@kinopotato
Nov 21 2018 07:15
our future machine overlords will like you
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:15
:joy:
Aditya
@ezioda004
Nov 21 2018 07:17
@bjorno43 So far what I've learned in the ML course is that - it comes down to the dataset you're feeding the model, and the neural network we create is very similar to our own, you just have to create a line which separates red from blue or right from wrong and there are many ways this can go wrong :P
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:17
Anyway, bought a new webcam yesterday. Appearently 10 year old webcams can litterly just fall apart eventually, lol
@ezioda004 Very true
kinopotato
@kinopotato
Nov 21 2018 07:21
webcams only fall apart like that if NSA is always watching
I honestly don't know how we can make an AI equivalent to our own intellect when computers can't even understand language, then again I don't know anything about machine learning yet
Aditya
@ezioda004
Nov 21 2018 07:27
@kinopotato From my understanding, a better analogy is to think of an AI as a baby who can only do 1 thing and then you teach the baby many times what is right and wrong. Sure, it'll make few mistakes at the beginning but with every mistake the model will get closer to "fitting".
Its certainly not at our level of intellect but do remember that we have self driving cars on the horizon which can drive better than us.
kinopotato
@kinopotato
Nov 21 2018 07:32
@ezioda004 I get that because of how (from what I've heard) youtube recommends videos. They see similar videos of the ones you've finished and recommends them to you and they learn as per which you click and which you don't. . . but how do we get waifus from that? lol, kidding aside, what I mean is, don't we need to understand first how we structure data and retrieve it before we can even begin to make machines that do the same due to my assumption that an AI will always be structured based on our own intellect which means it will have the same processes that we have, albeit way more consistent which means if we don't understand how we do things, how can we make machine that do as we do.
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:38
Actually, I think you should view an AI as a human being with perfect memory and no emotional conflicts. Believe me, if we humans had that, we'd be a lot further ahead with our technology. So if an AI was at our level, it could invent new technology much faster than we ever could
Aditya
@ezioda004
Nov 21 2018 07:39
@kinopotato We basically design the neural network and feed the data set to the model, it can then start making decisions and keep learning on more data you feed it to. If you're more interested in this subject, highly recommend this video.
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:40
I mean, imagine an AI that litterly knows all the facts that are on the internet. Just the facts. And that it would have perfect memory of that and is able to access it on a wimp.. it's just scary
Anyway, what I do know for sure is that we should NEVER tell an AI to protect us
Cuz it would very soon protect us from ourselves.. :joy:
Aditya
@ezioda004
Nov 21 2018 07:43
Thats like the plot of most AI gone wrong movies lol
Kshitiz
@kshtzsharma48
Nov 21 2018 07:47
How to become good at creating logic in programming
Can anybody help
Aditya
@ezioda004
Nov 21 2018 07:49
There is no secret recipe, practice is the only key. Solve algorithms, get them reviewed, learn from it and repeat.
Kshitiz
@kshtzsharma48
Nov 21 2018 07:50
Thanks Aditya
Are you currently working in India
Where are you from
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:52
My trick for creating logic is trying to think like a computer. It only understands logic :P
Aditya
@ezioda004
Nov 21 2018 07:52
@kshtzsharma48 I'm a student, recently started applying, currently at Bangalore.
Kshitiz
@kshtzsharma48
Nov 21 2018 07:53
Ohhhh great
Thanks for the help buddy
kinopotato
@kinopotato
Nov 21 2018 07:53
logic is basically algorithm yes?
Aditya
@ezioda004
Nov 21 2018 07:53
No problem :thumbsup:
Claudio Restifo
@Marmiz
Nov 21 2018 07:53
@ezioda004 you tickled my curiosity.
any recommendation on a good read for python?
something like a tour of go or FCC for JS?
kinopotato
@kinopotato
Nov 21 2018 07:54
quantum computing is also becoming a thing, loops are so 1950s
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:56
Algorithm is just a word programmers use when they don't want to explain what they did
Aditya
@ezioda004
Nov 21 2018 07:57
@Marmiz I did codecademy's python course a long time ago. It was decent and easy enough but since you know JS quite well, I'm confident you'll have 0 to no problem getting to intermediate Python in a week or so, its very similar to JS. You can also do learn python the hard way which is like the YDKJS for python.
Bjorn van de Peut
@bjorno43
Nov 21 2018 07:57
Joking aside, algorithm is just the way your code works. Whether that's a logical approach or not is something entirely different
Claudio Restifo
@Marmiz
Nov 21 2018 07:58

@bjorno43 since you were talking about AI

xkcd

Bjorn van de Peut
@bjorno43
Nov 21 2018 07:58
:joy:
Get me the exact answer to Pi. Cya
Claudio Restifo
@Marmiz
Nov 21 2018 07:59

@ezioda004

like the YDKJS for python

sounds promising

thanks :+1:
Bjorn van de Peut
@bjorno43
Nov 21 2018 08:00
Tell me what happens if an unstopable object collides with an immovable object
Aditya
@ezioda004
Nov 21 2018 08:01
@Marmiz No problem! Goodluck
Bjorn van de Peut
@bjorno43
Nov 21 2018 08:01
How to kill AI 101.. throw it a paradox
Ghost
@ghost~5b53da7dd73408ce4fa1d2e5
Nov 21 2018 08:12
Hi, guys just in case what will make you to decide to use vue over react?
Aditya
@ezioda004
Nov 21 2018 08:12
@kinopotato x
@isemaj_gitlab You might wanna check out the recent survey of JS. Job opportunities would be one of the main factor for me to pick, luckily where I live React is getting popular and has taken over Angular and Vue but a lot.
Ghost
@ghost~5b53da7dd73408ce4fa1d2e5
Nov 21 2018 08:19
That's what I'm considering also. Thank you.
May Kittens Devour Your Soul
@diomed
Nov 21 2018 09:53
@ezioda004 are you there, JS god? it's me, :cat:
kinopotato
@kinopotato
Nov 21 2018 09:53

hello, so I have a somewhat weird question. I used an incremental approach with this code that changes the h1 element from blue to red depending on how many times it was clicked

let h1 = document.querySelector("h1");
let i = 1;
h1.addEventListener("click", ()=> {

  if (i % 2 === 0){
    h1.style.color = "red";
    i++;
  } else {
    h1.style.color = "blue";
    i++;
  }
})

so I was just curious, if I used this kind of approach in an actual website, won't the i permanently keep increasing until a stack overload? (unless of course I put something like if (i >100){
i = 1;
}

May Kittens Devour Your Soul
@diomed
Nov 21 2018 09:54
cinemapotato
kinopotato
@kinopotato
Nov 21 2018 09:54
I mean the clicks are server side or client side?
@diomed is that my cousin?
Aditya
@ezioda004
Nov 21 2018 09:54
@diomed Maybe
kinopotato
@kinopotato
Nov 21 2018 09:54
oh because kino means cinema?
May Kittens Devour Your Soul
@diomed
Nov 21 2018 09:54
yes
kinopotato
@kinopotato
Nov 21 2018 09:55
kinopotato sounds more catchy tho
Aditya
@ezioda004
Nov 21 2018 09:55
@kinopotato Umm i isnt stored in stack.
kinopotato
@kinopotato
Nov 21 2018 09:56
@ezioda004 but if I make a while loop that keeps increasing i, it will result in a stack overload???
I'm guessing I'll learn this stuff once I do backend?
Aditya
@ezioda004
Nov 21 2018 09:58
@kinopotato Stack overflow happens when a function recursively calls itself. The answer to this question is a bit complicated, the implementer (browsers/environments) decide how memory is being allocated.
But ican store 64bit values
kinopotato
@kinopotato
Nov 21 2018 09:59
low level stuff I suppose, well I'll get there, hopefully soon. haha
May Kittens Devour Your Soul
@diomed
Nov 21 2018 09:59
@ezioda004 is stack overflow a bad thing?
kinopotato
@kinopotato
Nov 21 2018 10:00
only if you want a functioning computer?
Aditya
@ezioda004
Nov 21 2018 10:00
@kinopotato JS has numbers which are of double datatype in other languages, so you can have values till 2^53-ish until it starts losing precision
@diomed This question is a duplicate - locked.
May Kittens Devour Your Soul
@diomed
Nov 21 2018 10:01
:crying_cat_face:
青青子衿
@ldama
Nov 21 2018 10:26
为什么 REGIHER3=TRUE
May Kittens Devour Your Soul
@diomed
Nov 21 2018 10:28
@ezioda004 riddle me this :arrow_upper_left: :arrow_up: :arrow_up_small:
青青子衿
@ldama
Nov 21 2018 10:29
image.png
Aditya
@ezioda004
Nov 21 2018 10:29
Umm loks like Java
青青子衿
@ldama
Nov 21 2018 10:29
yes
May Kittens Devour Your Soul
@diomed
Nov 21 2018 10:30
we dont learn java here
only javascript
青青子衿
@ldama
Nov 21 2018 10:30
ha
thank you
May Kittens Devour Your Soul
@diomed
Nov 21 2018 10:30
and manish guru ain't here to help :stuck_out_tongue:
@ezioda004 do you see @Manish-Giri around later?
Aditya
@ezioda004
Nov 21 2018 10:33
@ldama Whats your question? Might be able to help you.
@diomed Yeah, hes usually helping out with PR's. I think I saw him yesterday
青青子衿
@ldama
Nov 21 2018 10:36
@ezioda004 why REGIHER3=true
image.png
but (!"\\".equals(codes.getString("REGIHER")))=false
May Kittens Devour Your Soul
@diomed
Nov 21 2018 10:37
looks like things are good when numbered but bad when not numbered
青青子衿
@ldama
Nov 21 2018 10:53
dont get
Aditya
@ezioda004
Nov 21 2018 10:58
Yeah sorry I dont know :/
xAirx
@xAirx
Nov 21 2018 11:08
Hi im looking for someone who was experience with php + woocommerce + yith, im trying to solve a problem i feel im close to solving but i need some expertise!
青青子衿
@ldama
Nov 21 2018 11:11
@ezioda004 thank you
Supra01
@Supra01
Nov 21 2018 11:14
Hello! I'm trying to stop the litags from overlapping. How do I go about that?
https://codepen.io/Supra_01/pen/PxEMza
May Kittens Devour Your Soul
@diomed
Nov 21 2018 11:16
@Supra01 looks like your height is too small
in .small
Supra01
@Supra01
Nov 21 2018 11:18
@diomed eventually I want to toggle .small and .big to show which one is active.
@diomed How do I make one li bigger (vertically) and the other lis smaller without having them overlap?
青青子衿
@ldama
Nov 21 2018 11:27
@ezioda004 i get answer .
image.png
kinopotato
@kinopotato
Nov 21 2018 11:57
that moment when you have to re-learn flex box again :|
Aditya
@ezioda004
Nov 21 2018 12:00
I re-learn before every project, I've done so many time that I remember it
kinopotato
@kinopotato
Nov 21 2018 12:01
that gives me the confidence that I won't be like this forever, haha
I want to make an LSD code using recursion changing the div background continuously, but how do I get the functions to run at the same time?
Aditya
@ezioda004
Nov 21 2018 12:05
You wanna make wat
You could use setInterval(), dont need to use recursion here.
Because every function will be added to the stack and it'll block the main thread, so the DOM will never update.
But setInteval will push stuff to queue and let the DOM update when the event loop gets a chance to complete.
kinopotato
@kinopotato
Nov 21 2018 12:13
will that end eventually? because I want things to keep changing thus the recursion. and as I've said before, I have a lot of stupid things in my head, and JS has given me the powah!
Aditya
@ezioda004
Nov 21 2018 12:15
Umm if you do clearInterval() then only it'll end
kinopotato
@kinopotato
Nov 21 2018 12:17
MUWAHAHAHAHAHA, MUWAHAHAHAHA, I'm quite excited, you have given me the wisdom to make shitty things! All is possible in JavaScript
andrea
@girlcodecrush
Nov 21 2018 12:44
On the server side, I created a MongoDB on mLab. It’s my first time to use MongoDB. After creating a model class, I turned on the server and refreshed mLab, then tried to check if new collections were created. But there weren’t new collections. In this case, what should I have to check first?
Aditya
@ezioda004
Nov 21 2018 13:11
I dont think mLab updates until you create a document from that model and save it.
Fay Vor
@phavor
Nov 21 2018 13:53

I have a socket.io app I have been working on, I want to implement user is typing to other people connected to the same room.

This is what I wrote...

$('[name=message]').on('keyup', function () {
  let textBox = $('[name=message]')
  let informant = $('#isTyping')

  if (textBox.length > 0 && textBox.val() !== '') {
    informant.text('someone is typing...')
  } else {
    informant.text('')
  }
})

The above code only work for the user who is typing. This is the exact opposite of what I need.

So I wrote this to pass the event to the server

socket.on('isTyping', function (user) {
  // socket.emit('isTyping', {

  // })
  console.log(user)
})

But it doesn't work. Any help would be appreciated. Thanks

dyon gerwen
@fullstackinprogress_gitlab
Nov 21 2018 14:20
hello all !! can someone tell me why the value of my mongoose object not updating to the new value ?
 .then(charge => {
        User.findOneAndUpdate({googleId: req.user.googleId}).then((currentUser) => {
         currentUser.premiumTimer = Date.now()
         console.log(currentUser)
        })
        console.log("this issssss",req.user._id)
        res.render("charge")}); // render the charge view: views/charge.pug

});
Fay Vor
@phavor
Nov 21 2018 14:46
@fullstackinprogress_gitlab you have to return new object when you have updated it
Niraj Nandish
@Nirajn2311
Nov 21 2018 14:50
@diomed How's the Vue :cat: today
Fay Vor
@phavor
Nov 21 2018 14:51
then(charge => {
        User.findOneAndUpdate({googleId: req.user.googleId})
           .then((currentUser) => {
               currentUser.premiumTimer = Date.now()
               console.log(currentUser)
           })
        console.log("this issssss",req.user._id)
        res.render("charge")}); // render the charge view: views/charge.pug
}, { new: true }); // this line should return the new object.
@fullstackinprogress_gitlab you can also check the docs
dyon gerwen
@fullstackinprogress_gitlab
Nov 21 2018 15:04
@phavor thanks !!!
Fay Vor
@phavor
Nov 21 2018 15:27
you welcome @fullstackinprogress_gitlab
May Kittens Devour Your Soul
@diomed
Nov 21 2018 15:52
@Nirajn2311 am fine, fine fine FINEEEEEE!!!! :smirk_cat:
grrrrr
@phavor I always wondered why Flash ain't black
coz he's fast
Aditya
@ezioda004
Nov 21 2018 15:59
:question: :exclamation:
Fay Vor
@phavor
Nov 21 2018 15:59
@diomed I don't understand oo. lol, well I had a very heartbreaking laptop that wouldn't let me work. Thankfully I've changed it with a better one.
@diomed you use socket.io right?
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:03
IDEvenKnow what is that for
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:04
@diomed You had some doubt at midnight yesterday, what was it
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:04
one should never question midnight doubts
unless you have time
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:05
Yes, I have time why else would I be asking
thekindlyelk
@thekindlyelk
Nov 21 2018 16:05
I think he's talking about prons
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:05
@thekindlyelk porns?
I scratched my fingers today and made them bleed, fml
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:07
Careful :cat:, you dont want to get banned by me
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:08
@Nirajn2311 how would you ban me? lol
you aint mod or anything
right? right? right? :scream_cat:
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:08
Maybe I am, maybe I am not, Who knows
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:09
eh, another mod wannabe :yum:
so - where were we? . . .
sorry, FreeCodeCamp's mascot :cat: cannot be banned
Aditya
@ezioda004
Nov 21 2018 16:09
Idk I like :dog:
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:10
I like :fox:
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:10
🦊
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:10
@diomed we were at midnight doubt
How did you get that emoji into gitter :scream:
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:11
I have this extension for Firefox called Emoji Helper
so I don't have to think :honey_pot: :bee:
🔱
Aditya
@ezioda004
Nov 21 2018 16:14
🤖
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:14
@Nirajn2311 look @ this: http://fiber.p4o.net/grav/
I'd like to make menu fixed, like here: https://getmdl.io/templates/android-dot-com/index.html
I did add some classes - but apparently not enough, & not right ones. lol
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:19
Which theme are you using
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:20
but I want fixed header of white one
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:21
You want a white fixed header??
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:21
yes
not white, but fixed
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:22
And you are using material design lite?
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:24
yes
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:38
@diomed just add position: fixed style to that component
May Kittens Devour Your Soul
@diomed
Nov 21 2018 16:48
@Nirajn2311 what? and ruin all the fun of complex mdl divs and classes?
PFFFT
you're so so so... avoiding the problem with your simple solutions
Niraj Nandish
@Nirajn2311
Nov 21 2018 16:49
@diomed Follow the KEEP IT SIMPLE method or else you're just complicating stuff
Also theres no problem with that
May Kittens Devour Your Soul
@diomed
Nov 21 2018 17:00
@Nirajn2311 in what to put margin size?
what is the best unit?
Aditya
@ezioda004
Nov 21 2018 17:08
There is no "best unit", depends on your use case
@diomed 🐟
May Kittens Devour Your Soul
@diomed
Nov 21 2018 17:31
@ezioda004 what should I do when position:sticky doesn't work? should I smash keyboard, or beat my laptop with it or simply hit a screen few times with it?
Aditya
@ezioda004
Nov 21 2018 17:33
Could use some adhesive to stick it up
May Kittens Devour Your Soul
@diomed
Nov 21 2018 17:37
:cat: noms :fish:
Niraj Nandish
@Nirajn2311
Nov 21 2018 17:51
@diomed :fish_cake:
Roko Medančić
@R0k0
Nov 21 2018 19:49
Hi, I don't know if I am in right place, but I have problem with positioning elements. I know that body is static by default, that to use absolute element inside parent element which must be relative, in that absolute must be absolute to be relative to parent absolute of relative. But I trying to make tabs like this g,h,i but it don't move inline. What is wrong? https://jsfiddle.net/k980nzgu/7/
I trying to work in ie6 and ie8 :/ , because on work (bakery) we have win xp and ie6, so that I don't need ask for admin right (to make some c++ program) is much easer to put some web simple program (it is ofline pc) to test it and show boss if will work. so he can take it.
Roko Medančić
@R0k0
Nov 21 2018 19:57
@All
@/all