« first day (1998 days earlier)      last day (2957 days later) » 

10:00 AM
so i kinda lied :D white lie, but well, you know
 
@Andy fine if id is actually people-9, but not a good idea by your example
 
@Andy So, a composite ID involving the type and the ID within that type?
 
@MadaraUchiha that's what i was thinking
@Neil gotcha.
 
Keep them separate
And ensure data-id is unique
 
It still smells kinda funny
@Andy what are you doing?
 
10:02 AM
If anything, wrap all under a single element with data-id
 
The "issue" is i have a basket that can have multiple types, that can also be rendered on the page. e.g. Products, Warranties or something like that. so each icon has data-id="X" data-type="Y" as a warranty and products are seperate and have their own IDs. The basket should then have an icon to "remove" the item from the basket and update the page to revert all "add to basket buttons" for this item.
 
Each child would have data-type
 
as it is, i only have 1 type ATM. But this was my design for allowing a basket like this and having the buttons on the page switchable and the like.
probably a much better way to achieve the same thing, but -- i'm "committed" to a fair amount of what i've started.
but if there's a better way to store these values and have access to them without causing additional future bugs then i'm all for it.
(happy to private, so i can show you the "actual" product in a real world setting)
 
If there is one type, would there ever potentially be a situation where you'd have two with the same id?
 
@Neil No.
not at all
 
10:05 AM
Ok, so id is unique
 
it is to a type.
 
type is a property, even if it is unique
 
i.e. warranty of "180 days" has Id of 10. Product "Samsung Television" could also have Id 10
 
Ah, ok, then the answer is yes
 
10:06 AM
the above example would "render" <a data-id=10 data-type=product>[Name]</a> <a data-id=10 data-type=warranty>[Warranry Name]</a>
that way i can find all warranties of id XYZ and conversy products too (should i need to) plus can find all products and warranties etc...
@Neil when you say the answer is "yes" does that mean my solution "aint all bad"?
 
Well you can select with both attributes, so there is no problem
 
ok, just for kicks i also added data-typeid="warranty-10"
 
@Andy no, "yes" to my question earlier
@Andy you'll regret it. .
 
...... damn ...... what would you do in this?
 
What if you want all of one type?
Keep them separate
 
10:09 AM
$('a[data-type="warranty"]);
oh i have typeid as well as the id and type.
 
@Andy There is one conceptual primary key
A set of data that you need to have in order to uniquely identify a specific item
 
@Andy well okay, but that way you're repeating yourself
 
In your case, it's the "category" or "type", and the "id" within that type
If that's all you need to 100% identify any item, that's all you should ever need to supply.
 
@MadaraUchiha so would my typeid be a better "id" field then?
 
True, so you could put items with same type under same container
 
10:11 AM
@Neil repeating? So, this solution isnt ideal, how else would you do this? (probably with some new stuff i've never heard of) but worth asking
 
@Andy if I understand @MadaraUchiha correctly, you should put elements of the same type under a container
 
It doesn't really matter, conceptually.
 
So while data-id repeats, you can check it's parent to know what type it is
 
If his key is composite, then both guid="type-nn" or type="type" id="nn" are fine,
 
ah well ... that wouldnt work for me i dont think. as my search results pull out multiple types all in one container. i guess i could seperate them out. Maybe i could use a classname to differentiate them, but then i'm back to having a multiple selector and might as well keep in the tag.
 
10:13 AM
Personally, I'd go with the latter
But I still think there's a design smell here, bigger than the specific problem
 
@MadaraUchiha you're bang on there i reckon
 
Question of the year....
0
Q: Multiple table grid with dynamic tables and columns

MathematicsLet say I have 2 tables initially, Categories Products Categories table will have a column "No of products" which will show number of products specific category has... Now Products Table is grouped by CategoryId, so when user clicks on number of products in Categories table, he will see Produ...

 
You should be able to do everything using two separate attributes data-id and data-type
 
Im MVP;ing something and smashing it out. there will be some issues that i've added in and ones that i cant foresee. But the aim is to get the product working --- not nec in the best way -- asap and then pay for someoen to fix anything i've fucked up :D
@Neil brill :D
 
If you're stuck ask
 
10:15 AM
@Neil Thanks
@AwalGarg I agree. will improve on that.
 
But at least as far as that goes, you should have no conceptual problems
 
@Neil just did :)
 
@Neil i'm asking when i need to and you've all been really helpful.
 
@Mr_Green ping us with an updated link when you are done!
 
@Mathematics I need a break ;)
@Andy np
 
10:17 AM
sure
 
@MadaraUchiha thanks to you too.
 
@Neil see you after break then :P
 
@Mathematics I don't know if what you're after is possible without the use of the server
 
crl
10:50 AM
isn't there a native function for max(0, number)?
 
Math.max?
 
crl
yes
 
@crl I don't think I understand the question
 
@Neil Thanks for the input, that's what I thought as well
 
crl
I thought there would be a math function that did that, but thought wrong
 
10:54 AM
@crl Math.max exists
I had to second guess myself, but it exists
 
11:07 AM
WTF JS - codepen.io/darkyen/pen/yOPMZg?editors=0010 [It might take ~ 4 seconds to finish]
Do I not even deserve maybe an Error ?
Clearly the runtime fucked up!
 
@Devilion Welcome to the JavaScript chat! Please review the room rules. Pleasedon'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.
1 message moved to Trash can
@Devilion Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com or pastie.org
 
..
 
i need to put this fuction in button to call it the time i want
http://pastie.org/10786082
some help plz?
 
"plz"? C'mon, we deserve more.
@Devilion .addEventListener
 
user3119231
!!urban plz
 
11:20 AM
@Maurice plz Another way of saying the word 'please'.
 
!!urban plz 1
 
@JanDvorak pls Short for "please", used in email by lazy asshats who put the minimum possible effort into being polite. Usually used in messges demanding something that's trivial for them but a PITA for you.
 
@CapricaSix thanks :)
 
user3119231
"<psypher> fu
<boburt> fu2
<psypher> plz die
<boburt> ok "
 
@JanDvorak [plz](http://plz.urbanup.com/19205) A short word for please.

History:

Please
ples
pls
plz

Iph J00 w4N+ +O B3 a 1337 h4XOr WhO RUlE Cs u53 PLz, @Nd +ry +o u$3 Z 1N a5 maNY W0RDZZz 4ZZ u c@N
 
user3119231
11:22 AM
damn my eyes...
 
@Maurice be smart
 
user3119231
wat
 
Taken out of context, it is a good idea.
 
@JanDvorak can you explain more about eventlistner?
 
11:25 AM
shouldn't I get an error in that execution ?
 
user3119231
@Abhishrek Infinite loop found on line 0. The line number is approximated so look carefully.
 
@Maurice What browser gave you that error ?
I get this in chrome
 
user3119231
Firefox
 
1550125801.7232623
console_runner-ba402f0….js:1 1550125801.7232623 3100883
console_runner-ba402f0….js:1 foo: 4203.653ms
Firefox dev edition does osmething similar with 5 million elements in the array
 
> foo: 1202.375ms
 
11:28 AM
@littlepootis damn fast PC!
 
user3119231
foo: timer started
2412117655.934426
2412117655.934426 4825298
foo: 4546.69ms
 
@Maurice @littlepootis but do you see ? the latter should be double the former
Either JS is skipping the second for loop completely (silently) also I added 114 Million elements, I deserve a warning saying : Dude I will just pop the rest out ?
 
how to debug a game script(big script) .both firefox and chrome stuck
 
user3119231
Let me have a look
 
@Abhishrek I'm thinking rounding errors, but I feel like it's too early for them.
 
11:31 AM
@AwalGarg Definitely.
 
@AwalGarg @SomeGuy that reminds me you might lose marks if you write good C / C++ in uni exams
 
Perhaps a slow console? But I can't see how that could happen with primitive values.
 
(Make sure of that) .. I did
 
I already did
 
@JanDvorak The array itself doesn't have 114 million elements
 
11:32 AM
Same thing happened for Java
Apparently your score is directly proportional to how unreadable your code is
 
The worse is they don't even mention which version of language you have to follow
@SomeGuy Wish you have js (:

Cause then we can give them some ugly as shit :D
 
OK, that's weird
 
@Abhishrek I do have JS
 
@JanDvorak Better yet it is cross browser :D
Edge, Firefox, Chrome all do the same!
 
Is the array size stable?
 
11:35 AM
I have no clue vOv
 
Also, what's the array size before the second loop?
 
Yeah its the same as before it
 
user5992646
@CapricaSix Hello and Bye
 
updated the pen
 
@Todo what?
 
11:38 AM
@Abhishrek SO main time?
 
user5992646
@CapricaSix Just passing by.
 
@JanDvorak What should I ask ?
 
@Abhishrek is this that 114million thing?
 
Why it doesn't behave as expected
 
@AwalGarg Yes!
I deserve either a sane error, or warning or the spec should say that arrays in js are just fifo caches
 
11:39 AM
you deserve some sleep
 
That, too
 
user3119231
@Abhishrek I can't figure it out
 
@AwalGarg I have had enough :P
 
user3119231
 
typescript anyone?
 
11:49 AM
@Maurice I know that :P
 
user5992646
@deostroll you must not ask like that. simply post your question. read chatroom rules.
 
I am wondering why browsers choose to be jQuery about this ?
I think we bashed jquery for silent errors
0
Q: Strange JavaScript behavior with humongous arrays

AbhishrekThe following code performs a silent logical error. const arr = []; class Point{ constructor(){ this.x = Math.random() * 1000000; this.y = Math.random() * 1000000; } } console.time('foo'); let avg = 0; for(let i = 0; i < 114000000; i++ ){ arr.push(new Point()); avg += arr[i].x /...

 
sorry...had to ask...its not implicit in the rules...
 
12:08 PM
@Abhishrek my computer acts strangely if I pour grape soda on the CPU, but I don't do it. ;)
 
@Abhishrek Doesn't codepen kill the script if it detects a long running script?
My chrome crashes as it probably should
 
user3119231
@Abhishrek interesting.
 
user3119231
@Abhishrek maybe it is because you insert large number so often that the browser cancels the second loop (browser security)
 
@Maurice It won't run the first loop and that will cause rainbow errors all the time
even then browser should throw
Looping too long are we ? Error
@BenFortune If codepen kills it you won't get the console.log
 
user3119231
this is very strange, isn't it?
 
12:19 PM
Double rainbow, whoa
 
@Maurice wtf!!!! It does kill it at 2.67M
 
Magic number?
 
hi
 
Try 256M
 
user3119231
so the second loop starts? (sorry, I'm in office)
 
12:22 PM
@Neil no I think codepen
lemme try to port it to jsfiddle
 
How can they do that?
I didn't even think that was possible without webworkers
 
@BenFortune yeah found it. let me get it to node / chrome
 
It breaks the loop, meaning execution will continue
 
user3119231
so I was right. It's up to "security" :P
 
12:24 PM
To be fair, jsfiddle may run it quickly, so if it works at 267M , you should increase
 
@Maurice no codepen is killing it
 
Assuming that it is codepen
 
user3119231
doesn't matter if codepen or browser. It's a security thing. And it makes sense.
 
@Abhishrek cannot reproduce. I ran it in node and it just crashed.
 
@AwalGarg should have done it :P removing the questiong :D
 
12:26 PM
@Maurice I doubt that it is a security thing. Chrome already has a way to deal with slow pages
 
This is helpful FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
 
user3119231
can agree with this ^
 
And codepen shouldn't care about security
 
47 mins ago, by Awal Garg
you deserve some sleep
 
@AwalGarg lol
In that scenario everyone who upvoted it except for @BenFortune @vp_arth deserve a sleep ;-)
 
12:28 PM
Maybe codepen has to have a safeguard for preventing the program that tests pen performance to continue infinitely
Halting problem and that jazz
 
@Neil It does window.CP.shouldStopExection
 
@Abhishrek how does it feel to lose all the rep you got so quickly? :P
 
gfycat.com/CalculatingFaintIberianbarbel @KendallFrey some people are way too good at this game
 
@AwalGarg don't really care :P
Am more surprized about how well codepen sandboxes
 
@Abhishrek Sandboxing is relatively easy with iframes
 
12:30 PM
also you need sleep aswell (Alloc/Delloc) that entire talk
 
@Abhishrek is that a browser specific thing? I have never heard of it before
 
@Neil nope codepen
 
@Abhishrek jsbin does that too.
 
most likely they are timing the time the loop has spent
@MadaraUchiha can you purge the question ?
 
@Abhishrek "the question"?
 
12:32 PM
15
Q: Strange JavaScript behavior with humongous arrays

AbhishrekThe following code performs a silent logical error. const arr = []; class Point{ constructor(){ this.x = Math.random() * 1000000; this.y = Math.random() * 1000000; } } console.time('foo'); let avg = 0; for(let i = 0; i < 114000000; i++ ){ arr.push(new Point()); avg += arr[i].x /...

Totally misleading :P
 
@Abhishrek ok, then it is doing something
 
@Abhishrek I hadn't tested what you said that time :P Just trusted you. I wouldn't do that next time :P
 
@AwalGarg I linked you the codepen :P
also you tested on ffox (x
 
@Abhishrek I'd edit the title so that it reflects the question better
 
basically all of us over engineered the problem xD
 
12:33 PM
But it's a perfectly valid question with a perfectly valid answer
 
@MadaraUchiha oook
 
user3119231
btw I tested on firefox, just saying. :D
 
@Abhishrek speak for yourself, nerd
 
@Abhishrek no, I tested on the spidermonkey jsshell where it ran in 4s. It still runs fine on it in about the same time :)
 
lol
@AwalGarg and didn't crash ?
dafuk
 
12:34 PM
nope
 
@AwalGarg x64 ?
 
it crashes only in node. I am guessing d8 won't crash either
@Abhishrek yes
 
Oh okay then.
 
@AwalGarg I am going to go out on a limb here and say that I am not surprised
 
I still haven't tested in chrome. I am guessing it crashes there too. And probably in FF as well. I don't trust browser environments for such delicate tests.
 
12:35 PM
@AwalGarg I do trust browsers now, but don't trust codepen :D
cause codepen ate the error :P which it should have thrown or atleast wanred ?
 
your standards are just low
 
@AwalGarg just like your mom :D
<replace with kendall's mom if you got offended>
 
user3119231
isn't kendall the wat image?
 
Is there a story behind wat lady?
 
12:38 PM
@Abhishrek 5th standard kids' jokes don't offend me :P
 
@AwalGarg I know -_- that was to subtly insert a joke about kendall
 
woosh
 
@Maurice so we don't really know
 
user3119231
at least: no
 
@Abhishrek +17 :O?
 
12:41 PM
Looks a bit like god warrior
 
@BenjaminGruenbaum Apparently 18 people didn't even consider
codepen sandboxing.
 
Wow was she crazy
 
now tweeting codepen to make that stopExecution thing throw
 
@Abhishrek what are you trying to do?
 
@Neil simulate a nebula
fps doesn't matter
 
12:44 PM
@Abhishrek sweet
 
But I will have to recede to 100k particles in browser which is sad :-(
 
I mean, nerd
 
or try and test it on webgl
 
@Abhishrek At the very least, console.warn()
 
yep
Silent errors are bad.
 
12:45 PM
Python might be a better fit here
 
Silent stopping executions are insanely bad.
@Neil I was thinking more along the lines of Java on x64 (JK)
 
Well joking or not, it would be faster
 
Ofcourse.
@CodePen Please add console.warn to your infinite loop breaking script. It causes embarrasment http://stackoverflow.com/q/36425678/855760 Silent errors are bad
But am definitely getting some sleep before doing that @Neil (:
also I might go with WebGL over python or java
(I have 0 idea how would I make this pretty in Java)
 
user3119231
I have to force myself to get into java for android development
 
@Abhishrek well if you go with Java and need a hand, let me know
 
12:49 PM
@Maurice React Native not good enough for you || making a game ?
@Neil Anything like vanilla canvas in java ?
(Has to be that clean)
 
user3119231
@Abhishrek no, need to create a fully functional app which is retrieving gps data in an interval and send it to server & notifications which can be send by server.
 
@Maurice you can do that with cordova iirc
using chrome.apps.* background something
 
user3119231
I see the problem with the background service. It must run 24/7. No matter is phone is restarted or something. AND I don't need a frontend (activity).
 
@Abhishrek honestly, I don't know. Despite my experience, never had to do something graphical other than swing
I will check though
 
@Maurice just a sec
 
12:53 PM
ST3 SCSS plugin doesn't like flex properties
 
@rlemon Hey, I made a plane like that in FSX
 
I suppose java.awt.Graphics is fairly similar to canvas conceptually
 
@Abhishrek added answer with actual code
 
@BenjaminGruenbaum I see it.
 
Would be nice if there were library support
LWJGL uses opengl in java
 
user3119231
12:55 PM
@BenjaminGruenbaum +1 very good answer with description, docs, example, code
 
Might be worth looking into
 
@Maurice Thank you.
 
If I return a Promise to then, will it work as I want, or just make a promise that resolves to another promise?
 
@BenjaminGruenbaum I marked it as accepted, thanks :-)
@KendallFrey you mean fetch("/foo/bar").then(k => fetch(k));
 
yeah
like monads are supposed to be
 
12:58 PM
s/m/g/
 
monads > gonads any day
 
user3119231
for what is the "upvote comment button"?
 
upvoting comments
 
user3119231
U don't say. I mean, is this useful?
 
12:59 PM
!!> "monads" > "gonads"
 
@MadaraUchiha true
 
hey guys!
 
@MadaraUchiha clever.
 

« first day (1998 days earlier)      last day (2957 days later) »