« first day (3112 days earlier)      last day (1852 days later) » 

AKS
3:00 PM
I don't know how number works. i will appreciate if you tell me @ShrekOver
 
@OvieAdese so pick up a proto board, like a rpi or something. or a higher quality arduino
make it send voice commands to your server
 
start small. make a POC
 
AKS
let me try @rlemon
 
try what?
 
3:00 PM
@OvieAdese Many cheap smartwatches depend on a smartphone to talk to a server, and for good reasons.
 
I didn't offer a solution
 
AKS
was trying Bigint
but that didn't help
 
Read the 2ality
blog
then the v8 blog
read the whole thing
 
@AKS Most numbers in computer has a representation range, and you are going beyond that range. BigInt is special in that its representation range is as much memory as your browser/computer have - as long as the number is an integer. So it will work as far as your example is concerned if you get it right.
But before asking us to hand the solution to you on a silver platter, may we ask why would you want to shift 000719751186416140289 by 32 bits?
 
AKS
The reason is, the number I shared is session Id consists of session start time, sequence and a random index
and I want to fetch start time back coming from the server
in js
 
3:07 PM
so those leading zeros are meant to be significant?
 
AKS
when I am trying the same in C language I am able to get the correct ans which is 167572788
yes
 
yikes
 
you know whats's funny mate?
 
In that case it may be better to concat the session id as a string, and get a substring in js. In js, "00071" (string) is NOT the same as 00071 (number).
 
3:08 PM
Am I missing something or doesn't a special sequence of 0's mean something in C?
 
> A prefix 0 is used in C to specify string representations of octal numbers
 
@AKS that seems shady to begin with, you shouldn't be using a number to store structured data
 
Yeah. It may be easier to count languages that treat 0 leading numbers as ten based than the other way round.
 
AKS
no meaning in C as such. even if I remove the leading 0's, I get the same result
 
> A prefix 0 is used in C to specify string representations of octal numbers
> 000719751186416140289
HAS A 8 and 9 init
how is your c compiler not throwing a compile error?
 
3:10 PM
octal literals are disallowed in strict. neat
 
Strict C ?
 
Neat indeed. I forgot that.
 
js
 
ah ok 😃
 
AKS
sorry, mistakenly I said, i did not use leading 0 in C
 
3:11 PM
you are still not gettin it
C's int is not the same as javascript's number
which is why I asked you to read the blog :)
when you do

`int blah = 1234567890;` in c this is a integer (hopefully 64 bit on a 64 bit target)
when you do
 
Anyway, @AKS, don't try to process that session id as number. I've heard enough to recommend doing it as a string on both sides.
 
AKS
Blog is little large. I am spending tiingme on it too while replyng
 
var blah = 23492349... its completely different, the runtime decides (with known rules) where this is going to be an int or a weird float
read and then reply :P
 
I was elected to lead!
not to read!
 
Lastly, I question your entire architechture
> The reason is, the number I shared is session Id consists of session start time, sequence and a random index
 
3:15 PM
I don't even dare to ask the architecture. Good luck with that lol.
 
This to me seems like you want a data-structure -- are you trying to decode a byte stream -- why not use json ... or any sane data format here?
@Sheepy lol
 
pft. JSON is so 2015
we're all back to XML now
2
 
is there any difference between the OOPS in java and Javascript?
 
@TharunEniyan Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
@TharunEniyan Yes, Java has a lot of OOPS that causes a lot of oops, JS doesn't have OOPS
 
3:16 PM
Please. We use protobuf for everything now. Especially user configuration
 
@TharunEniyan JavaScript is prototype-based. Which is very unique. Java is class based and much more traditional.
 
@forresthopkinsa hush hush just fucking use native little endain numbers
 
JS has the illusion of classes
 
concatenated with no seperator
 
@ShrekOverflow that's the up-and-coming tech
 
3:17 PM
@shee
 
@forresthopkinsa scrap that, lets just use entangled quantum particles already
 
now we're talking. Get Elon on this
 
We want to communicate not blow up the planet
not sexy enough for elon
 
¯\_(ツ)_/¯
 
although
 
3:18 PM
@Sheepy @ShrekOverflow i already know java, if there is no difference between the OOPS concepts of java and javascript means i can omit it and i move ahead to learn React
 
@forresthopkinsa I'm sure he could do it, but I don't want the first information transfer to be some weeb shit.
 
It's kind of sad. After all these years of optimising prototype based inheritance, now js is pretending to be class based.
 
@TharunEniyan aahhhahahhahaa
 
@rlemon what a time to be alive
 
@TharunEniyan you will still have to learn some basics. JS and Java are similar in syntax and name only.
 
3:19 PM
I would strongly encourage not doing htat
@rlemon syntax?
 
@TharunEniyan I think you mean OOP instead of OOPS. And I am doubtful that you know OOP or Java well enough to appreciate the difference. So be my guest, just go ahead to learn React.
 
they all come from the c family syntax
yes, syntax is similar.
 
function foo (args) { body }
 
@Sheepy oh dear
this is how we get flagged and put on twitter
@TharunEniyan what he is trying to say is the very question you are asking is very naive
It's like I know how to drive a car so I'm going to sit on my carpet and hit the Highway to get to alaska.
 
Yeah. That's between the lines. But I am also sincere in the surface meaning. I think you don't need to know how js really works to learn React.
 
3:22 PM
some would say that learning React is a great way to learn JS
 
@ShrekOverflow @Sheepy ok after i learnt the basics in javascript like functions, objects, arrays, controlflow.. I'm jumping to learn React... btw i'm a naive
 
@forresthopkinsa The STEM toy ads that I read a lot recently say otherwise. They are saying that their fancy robots and drag and drop coding mobile apps are the best. ;)
 
React is cool and all
I'd prefer teaching someone javascript first (or even typescript) then react
wait nvm I didn't factor in the hooks
nvm ... yeah with hooks its actually pretty damn good way to learn JS
Time to run home
 
o/
@TharunEniyan I usually recommend the web book Eloquent JavaScript for learning the basics: eloquentjavascript.net
 
you and your hooks man
 
3:29 PM
thank you @Sheepy i really appreciate it
 
user8729657
@Sheepy, yeah I was thinking about using a phone to act as a gateway
 
user8729657
and @rlemon, I'm gonna get a raspberry pi right now.
 
if nothing comes from it, at least you have a rpi to play with
 
I've often imagined that I'd get a pi and a 3d printer and start becoming a real life (as in physical world) hacker. Reality is I spend my free time on gaming and coding js tools for games and my boss just asked me whether I can do an AR app.
 
heh, I have like 10 pis and a 3d printer.
the pis get very little use
3d printer gets a lot of use for simple things like couplers or clips
or random home repair
 
3:39 PM
I can imagine that. I got a pair of vr glasses earlier this month, and I can't help but feel that I am drifting further and further from the physical world lol
 
🚽
 
hey guys
 
hey guy
 
?
 
3:46 PM
⁉️
 
I've got a question...
and you dudes might wanna go - "huh... this is interesting... maybe it deserves it's own post".
IDK
but here's the thing.
 
huh... this is interesting.. maybe it deserves it's own post
 
you beat me to it
 
3:50 PM
not going into much unneeded detail but TL;DR we started building two slightly similar apps within the same codebase.
butt not we're splitting them up and trying to sort things out.
in an ideal future we should have kinda like a mono-repo (perhaps) but with a core package with things that are shared between both apps, and then isolated packages for each of them.
but for now, because we just did the split - I'm trying to remove duplicate code.
Is there some kind of webpack plugin that can identify dead code?
 
many
 
I've tried a few - but they report lots of false positives.
 
some work better than others.
 
maybe because we're running nextjs
 
tell it to only look at your modules
 
3:52 PM
you said butt
 
and get a good linter.
es/tslint will have a no-unused-vars which should catch within the modules
modules themselves can be picked up by webpack
there is likely still going to be a lot of manual verification
 
our linters are clear :/
 
you need to add the appropriate rules if they are not there.
 
@rlemon what do you mean? how so? Can it report these modules?
I'm pretty sure I got that warning from the linter while coding... so it should pick up if there are any - I will investigate tho
 
3:56 PM
I already said you can use webpack. you'll have to find the appropriate plugin, there are many
 
next already has webpack right? (sorry if I'm saying something stupid)
 
Why don't most developers give a shit about code quality? The amount of effort I have to put in to babysit in order to ensure quality is too damn high.
 
Why do you assume they don't care?
 
What else would it be?
That they just suck and don't know what good code looks like?
I dunno about that
 
i mean
that's a very subjective topic
 
4:08 PM
Manually making sure your braces, parens, spacing, etc is consistent takes little to no effort at all. It's either that they don't care, or they're blind
 
sounds like an IDE problem
 
the IDE is one solution to what is definitely a people problem
 
@ndugger yep
 
@ndugger if you worry about it then they don't have to.
 
If the red filenames stay red till you fix the problem, that's a pretty good motivation to "fix" them.
 
4:10 PM
there are very incompetent developers
and even more incompetent managment
 
bsides
vscode will even fix those problems for you now
 
here in my team, we've been sitting on our butts for quite a while at first.
because there were no designs, the product was not sure which way to go....
 
The tools exist; the problem is that they don't use those either. Again, the IDE/Editor can help be a solution here, but the problem is that they don't give a shit in the first place
 
when there finally were specifications - we were nearly on top of our deadline
 
so make them give a shit
 
4:12 PM
so - to rush things to prod - we stopped doing unit tests
 
I wish I could fire people
 
and we never picked back up on doing them
 
don't accept pull requests with poorly formatted code
 
I started with a questionable project - it should've never been a web app and makes no sense that it is one.
 
The problem is that I'm not the only person doing code reviews, and I have my hands full doing most of the front-end. I was much more engaged on the back-end when I was doing a lot of work in there, but the lead guy for the back-end also has issues with code quality, and he doesn't care
 
4:13 PM
but because thye only have web developers...
 
So yeah, you could say, "oh, just do this...", but it's not that simple
 
just ignore it
that's simple, right?
 
I've been trying that myself.
 
That's a lot more difficult than you might realize for me, but you're right that I should
 
it still eats me up inside .... a LOT
 
4:14 PM
yeah, i hate coming across old poorly formatted code
it's always my code
 
I just want to work on a team where everyone gives a shit...
 
from an earlier time
 
oof
lunch time
 
indeed
!!afk 🍔
 
@ndugger You should be that guy, who complains about everything openly. it worked for George Costanza
he got promoted
 
4:27 PM
but we totally digressed from my question :(
 
I do bitch and moan about it. I'm lucky enough to have a boss that agrees strongly with my stance on code quality
 
everyone loves code quality ... until they have to do something about it
or it hinders the delivery dates...
 
Just pay attention to what you're doing. Sloppily throwing around code without a care in the world is the problem. You can do anything after the fact to clean it up, but just fucking pay attention
One of these people that has issues with quality has also accidentally wiped a production database. It wasn't a big deal, but the person is a senior level engineer. That kind of stuff isn't specific to my current employer. I keep ending up working with people like this, no matter where I go
 
5:31 PM
Hai
 
user8729657
@ndugger, I respect that
 
you respect people that wipe production databases?
 
@ndugger lol
am home!
 
@ndugger depends on whose db
 
user8729657
No I respect the fact you said someone shouldn't be sloppily throwing around code
 
5:39 PM
:( my code doesn't work
 
Anyone worked with simulating clouds or gas visualizations in canvas?
 
I have, but apparently it draws 100% cpu
so probably don't use my technique
and mine wasn't physics accurate
 
I don't necessarily need to it to be moving, so much as to just guesstimate a way to create the look of the sort of galaxy streak if you will
 
just be aware. the animation is killing cpus now
didn't in the past, oddly.
 
5:45 PM
http://nickdugger.com
just be aware. the website has won numerous awards
 
🚽
 
how do I call a the constructor of an already initiated object?
 
object.constructor
 
ah thanks
 
user8729657
Welp time to order some bird feed for the first day of school so I can throw it all over the professor parking lot.
 
5:55 PM
dark cherries are better
makes the end result more colourful
 
:) my code works
 
15 mins ago, by rlemon
user image
 
user8729657
really @rlemon
 
@rlemon You should probably be making sure that the animation frame function doesn't run 100% of the time, usually you buffer by a millisecond differential for that, somewhere between 16 and 75. The clouds look cool though, I will give that a shot later.
 
@rlemon Yeah basically how it goes.
 
5:58 PM
@TravisJ well the point of RAF is to let it run while I need animation, which is constant
raf will decide what is an appropriate timeout
 
How do I make a relatively positioned tooltip of a button not be part of the actual button (when I click on the tooltip it activates the button, which I don't want to happen)?
 
It runs very quickly, sometimes in the 250fps range. You can't expect the gpu to keep up with that, even if the render is technically available.
 
where are you seeing that? raf should lock at 60
 
If you profile it, then you can see it is rather variable.
 
I think this has changed. which might be my issue
> The number of callbacks is usually 60 times per second, but will generally match the display refresh rate in most web browsers as per W3C recommendation.
raf used to be limited, or that was the implementation
now I guess it will take your native refresh rates
 
6:01 PM
Shrug, just a thought. It could be something else as well.
The clouds do look nice though.
 
6:12 PM
hello guys I am having a hard time figuring this problem any help will be appreciated stackoverflow.com/questions/55834616/…
 
6:23 PM
idk, but waitForEl looks suspect.
appears to me that you are using setTimeout to wait for elements to hit the DOM
with a static delay
ahh nvm, I misread. you call it again
weird flow
okay, so publish_job onclick calls videomsg which calls publish_job.click
are you trying to submit a form there?
well assuming you are
$('#publish_job').prop('form').submit();
should work
 
ok let me try that real quick and i will be back with you
@rlemon your code succesfull makes the post request, but i need the name="jobupdate" so that it can trigger my functions
 
6:39 PM
so get that on the server
I assume that's what you mean. sorry your question is pretty confusing
 
358
A: How to conditionally add attributes to React components?

juandemarcoApparently, for certain attributes, React is intelligent enough to omit the attribute if the value you pass to it is not truthy. For example: var InputComponent = React.createClass({ render: function() { var required = true; var disabled = false; return ( <...

 <div active={window.localStorage.getItem('theme') === 'light'}>Light</div>
  <div active={window.localStorage.getItem('theme') === 'dark'}>Dark</div>
I am getting
Warning: Received `false` for a non-boolean attribute `active`.

If you want to write it to the DOM, pass a string instead: active="false" or active={value.toString()}.

If you used to conditionally omit it with active={condition && value}, pass active={condition ? value : undefined} instead.
 
yea and?
 
@rlemon when you make the post request $('#publish_job').prop('form').submit(); from this code it will jobupdate is being missed from the form data
 
@KiranBhattarai because it's the name. change it to the value
 
Either the answer is wrong or I am not following it correctly
window.localStorage.getItem('theme') === 'light'
 
6:43 PM
the solution is spelled out for you
> If you want to write it to the DOM, pass a string instead: active="false" or active={value.toString()}.
yes and you don't want a boolean
you want a string
like the error says
 
ok got it
Thankyou
 
If I do that then active="true" is written to dom
I don't want that
 
what do you want? the attribute omitted or not?
 
yes
 
> If you used to conditionally omit it with active={condition && value}, pass active={condition ? value : undefined} instead.
then read the next line
😉
 
6:45 PM
I don't understand that
what's the value?
 
active={ localStorage.getItem('item') === 'foo' ? 'active' : undefined }
 
there is no value
 
you need to set it to something
for React that is
just like you see people set disabled="disabled" when the property existing is enough
 
 
@rlemon oh. I see. Ok thanks. Thats dumb but ok react.
 
6:48 PM
I think it's recommended in the DOM too, just like I said a lot of people set values to them.
 
seems unnecessary especially when I select in css like .class[attribute]
not .class[attribute="attribute"]
 
that doesn't change
.class[attribute] is looking for its existance
which in this case is enough
 
I know. I am talking about consistency.
 
it is consistent
the css part anyways
@JBis okay, so react isn't stupid. your code is wrong
 
I said react was dumb, not stupid ;)
What did I do wrong?
 
6:56 PM
non-standard attributes are not going to function properly.
change active to data-active
I thought active was a standard property for some reason when I read it
because it is a css state
my bad
 
so react does't like valid html....
 
?
 
non standard attributes are valid html
 
it's not html
 
JSX → HTML
 
7:00 PM
it does create html
 
Then what does it create....
 
html
 
misread
ok so if it creates html then it should be consistent with html IMO
 
meh
 
@JBis how would it possibly know your attribute is meant to be a boolean attribute?
 
7:07 PM
Does React create HTML? Or does it construct dom objects? Not the same thing, and I'm not sure which it does
 
if (x) return version a else return version b
 
your options there are: force them to use standard attributes and data-* for non standard, or stop linting them entirely
 
I thought html5 made it possible to create custom attributes all over the place and have it remain valid
 
this isn't html5
it's jsx
 
fair enough
 
7:09 PM
also JSX doesn't just compile to html5 does it?
pretty sure it tries to comply to a bunch of standards
 
JSX is just syntactic sugar over function calls; you could make it generate JSON if you wanted
I added JSX support to my UI library that uses shadow dom, slot-based content, scoped css, etc
it never actually generates HTML
it constructs dom objects, but they never exist as HTML, other than in the dev tools
 
ok I concede. I will use data attributes
 
you could just make it a component
that spits out html with or without the attribute
 
or give the fake boolean attribute a value
like originally suggested
 
i mean... why is css using this attribute anyway?
 
7:22 PM
I did. I used data attribute with value.
 
why not apply a class?
 
because I like attributes
Why ever use attributes then?
 
attributes are only used when the html is initially parsed
 
?
 
if you're using the attribute just to style the element.. well that's why we have classes
 
7:26 PM
oh I see. data attributes should contain data.
 
they usually describe a state or have the information for a behaviour
so active could be a valid attribute, it's not the worst I've seen
 
7:51 PM
oof
 

« first day (3112 days earlier)      last day (1852 days later) »