« first day (2583 days earlier)      last day (2590 days later) » 

user1928251
12:00
sorry it's working my bad thanks
user1928251
thanks a lot
12:25
@ssube
Died once right in the end
what game is this?
Destiny 2
what is the pattern where a function is called like this: funcName(someArg)() called
@relidon Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
Does anyone have any experience with heroku?
12:28
!!welcome RachelDockter
@RachelDockter Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
its more of a can someone walk me through this
@relidon Maybe you mean higher order functions? The practice of functions accepting or returning functions?
not really an open question
guys I don't get what this means:
pulsado() {
                this.props.handleClick(this.props.id)
            }
12:29
did you read the manual?
where'd you get stuck?
@Zirak that might be it
yeh, the bit where i try and update my existing app
@Zirak thanks
its saying heroku: git is not a heroku command
@relidon rock on
12:30
@QuicoLlinaresLlorens it's a method that triggers a function that has been passed as a prop, and you pass it another property of the props
@RachelDockter what commands did you do?
but the think is that in the example I think the method is not declared
on the website it says to do this one "heroku git:remote -a appName"
I have exactly this:
but then it says git is not a heroku command
class Item extends React.Component {
    pulsado() {
        this.props.handleClick(this.props.id)
    }
    render() {
        if (this.props.vivo)
            return <li onClick={this.pulsado.bind(this)}>{this.props.nombre}</li>
        else
            return <li onClick={this.pulsado.bind(this)} className="tachado">{this.props.nombre}</li>
    }
}
class Lista extends React.Component {
    constructor(props) {
        super(props)
        var vivos = new Array(this.props.nombres.length)
        vivos.fill(true)
12:32
						  <Item id={i}
                                key={i}
                                nombre={this.props.nombres[i]}
                                vivo={this.state.vivos[i]}
                                handleClick={this.toggle.bind(this)}/>)
that's where they're defined
ahh ok, so basically when it events a click, it will call toggle function, no?
aye
and since toggle needs the id, it passes the id through the props
@RachelDockter can you link to that?
12:34
So, thanks!
if you support class properties, might want to write things a bit differently
@RachelDockter oh, you need to install this: github.com/heroku/heroku-git
pulsado = () => this.props.handleClick(this.props.id)
@towc i just updated it without linking the app, i have no idea how it knew which app to update
you don't need to bind it in render() then, it's a bit expensive
12:35
@RachelDockter it can detect what directory you're in and what files it contains :P
well thats clever but now its crashing anyway for some unknown reason haha
it worked fine locally
what exact steps did you do?
and what do you mean by "crashing"?
@FilipDupanović thanks man
i did, "git add .", "git commit -m "db", "git push heroku master"
with this error in my log
i probs shouldnt of shown my ip haha
we know it anyway, dw
12:38
:S
the change i made was allowing it to connect to an sql database right
so i used the npm package my sql
would i need to put it in the dependancies file?
did you create an sql database for it to use?
yeh it connects just fine
@FilipDupanović I think you mean this:
class Item extends React.Component {
            pulsado = () => this.props.handleClick(this.props.id)
            render() {
                if (this.props.vivo)
                    return <li onClick={this.pulsado}>{this.props.nombre}</li>
                else
                    return <li onClick={this.pulsado} className="tachado">{this.props.nombre}</li>
            }
        }
and yeah, you might need to npm i --save mysql
or add it in the package.json
otherwise heroku won't know to install it
@QuicoLlinaresLlorens yup!
12:40
ok i added this to the dependancies in the package.json file "mysql": "2.15.0"
i think thats right
push again
usually, you'd do it in the constructor(), not render(); if you have babeljs.io/docs/plugins/transform-class-properties then you can write it exactly that way
Clearer an simpler.
yeah, it's pretty easy to forget to bind in the constructor :S
thats very weird it kind of worked lol
well it didnt crash, theres a problem with the html
so thats alot better, thanks for the help tho
12:42
what you mean in the constructor?
the bind no?
with =>
god dammit i messed up big time
i coped and pasted and overwrite all the files in my heroku app so it tries to connect locally
nooooo
i fogot what i had before
yeah, unless you use the class property syntax you have to bind manually or inline the function in the constructor
ewww to both
Ok, what I have now it is ok, since it is what professor explained us. Thanks
cool! don't forget to think for yourself :P
Oops, I am having this error
ERROR in ./js/main.js
Module build failed: SyntaxError: Unexpected token (221:20)

  219 |         //Definimos la clase del componente
  220 |         class Item extends React.Component {
> 221 |             pulsado = () => {this.props.handleClick(this.props.id)}
      |                     ^
  222 |             render() {
  223 |                 if (this.props.vivo)
  224 |                     return <li onClick={this.pulsado}>{this.props.nombre}</li>
12:50
yeah, you need the transformer plugin then babeljs.io/docs/plugins/transform-class-properties
can you dump your .babelrc
I can help you poke at it
this is my webpack:
var path = require('path');
var dir_js = path.resolve(__dirname, 'js')
module.exports = {
    //archivo "inicial" por el que se empieza a ver las dependencias
    entry: path.resolve(dir_js,'main.js'),
    //bundle construido por webpack, uniendo archivo inicial y dependencias
    output: {
        path: __dirname,
        filename: 'bundle.js'
    },
    module: {
        //"filtros" por los que pasa el código antes de generar el bundle
        loaders: [
            {
                test: dir_js,
@towc do u know if heroku keeps previous builds? i overwritten all part where it connects to their server
git does
12:53
so if i log into git i can see the build from a month ago
i didnt even know i had an account
git is just a protocol/set of tools
github or bitbucket are the things you'll have an account in
oh ok so how would is see a previous build from git?
go to the repository
is that on heroku?
@QuicoLlinaresLlorens npm install --save-dev babel-plugin-transform-class-properties
12:54
no
Oh it is other thing?
I thought it was that one
sorry
I strongly suggest getting a base understanding of git before keeping on with heroku
how would i find the git reposity?
google it
why not save normal?
and in dev?
12:55
you'll also need to add it to babel-loader in the webpack config 🤕 github.com/babel/babel-loader#options
can someone look at regex101.com/r/QnrXN8/3 a second ? can't figure what is missing in my regex, which is very easy indeed :/
@QuicoLlinaresLlorens usually you stuff webpack plugins under dev
for the next person that sources your package
if your prof placed everything under {dependencies}, then I guess follow suit
@azro You're a cheeky bastard
There's a hidden character between the 4 and /
Hiya @Zirak @Cerbrus @bluefeet nice too see you here :)
In this case 0x202c
13:00
but I mean, if I put in dev, and then the person who tries it doesn't do the npm install --dev it won't work
yeah, because if you push it to an upstream everything better be damn built :D
@Zirak ohw ... yes true i see when I move my cursor it stays txice at this position, i copyer/paste it from a website, didn't image something can be hidden like this .. thanks !
before distribution you run all the build commands and strip all of that from the package
@azro It's one of these things where you get bitten by it twice and then you never forget
sure !
13:04
@FlorianMargaine Congrats! :D
@InsaneCat It's even nicer not to get pinged randomly.
Is not correct to specify the require like this?:
use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            presets: ['es2015', 'react'],
                            plugins: [require('/node_modules/babel-plugin-transform-class-properties')]
                        }
                    }
 ]
Especially by someone I don't know...
@QuicoLlinaresLlorens nop, don't do use absolute paths, let Node.js resolve the module directories
13:14
just plain old require('babel-plugin-transform-class-properties')
either way, I think you can just leave it plugins: ['transform-class-properties']
yep
working
thanks
huzzah 🙌
go razzle-dazzle them professors :)
13:32
@everyone IF you are interested: Ubisoft is distributing a free copy of Watch Dogs on UPlay. Grab it if you don't have that game
2
@Loktar @BenFortune @Cereal ---^
maybe star it so that everyone can see the message :o
and on gog.com: Syberia for free: gog.com/game/syberia
Oh nice, thanks
13:47
sorry to disturb you @Cerbrus take care i'm not come here everyday. i'm gonna happy because seen here so just text to you guys sorry
Dude, don't ping me.
14:08
@Cerbrus just kick him. Madara has given many warnings about the pings.
14:22
would you guys use use gravator vs storing images on aws for profile pics?
for a simple site
or would gravtor look cheap?
gravatars are fine, I think
change it later on maybe and default to gravatars, but unless it's a major feature, don't worry about it yet
14:33
@FlorianMargaine Congratulations!
°
user1928251
hy
user1928251
how can i handle checkboxes in javascript
user1928251
?
14:39
what do you want to handle about them?
user1928251
i want to get their values and display them
user1928251
i have something like this
user1928251
<div class="btn-group" data-toggle="buttons" onchange="updateExtra()">
                  <label class="btn btn-outline-info">
                    <input type="checkbox" name="extra" value="20" autocomplete="off"><i class="fa fa-eercast fa-2x"></i> Ironing
                  </label>
                  <label class="btn btn-outline-info">
                    <input type="checkbox" name="extra" value="20" autocomplete="off"><i class="fa fa-superpowers fa-2x"></i> Inside oven
                  </label>
user1928251
and i want to add or subtract the values
user1928251
every time a checkbox is selected
user1928251
14:41
how do i do that in javascript?
you need to add event listeners to each checkbox
user1928251
i cant make that withonchange="updateExtra()
user1928251
onchange="updateExtra()
user1928251
a function
user1928251
?
user1928251
14:44
?
user1928251
anyone
user1928251
i tried this
user1928251
function displayextra(x) {

                     if (document.getElementById("extra").checked = true) {
                         var extraprice1 = 20;
                    } else if (document.getElementById("extra").checked = false) {
                        var extraprice2 = -20;
                    }

                     var extra = extraprice1 + extraprice2;

                     document.getElementById("showExtra").value = extra;
                 }
user1928251
but i get NaN
you need === instead of =. Single equals is assignment.
user1928251
14:53
where in the if condition?
yep
user1928251
i still get Nan
because extraprice1 and extraprice2 are on separate branches, there's no way they will both be defined
you should probably declare both and set them to 0 before the if, or whatever else makes sense
!!> 20 + undefined
@ssube "NaN"
user1928251
i did
user1928251
14:56
and get the number but when i check another option it doesn't sum
user1928251
it stays 20
user1928251
how can i sum them?
a) make a fiddle
b) how did you get any results? you have getElementById('extra') (twice btw) but your inputs all don't have ids
c) you didn't show us any of the code where you apparently have done what ssube suggested
user1928251
ok i make now
15:03
okay, how about making a working fiddle
you don't have elements there, you have duplicate ids
you didn't have the onload options set
user1928251
wait
user1928251
this is
document.getElementById("extra") is always going to return the first element with that ID that it finds
user1928251
ok so how do i do
user1928251
15:04
i set separate ids
user1928251
?
that would be a way
while browsers let you have duplicate ids, they are technically illegal html
user1928251
i set extra 1 2 3 4
and onchange for a div is just ew
user1928251
15:05
for each
user1928251
yes but it's working
user1928251
i dont need to change that
doesn't make it good
user1928251
ok so what you suggest
user1928251
?
15:07
wrap it in a form, or add an onclick handler to the parent and delegate
user1928251
i cant
lol, okay
user1928251
i need to display that sum every time the user checks a boc
user1928251
box
you can still do that with a form
user1928251
15:08
yes is a part of a from
user1928251
form
then listen for onchange in the form
not the div
user1928251
ok
forms are designed for inputs, and listening for changes on form inputs makes a lot more sense than listening for changes on a divs children
which, btw, totally surprised that even works.
but delegation is probably still the better approach
user1928251
it's not working
15:10
parent.addEventListener('click', event => {
  if( event.target.tagName.toLowerCase() === 'input' && event.target.type === 'checkbox' ) .. do your thing
})
user1928251
the boxes don't check
user1928251
i thought it's better to set a function to the div
user1928251
when that check changes display that sum
user1928251
and it works
user1928251
but i cant get the sum
15:14
parentDiv.addEventListener('click', event => {
  if( event.target.tagName.toLowerCase() === 'input' && event.target.type === 'checkbox' ) {
  	const valueAdded = Number(event.target.value) * (event.target.checked ? 1 : -1);
	output.value = Number(output.value) + valueAdded;
  }
})
user1928251
parentdiv is the of the div where are the checkboxes
the closest parent that contains them all
user1928251
yes
!!afk good luck
user1928251
it's not showing me anything
15:23
is javascript an procedural language and not OOP
user1928251
hello rachel
user1928251
how can i sum them
user1928251
?
user1928251
i have this code but doesn't work
user1928251
 function displayextra(x) {
                    var checkedvalue = 0;
                     var uncheckedvalue = 0;

                    if (document.getElementById("extra").checked = true) {
                        var checkedvalue = 20;
                    } else if (document.getElementById("extra").checked = false) {
                        var uncheckedvalue = -20;
                    }

                     var sum = checkedvalue + uncheckedvalue;
                     document.getElementById("showExtra").value = sum;
user1928251
15:27
i can't get the sum
u can just put else, the else if is useless
but can u make it to a jsfiddle
user1928251
yes
im not one to talk but this is coded very bad
hold on ill fix this for u
user1928251
yes i know is bad
user1928251
15:32
.checked = false are all
user1928251
first
user1928251
ok i ll wait
when you are programming, u need to look at the console
to see the errors you have
user1928251
ok
your onChange is linked to a div
not the buttons
hold on
user1928251
15:36
i thought works as for radios
try .getAttribute("checked") maybe?
@Anakin Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@Anakin That won't work
user1928251
not it doesn't
@AndreiClaudiu You've already been told how to solve it, you're just choosing not to listen
user1928251
15:40
how to solve it
user1928251
?
@AndreiClaudiu Read Rachel's answer
user1928251
your onChange is linked to a div

not the buttons
hold on
user1928251
hold onnnnn
rlemon has already explained what you need to do
Even given you code to work with
15:44
THX @towc
1 message moved to Trash can
@AndreiClaudiu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
1 message moved to Trash can
@AndreiClaudiu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
user1928251
it doesn't work formatiing
i fixed it for u @AndreiClaudiu
make sure all lines have 4 spaces or more (even blank lines). ctrl-k doesn't always indent right if you paste in partially indented code
15:46
that one is alot more orgasnised and better
user1928251
do you have facebook
user1928251
rachel
why do you ask?
user1928251
i think i got lot more to learn from you
out of everyone in here, im not one to learn from haha
@KamilSolecki How is it?
im in love with the customization options
as for the rest:
user1928251
i think i do your code works flawlessly
your intentions may be innocent, the asking for facebook when being so new just smells bad.
15:49
is that Forza 7?
user1928251
yeah i want to kidnap her
I'm old. Give me all dem facebooks.
Need for Speed
yeh it does but thats just really basic code
oh
15:49
1. People have been complaining about the driving model, but NFS is an arcade game. I say its all good, just like it was in previous need for speeds
user1928251
yeah i know
user1928251
do you want to give me
2. the camera works during driving is great
I wanna play it, but I need to wait till payday
3. Difficulty should be harder. I'm playing on Hard and im still winning all the races quite easily
user1928251
15:50
if you want
@AndreiClaudiu quit being creepy
it was bad enough when you were just vamping
4. It took a little 'too long' for the game to actually start as you would think it would. I dont wanna spoil, so ill say just that.
user1928251
no i like because she's smart
people in here are much smarter lol
Luggage warned you about asking for personal information
15:51
Gotta buy a new controller too, threw mine at a wall
kek
which game
rocket league
Hi all I have a question about using Wordpress (not sure if any of you guys deal with it).. I've got a static theme that i'm trying to re-create into a theme and I'm trying to enqueue using the following
function tt_scripts() {
	wp_enqueue_style( 'tt-style', get_template_directory_uri() . 'assets/css/style.min.css' );
	wp_enqueue_script( 'tt-bootstrap-css', get_template_directory_uri() . '/assets/bootstrap/css/bootstrap.min.css');
}
add_action( 'wp_enqueue_scripts', 'tt_scripts' );
15:52
@BenFortune that'll happen
Damn, throwing the controller at the wall for Rocket League? I can easily imagine how that went loil
@AndreiClaudiu this is not a dating site. Stop being creepy, this is your last warning.
@BenFortune so so far (only played about 3 hrs so far) im giving it a solid 8.5. Will update later
I'm getting an ERR_ABORTED in the console log so unsure why that is
@ssube Got almost 900 hours in that game, I uninstalled it and don't intend on playing it again
15:53
man
lol
I suck ass at writing docs
or writing in general
@BenFortune can you guess how many times I uninstalled league of legends? (4K+ hours in it)
I don't have nearly that much, played just enough to pretty regularly beat bots
@ssube lol
15:54
lol
I gave him actual working code
@Mosho the bots are pretty hard
they did a good job with the team work
One more thing about the new NFS
it infuriates me that I cannot change the menu button to be esc instead of tab
once you get the hang of it, they only win when they get lucky and nail the ball straight into the goal from the line
they're especially good in dropshot
They're like snipers in dropshot haha
it's such a good mode, tho
15:57
I played competitive a fair bit, got into chap/grand champ
it's not worth all the rage though
you can get out
and that's all
nods approvingly
¯\_(ツ)_/¯
16:00
Please guys, you know why this shows nothing?gist.github.com/quico14/96db0ea27afb5999b7ef67be4a9122ea
It is react
do you see any errors in the console?
check the console. any errors?
I would add some log messages
and i'd switch to english class/variable/.. names ;)
16:10
Yes, I know, but my professor made this, not me hehehe
I think I need to add to my webpack event emitter
but how can I?
16:27
add what, to where?
EventEmitter
to my webpack
because I write code in .js file
and my professor does it in .html file
and he just add the EventEmitter like this:
    <script src="https://cdnjs.cloudflare.com/ajax/libs/EventEmitter/5.2.3/EventEmitter.min.js"></script>
should I do npm install EventEmitter?
Oh I think I have it
but I need to add
what is the best way of debugging js code?
@SajjadurRahmanSagor Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@SajjadurRahmanSagor The debugger, and the console
Only one way of doing this around?
16:53
💫 you can push into Array.prototype and totally mess up empty arrays
yeah it's pretty funny

« first day (2583 days earlier)      last day (2590 days later) »