« first day (1652 days earlier)      last day (3303 days later) » 

12:07 AM
@BenjaminGruenbaum Hey. Didn't mean to ignore your message. The one-month-old question is asking about the way weakness is defined in JavaScript, from the perspective of someone who knows what a map is. The three-year-old question was asking what WeakMaps were from the perspective of someone who doesn't even know what a map is -- as evidenced by the fact that they accepted an answer that only explains that part.
 
@JeremyBanks BenjaminGruenbaum is afk: beer
 
I'm not thrilled with this situation because, as you say, the older question and answer are not particularly good. But someone flagged it as an inaccurate duping, and I do agree with that. If the newest question were broadened a little, it would be a more suitable dupe target.
 
@copy do you write the type annotations in ocaml?
I mean, they're optional. But in haskell, it's good practice to write them anyway, was wondering if it's the same in ocaml
 
@FlorianMargaine No
 
12:13 AM
@JeremyBanks also, congrats 'n stuff
 
@Zirak awesome
 
@BenjaminGruenbaum Zirak is afk: dead
 
@JeremyBanks but the old question is poor, the answer is incorrect and no involved party is active anyone. That is - they'll never be fixed.
 
user2490157
does anyone know how to inject javascript into an iframe, as you would inject using console?
 
@BenjaminGruenbaum need to you sign off on this: gist.github.com/SomeKittens/49222d46c0b3e1002fe8
@DaemonOfTheWest There's some pretty serious security blocks on iframes, what exactly are you trying to do?
 
12:28 AM
@BenjaminGruenbaum That is good to know -- I didn't realize Raynos was no longer active. However, I'm still not going to close it as a dupe at this point. The newer question and answer don't address the only point that the old question and answer did address: WeakMaps (and Maps) can use Objects as keys, while traditional Objects-as-dictionaries could not. Rather, your answer takes it as a given that one already understands this: "Naively one would think to use a Map".
If the question and answer could reasonably be edited to encompass this, then I would reconsider. Your answer is excellent, and it does deserve more attention than the old one.
@SomeKittens Thank you. :)
 
Were you the one that promised to be around in the chats more?
 
I don't think so.
But since I need to have the mod chats open anyway, I probably will be.
 
meager (I hope that is right) did
 
^
 
1:09 AM
@JeremyBanks but this question is about weak maps and not maps anyway, they're completely different. One is about memory allocation and ownership and the other is just keys-values. The answer is completely irrelevant...
Key value storage or otherwise the storage type isn't what weak collections about about
Using a WeakMap for that would be pointless... and slow.
 
 
2 hours later…
user2490157
2:47 AM
@SomeKittens I'm injecting it from the same domain to the same domain, and I just want to inject a few functions and lines of code.
 
4:20 AM
Why undefined?
 
variable declarations using var don't have a return value
Assignment without var in the statement will return a value though: var foo; foo = parseInt("34", 10);
!!> var foo; foo = parseInt("34", 10);
 
@nderscore 34
 
!!> var foo = parseInt("34", 10); console.log(foo)
 
@bjb568 "undefined" Logged: 34
 
 
1 hour later…
5:28 AM
hey guys !
i have a really random question !
i am a newbie JS programmer
i mostly delve in Jquery .. just learning basic stuff ..
I just wanted to ask
is it necessary to memorize all Web API functions of JS ??
i know doing so can one highly productive
but i ocassionally learn new functions and then after a couple of weeks i just forget .. and then when i need to use the function again , i probably am always referring back to MDN !
but once i get used to using a perticular function .. like say i use it 2-3 times , i have it fit in my memory ..
 
memorize? I don't remember what it means being programmer. You just know that tehre is something that can help you, but with a learning curve of 2 frameworks to learn by year...
Is useless memorize functions/methods/grammar
 
so my questions is .. is it like nessary to have everything in your mind or is IT OK to refer to the Doc's .. i mean as a pro programmer ?
 
I was a PHP guru 5 years ago and I just stop using it. I can't remember how to make a hello world.
 
Leandro Thanks for ur opinion .. :)
LOL .. trying to learn PHP myself
 
you can't have it :D Don't try :D
I mean, don't try to remember it
 
5:34 AM
well its bad to drop smthing entirely !
WHY ??????
i mean if u call urself a guru !
 
I love PHP, but in my company are using MS :(
 
than obviously u gotta know what featch_assoc does right ?
 
well, I'm pretty sure I'm not a guru because I can't remember anything ajajja
 
Hmmmm LOL ok !
 
I'm working with C# now :( If you learn C++, everything is related
 
5:37 AM
Don't even go there !
 
any language related to C++, you can learn PHP to learn it
 
i will just stick to JS .. and maybe a little PHP for backend !
i just like debugging basic JS plugins to see how JS works !
something like the above !
 
6:12 AM
oh dear…stackoverflow.com/review/low-quality-posts/7827230 I'm pretty sure this is an audit, but if I take the correct action (aka flagging), I'm going to fail it
stackoverflow.com/questions/29361502/… should be nuked from orbit
 
@royhowie here, defused that for you
 
@JanDvorak so it was okay to vote to close?
okay, bueno
 
@royhowie ...FIVE UPVOTES?!?
 
@SomeKittens six… I don't even understand
 
When in doubt, visit the question and vote from there
 
6:16 AM
@JanDvorak that's what I do
I skipped the audit
I've had enough of these cases
I almost feel like this is a case of voting fraud or something
 
so I was playing GTAV and this happened..
dude on the server was hacking. Became a monkey and was invincible.. we became friends
 
6:35 AM
what's the appropriate flag for "write teh codez 4 me" questions?
 
@royhowie not really a flag, but a close vote
 
6:59 AM
@Loktar don't have 3k rep yet…
 
ah guess I forgot you even need that to close vote.
 
7:17 AM
Am I missing something here ?
-1
Q: Is there a tool that automatically strips CSS from media queries?

Phoenix C. EneroIs there any tool to strip out CSS from media queries and perhaps output them separately? That way, it is easier to create several different stylesheets for different media queries. Also can be used for mobile-first CSS to strip desktop styles for earlier browsers such as IE8 (which is what I'm ...

 
Depends. Are you out of close votes?
 
no but the question is : is there such tool and what's the point ? As I'm not sure, I didn't vote yet
 
I can't see the point either
but it's definitely asking for a tool, even if such a tool doesn't exist
It's definitely downworthy as well. Lack of reseach if you will.
Clarified. Impossible.
@dystroy cv-pls
 
Sorry, was afk, but I see it's closed now
 
@dystroy nvm. Closed.
 
7:27 AM
This user is doing many incorrect and useless edits : stackoverflow.com/users/2527001/…
 
I've randomly decided that I really like the copy() console command in chrome
puts argument on clipboard, awesome
 
I haven't had a use for it ever since I've learned about it
 
I'm working with the stackoverflow API and I didn't want to exhaust my quota, so I did one call, copy()ed the response and pasted it into the editor as a data mock. To be honest though, it's the first time I've ever used it
Desperately trying to think of any real life usecase now
 
@ivarni I didn't know that. I don't know if I'll use it but thanks anyway
 
If you have a huge object you're manipulating and you'd like to copy that without dumping that into the window?
 
7:41 AM
yes, that could be handy. Of course there's always another solution but if you remember it, it may be more convenient
 
8:41 AM
copy(JSON.stringify($_)) is a treasure
 
I knew the first one, I think Ben told me about it
@Zirak Do you really need the JSON ? When you paste in an editor, isn't it as JSON anyway ?
 
@Zirak Hahaha I've seen you send those links here so many times!
 
It's a crotch from the time where it wasn't so and copy(obj) gave you [object Object]
 
Why don't people read those links, they're so useful ;-;
 
8:44 AM
I don't like assertions out of test units
 
inspect is also an extremely useful function.
 
!!afk LAN
 
Javascript mem model. Can somebody help me answer this? programmers.stackexchange.com/questions/280131/…
pythontutor.com visualises javascript program similar to python program
Does java script memory model also look like dictionaries of dictionaries?
 
Javascript doesn't have dictionaries
 
8:56 AM
And I don't think the spec says anything about how data is stored
That's going to be implementation specific
 
If spec does not say anything about how data is stored, then how does pythontutor.com try depicting these diagrams?
 
It uses v8
They have the source on github
Read it
 
read the source? I can't. am javascript beginner(1 week old). documentation would be better.
 
Good news, it's c++ so you don't need to know javascript
 
I don't know C++.
 
9:03 AM
It's not important how it's stored, just how it behaves
 
I just scanned through a code and it just looks like a hashmap
But it's 5 am and I'm not going to actually read it
 
Why coders don't sleep properly? I heard lot of them code in night time.
 
Javascript objects act sorta like hashmaps, but if you use them in a specific very common manner, V8 is able to store and access them more efficiently than with a hash map. The point is that it won't affect the behavior meaning you don't have to worry
 
Idk I wasn't staying up late to code
I was just playing gta for like 3 hours
 
9:11 AM
@MadaraUchiha Made a PR for you, feedback welcome. github.com/JavaScriptRoom/JavaScriptRoom.github.io/pull/1 I'm tempted to steal the CSS from the PHP room or include SO's own CSS. I can't style things to save my life.
@overexchange Sometimes you don't really notice that time is passing if you're coding and in a good flow
 
When boss asks me to complete any work by particular time, I say, this is the pace with which I can work, If you don't like it, send me termination email. He shuts his mouth.
@Meredith so every hashmap is a name-value binding? where name is reverse_string(say) and value is an object which is a function object(sitting in heap)?
 
Idk read the source
 
It's implementation specific, the above is how v8 (chrome's js engine) does it. A bit outdated, but still largely correct.
@Meredith That's if the object gets deoptimised
 
9:28 AM
Can't I define a function on console?
function foo(){
VM68:3 Uncaught SyntaxError: Unexpected end of inputInjectedScript._evaluateOn @ VM39:883InjectedScript._evaluateAndWrap @ VM39:816InjectedScript.evaluate @ VM39:682
function foo() {
VM97:3 Uncaught SyntaxError: Unexpected end of inputInjectedScript._evaluateOn @ VM39:883InjectedScript._evaluateAndWrap @ VM39:816InjectedScript.evaluate @ VM39:682
 
Use shift+enter
 
10:20 AM
In python, we something called closure which is part of function object that stores the name value bindings of outer names of a current function.
In javascript, Do we have similar concept? Do we have closure property of function object pointed by name innerFunc?
function outerFunc(param){
   var outerVar = "Outer value";
   function innerFunc(){
      var innerVar = "Inner value";
      alert(innerVar);
      alert(outerVar);
      alert(param);
    }
	innerFunc();
}

outerFunc(2);
I mean, how does scope of innerFunc know that outerVarand param are outside innerFunc?
 
Google "javascript closure"
 
@overexchange JS doesn't have the __closure__ attribute if that's what you're talking about
 
oh ok
yes am talking about __closure__ attribute. then how does innerFunc maintain the value of outer scope?
 
It's handled internally
 
10:35 AM
Python kinda bolted this feature on top of existing stuff. JavaScript had closures since day 1
 
But w3 says: A closure is a function having access to the parent scope, even after the parent function has closed.
var add = (function () {
    var counter = 0;
    return function () {return counter += 1;}
})();

add();
add();
add();

// the counter is now 3
 
12 mins ago, by Zirak
Google "javascript closure"
 
@Zirak yes I did that.
 
Read more
 
If see this answer, it is the same concept followed in python. stackoverflow.com/a/111200/3317808
key statement in this answer: since "tmp" is still hanging around inside "bar'"s closure
@Zirak it is the same concept in javascript, but my question is, I would like to see, how innerFunc maintains outerscope values, like in python, it is like this...
>>> def outerFunc(param):
	outerVar = 'This is outer var'
	def innerFunc():
		print(outerVar)
		print(param)
	return innerFunc

>>> bar = outerFunc(2)
>>> bar.__closure__
(<cell at 0x000000000391DF78: str object at 0x00000000039F7E40>, <cell at 0x00000000029B0A08: int object at 0x000000006310A470>)
>>>
 
10:54 AM
__closure__ is an internal value, which for some reason was exposed. It could just as easily not have been exposed.
Python's variable lookup isn't implemented on top of python.
 
Sorry, I don't understand this point: Python's variable lookup isn't implemented on top of python But you mean javascript also has similar concept but closure attribute is not visible as shown below... Is that what you are syaing?
 
It's not exposed to javascript.
You can see it, however: console.dir(bar)
Check the <function scope> thingy
 
am actually amidst scope chapter now
oh ok
I see that
 
user2620028
 
Are these all attributes of function object?
 
11:06 AM
@overexchange: have you tried accessing them?
 
Hey guys!
 
yes, all are name-value bindings, if I drill down.
in which I see parseInt:functionobject that is globally available, which I was using
 
hey guys !
 
What's the difference between:

function objectCreator() {
    this.functionName = function() {console.log("Test")}
}

and

objectCreator.prototype.functionName = function() {console.log("Test")}
 
The latter is more efficient !
 
11:16 AM
is there any difference beside that?
 
not a JS expert but u'll see such kind of code alot
in js espically because in JS there is no "classical inheritance" !
and in JS prototype facilitates inheritance.
 
awesome, thank you
 
adam koury explains the basics here youtube.com/watch?v=EBoUT2eBlT4
once you understand the basics
try surfing github , for whatever projects interest you , even if its a small JS plugin .
and u'll see alot of code that goes something like
+function ($) {
'use strict';

// DROPDOWN CLASS DEFINITION
// =========================

var Dropdown = function (element) {

}

Dropdown.VERSION = '3.3.4'

Dropdown.prototype.toggle = function (e) {


}

Dropdown.prototype.keydown = function (e) {

}




// DROPDOWN PLUGIN DEFINITION
// ==========================

function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.dropdown')

if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
 
AH, that makes sense
 
11:23 AM
@AlexanderSolonik After doing lot of R&D, I found that videos from adam khoury are the best!!!
 
Yups ! he has a nice teaching style , also with a good emphasis on practicality !
 
yes, OOP paradigm has been taught vry welll
starting his second video.
@Zirak I did not like this article jayconrod.com/posts/52/a-tour-of-v8-object-representation am not getting the overall picture, like in python..
 
I actually had a question for any pro on here !
 
0
Q: "Python interpreter vs Javascript engine" memory model

overexchangeI learnt that memory model of python interpreter is dictionaries of dictionaries, where each module is a dictionary. Let me elaborate more on this with an example, After i run >>> python hog.py(say), all name-value bindings written in hog.py file are part of __main__ module. name is part of cur...

 
has anybody used $.event.special.bsTransitionEnd I.E the special events ?
 
11:28 AM
Very not tech related but we're sending these guys to Iraq with diplomatic immunity now to work the the Peshmerga. It's not a going to be a good time to be an IS fighter. Chant is "You're the predators, Taliban is now prey. To Valhalla!" from a few years back in Afghanistan.
 
i really want to know whats so espical about this special event .
 
I know the history of afgha since 1979 - 1989 war against Russia.
the problem is there is communica gap between what afghani wants and what foreign allies are trying to do.
This confusion was actually created by president of USA in 1970's, who projected afghani fighters as scape goats towards russians
anyways.. JS is cool, let me go back there
@AlexanderSolonik But before going to videos by adam khoury, one has to have basics of javascript!!
 
11:50 AM
If I have two co-ordinates `(player.x,player.y) (mouse.x,mouse.y)`
and I want to animate a projectile from the first co-ordinate in the direction of the second co-ordinate, given a `speed`, how would I find the amount that I need to increment the projectile's x and y co-ordinates per frame?
 
@Deep what's the unit of this speed variable?
 
Its an arbitrary unit. 5 is faster than 4, but by how much I don't know.
 
In this case , bar is still mainitaining 2 name-value pairs under closure, unlike python.
function outerFunc(param){
   var outerVar = "This is an outer var";
   function innerFunc(){
         outerVar = outerVar + "This is not an outer var";
         alert(outerVar);
         alert(param);
   }
   return innerFunc;
}

undefined
bar = outerFunc(2)
function innerFunc(){
         outerVar = outerVar + "This is not an outer var";
         alert(outerVar);
         alert(param);
   }
where as in python, it is ..
>>> def outerFunc(param):
	outerVar = 'This is outer var'
	def innerFunc():
		outerVar = "This is not Outer var"
		print(outerVar)
		print(param)
	return innerFunc

>>> bar = outerFunc(2)
>>> bar()
This is not Outer var
2
>>> bar.__closure__
(<cell at 0x00000000039E93A8: int object at 0x000000006310A470>,)
>>>
Is this difference, because of that var keyword in JS? ?
 
Err the two codes are not equivalent
 
you can just replace outerVar = outerVar + "This is not an outer var"; with outerVar = "This is not an outer var"; to make it identical. But that is not the key impact.
 
11:59 AM
but your test is still broken
 
you mean I need to write it as var outerVar = "This is not an outer var"; witin innerFunc?
 
No, in the first case you're editing the outer variable, so you're not really testing anything
 
I t doesn't have to have "speed" factored in, if that helps.
I have the delta x and the delta y, but then what?
 
in second case(python) also, we are editing outerVar
 
do I increment the x by one, and then increment y by delta y divided by delta x?
 
12:07 PM
thanks guys!! a Demain
 
@Deep: ah wait, this isn't actually that easy
 
I have updated the github repo for my question stackoverflow.com/questions/29858790/…
 
@Zirak whom are you referring to?
 
How would it be done, then @Qantas94Heavy ?
 
Because if the target moves does the time reset or what?
 
12:19 PM
it's a bullet, so I don't think so.
the projectile would just miss
 
12:35 PM
@AwalGarg hrm? Where I was referring to someone?
@overexchange The difference is that python's scoping and closure systems are broken, and that python doesn't distinguish between variable initialisation and assignment. To make them identical, you need to declare local outerVar in the inner function.
erm sorry, nonlocal
 
12:49 PM
@Zirak in the issues list. You said you can guess who the two people are.
 
If needs be I'll mention them in the meeting, but you can take a wild guess.
 
cool :)
 
@AwalGarg About what?
 
@ivarni I made a few comments
 
user2904529
Can any one help me create a dynamic listview with JSON API Data? Thanks
 
1:01 PM
@user2904529 Welcome to the JavaScript chat! Please review the room pseudo-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.
 
@BenjaminGruenbaum gist.github.com/Zirak/59e40d3a09613f4ac4ff Good enough for a PR?
 
nice, plunker has a template for angular 2.0.0 alpha with systemjs and ES6
 
@Zirak it's always good enough for a PR, make a PR and fix it as you go - the point is that you get feedback.
I'd probably use auto a lot more (and not explicit types) and other stylistic stuff, but it's much better to get feedback from someone who can merge
 
hrm, they don't seem to have tests for InjectedScriptHost...
@BenjaminGruenbaum So would I, but I followed the file's conventions
 
1:06 PM
You wouldn't catch me dead omitting braces :P
 
@BenjaminGruenbaum maybe we can consider using angular 2.0? how far is it from semi-stable
for the mobile project that is
 
@Mosho it's not stable at all.
It's at a prototype phase
 
I know
 
I'm not sure you do, I'll show you what the internal discussions look like - hint: it's not really pretty :D
 
any persons here with experience in images and seam carving ?
 
1:08 PM
Also, why use Angular 2.0? If we're gonna use a different framework, it makes more sense to use the next hype, like using React all the way (with flux architecture and the react router)
 
is it really different after all
 
Yes, it's super different
 
@BenjaminGruenbaum Hipster. You probably go to React conventions and eat pancakes all the time.
 
Look at the 'getting started' it's a completely different framework (2.0) and it keeps changing, it's good for PoCs
@Zirak work on your PR, you're keeping Paul waiting :D
<3
 
17 hours ago, by Zirak
@BenjaminGruenbaum I will murder you until you're dead
This part's under webkit's v8 binding though. I'm not sure where I should open the bug and stuff.
 
1:11 PM
chromium
 
meh I'll see if anyone's on #chrome-devtools
 
@MadaraUchiha Great, I'm learning stuff about XMLHttpRequest now. I'll try to update the pull request today but I'm currently debating if I should go to the pub or stay in my cave so it might be tomorrow
 
@BenjaminGruenbaum alrighty
 
I have a weird error - adding two floats results in NaN.
 
1:13 PM
wanna try something new :X
 
@Mosho by all means do play with it though
 
and preferably exciting
 
@Deep one of those floats is NaN
 
@Deep snippet ?
 
Snippet coming up, 1 sec
 
1:13 PM
@Mosho must... avoid... sex... joke
 
by all means :P
 
:( spilled a drink on my keyboard and floor last night
now both are sticky.
 
By saying that, you can say other's mind to think at a sex joke
 
time to buy a new floor
 
@rlemon "spilled a drink"
 
1:14 PM
projectiles[m].x += projectiles[m].xInterval;
projectiles[m].y += projectiles[m].yInterval;

function projectile(x,y,targetX,targetY,speed) {
    this.x = x;
    this.y = y;
    this.targetX = targetX;
    this.targetY = targetY;
    this.xIncrement = targetX / x;
    this.yIncrement = targetY / y;
}
 
@rlemon dude that's not a 'drink' that's fucking disgusting
:D
Also, mornin
 
what a waste of beer tho
:(
 
when I construct the new object, the new values for X and Y are ints, like they should be, but then they go to NaN in the next frame
 
@Deep that's shocking :( Are you going to be ok?
 
What?
 
1:16 PM
@Deep the floats, being NaN on the next frame, it must not be easy. Did you talk to anyone else about it?
 
/me doesnt get the joke
 
you are the joke brah
 
I'm POSTing from a form in NodeJS and getting
POST localhost:3000/register net::ERR_CONNECTION_RESET
 
@Deep you have to put ! infront of them.
not NotANumber
then it will work
 
@StevensHaen That's a problem. You should investigate it some more.
 
1:18 PM
You guys are trolling, right?
OMG
WOW
IM AN IDIOT
facepalms
 
finally the spot started to get some electricity ?
 
Well thats embarrassing.
 
that can happen with everyone
 
Cant Believe I missed it.
 
I Can't Believe It Is Not Butterâ„¢
 
user2904529
1:25 PM
Can any one help me create a dynamic listview with JSON API Data? Thanks
 
@user2904529 are you talking about a react native listview?
 
user2904529
@BenjaminGruenbaum a native JQuery Mobile Listview yes.
 
@rlemon He's coming right for us!
 
i don't understand SomeKitten's starred jsFiddle input
(i mean the message behind that)
 
1:34 PM
posted on April 25, 2015 by Victor A. Rodriguez

Hoy me encontré con BajaLibros.com, me registré y esto fue lo que encontré después de unos 30 minutos de interactuar con la aplicación Android. Lo positivo es que en precios da un saldo positivo pero en cuanto a la oferta y la aplicación hay que trabajarla bastante más en lo relacionado a la usabilidad.   La aplicación es lenta (aproximadamente 2 segundos de tiempo de respuesta promedi

 
That's not tdjs
 
THE
I want to build some application but have -100 ideas
 
make an idea generator
 
THE
Lol, thought about that, there are few there but this is the last thing any developer would like to work on
 
@BenjaminGruenbaum I WIN !!!!
 
THE
1:42 PM
i am more interested in enterprise, medical or academic or scientific type app
 
well #3, but by not being a fanboy
I GOT MS VENTURES !
 
THE
!! google imagine cup winners 2014
 
15* India
 
1:44 PM
@darkyen00 :D
 
@darkyen00 Congrats!
What does it mean?
 
@Zirak I CAN HAZ MY STARTUP
 
THE
@darkyen00 and what is that ?
 
Oh just wait wait wait
 
How can I get my bullets to fire at the same speed regardless of angle? chillibyte.github.io/GameDev
this.xIncrement = this.deltaX / this.deltaX;
this.yIncrement = this.deltaY / this.deltaX;
those values are added to the x and y positions each frame
 
1:54 PM
how to fire bullet ?
 
My bullets go faster when they're vertical than when they're horizontal. I know why, but I don't knwow how to stop it.
 
if you have a fixed speed of a bullet, you can use geometry to find the x and y movement
 
how so?
 
assume that horizontal = 0°, then you have for speedY = sin(angle) * speedBullet
and for speedX = cos(angle) * speedBullet
 
and how would I find the angle? we never learnt it in school.
 
1:59 PM
it's basic geometry stuff
it depends how you are shooting. With mouse or a key ? or cursor. if cursor, then you have 4 angles ...
 

« first day (1652 days earlier)      last day (3303 days later) »