« first day (1011 days earlier)      last day (3920 days later) » 

12:02 AM
Hey, @Dave I figured out why my code wasn't working! It's cuz the input wasn't appended into the actual document when I set onclick. I have no idea why it matters but it just does! Thanks for your help!
 
ok reset my router
maybe it will be better now?
 
@SomeKittens Ever heard of a Bose-Einstein Condensate?
It's all the rage. All the cool kids are drinking it
Does interesting things to the relative speed of light
 
@Loktar lol staging is bottom up. Not top down (0-n)
 
(And yes, I'm aware it's all technically relative, but I thought I'd distinguise from the mathematical constant)
 
hey guys, never use innerHTML += ... and .appendChild(...) at the same time, it causes some fk'd up errors
 
12:18 AM
ok back online twitch.tv/arrrrrlemon
sign up and help me
dammit
well my internet is shit and keeps booting the stream
i'll try later
 
12:46 AM
@Carlangueitor 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.
 
1:12 AM
@CapricaSix Is anyone around? Can I ask you a question?
 
CapricaSix is a bot, good luck with that
...oh
 
@monners Got four in the kitchen
 
Cool
Literally
 
@rlemon offline...
Oh, wait, that was an hour ago
 
1:33 AM
IM IN MOTHER FOKIN ORBIT BITCHES
 
@rlemon We've got drones for that now
 
so what do I do now?
 
What is it with print designers and their obsession with fixed vertical positioning?
It's the web people! You don't know how much content is going to be there!
 
@Zac 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.
 
@rlemon Get on Twitch!
 
1:46 AM
ok hopefully I don't get booted
 
1:59 AM
can anyone help me with a jquery mobile issue
its small
 
shoot
 
I'm trying to put the switch and the button on the same line
I tried putting them in the same field contain, adding divs, etc..
No matter what I do i cannot get it to work
 
@AnhNguyen 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.
 
Also here's the html:
<div data-role="fieldcontain">
<label for="switch">Privacy:</label>
<select name="switch" id="switch" data-role="slider">
<option value="0">Private</option>
<option value="1">Public</option>
</select>
<a href="#switchinfo" data-rel="dialog" data-role="button" data-icon="info" data-iconpos="notext">Switch Info</a>
</div>
 
2:18 AM
i get so lost v.quickly with unnamed functions in unnamed functions etc
 
documented most of my game collection
missing my virtual boy in the pics though dangit
 
damn dude
no need to leave house :P
 
haha
 
@Loktar WHERE WERE YOU! I WAS IN ORBIT!
no clue what to do from there :/
 
2:27 AM
try and get on the moon! :P
 
go to the moon
 
ive never been in orbit nice job man
 
in real time :P no fast forwarding thats cheating
 
the ticket was throttling back around 15K m and starting to angle. bet at 50 degrees around 30K m and 90 around 70K m then start to create your orbit
 
I have no clue what you guys are even talking about
 
2:29 AM
once I got staging down and after watching you that wasn't so bad to figure out
i'm going to add one more phase to my rocket then try to send it into the moon. I don't get how to use the "maneuvers" tho'
@Loktar you should join the stream (after my smoke)
 
@SomeKittens What's your address?
And @Esailija you too.
 
what address
 
Home address
 
finland
:D
 
Okay, so I'll just write that on the postcard. I assume everybody knows everybody over there
 
2:40 AM
I can tell it to you on facebook
 
Thanks
 
@Loktar in orbit twitch.tv/arrrrrlemon
probably one of my best so far (of three)
 
m59
when dealing with a no page-reload site/app how you prevent insane link clicking from putting the wrong content with a url?
 
@rlemon YOU SAID YOU DIDNT HAVE A CAM WHEN I WANTED TO SKYPE YOU
 
m59
in other words, each click to a different page is a single ajax call to the api to determine what content to change...and then it changes
 
2:49 AM
@Gacnt he just got it
this weekend
 
m59
but it if you click back and forth fast enough, it gets confused.
I can think of some hacky solutions, but it's probably common enough that there's a standard, right?
 
@rlemon Zoom way out, is there a giant orbit pattern?
You just broke my heart
With the pronunciation of my name
Show us your fish
Gacnt = Datsik from now on
 
hey!
@phenomnomnominal i forgot to thank you yesterday
i looked through the code, and now it got easier than i expected.
 
3:04 AM
that's good
 
yea
@phenomnomnominal i have one question
you know some of those things that you place the <script> tag on your page, and some html and stuff pops up there?
how can i do that, but with my html
like a google ads script
is that liek a plugin or something?
 
3:27 AM
typically all they do is fetch a JS file from somewhere and pull it in to your page, which then adds stuff to it
 
ah, ok
@phenomnomnominal i can not wait to show you what i am making with the code you gave me, i am also expanding upon it too
just to let you know, i am a young developer, so i like to learn ha
i just turned 17
 
congrats
 
@markotom 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.
 
any of you was used Resourceful of Flatiron?
 
@Gacnt the fish tour will be another night
webcam is tied to the pc
 
3:38 AM
I used Resourceful (CouchDB), but when I createChild of parent I get this error: "Document update conflict." You know what's happened?
 
ok lets get another game going
playing Litter Inferno http://www.twitch.tv/arrrrrlemon
 
4:07 AM
@copy Alameda, CA
@rlemon That's a fun one
 
join in
i'll need tips
 
4:38 AM
awkwardness
 
m59
^ haha win
I like the "punch-five"
and they trade it back and forth, epic
 
yeah
 
4:56 AM
@dc5 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.
 
@O0oO0oOO0ooO imgur.com/nPsQa20
 
user1596138
@SomeKittens @Shmiddty appearently we had agreed to do it tomorrow at 5. Not today. Although we actually never said a day at all after I suggested Monday or Tuesday. Odd mis-communication. Hopefully doesn't make me look stupid, but we'll see tomorrow.
 
5:13 AM
hi
 
user1596138
Hey
 
"We are the rudest bastards in the world. Room pseudo-rules"
^ what with this?
 
@Mr_Green see the interseting feed
whats up @Jhawinsss
 
user1596138
@Mr_Green See the third message down.
 
i am going back to bed... my app's arch is half done
which looks good to me :->
 
user1596138
5:14 AM
Later
 
who is bushdiver?
I didn't get the msg.. might be funny or interesting though
 
user1596138
Jul 18 at 2:39, by bushdiver
btw, you guys are the rudest bastards in the world
 
user1596138
Just look at the context... Or lack-of.
 
ahh leave it
out of my understanding
 
5:34 AM
@Mr_Green There are other people in the world, and some of them occasionally go into this chat.
One of them, who calls himself bushdiver, also came in.
And he sent messages.
One of these messages was "btw, you guys are the rudest bastards in the world"
~ FIN ~
 
@CrazyTrain you're doing good work. Keep it up :).
 
@Zirak ok
 
:-)
Zirak is explicitly the best artist with the language in the chat.
 
5:55 AM
wtf again hacker news is down
 
Please consider expanding this to an actual answer rather than a link to an external site. — Benjamin Gruenbaum 25 secs ago
 
Oh well. Time to shed off another rep point...
 
@JanDvorak lol he accepted your "one-liner" :P
 
It is a one-liner
 
I need a good cookies library, by library I mean "addCookieValue", "getCookieValue" and "setCookieValue"
 
6:09 AM
how so
 
I't rather put "your" in quotation marks. Sza pointed to _.object
 
it's in quotes because you made exception to normal code styles and didn't indent function body
 
you can't do much without functions
 
this is roaming in my bookmarks since forever
 
6:11 AM
also, it is a one-liner in languages with decent lambda syntax
 
so are all the other answers
 
@BenjaminGruenbaum ugly
 
Sza's answer is close to shortest possible without using lambdas
 
@FlorianMargaine Looks simple enough
 
you don't need more than 3 functions
 
6:12 AM
if you can't map properly, you have to pluck twice
 
Sza's could be a legit one-liner
 
@FlorianMargaine That's what it gives me too
 
but yeah, that _.zip is unneccessary
 
jessegavin's answer is what I'd go with
and off to work :)
 
note how not using any library is not that bad
var o = {};
for( var i = 0, len = array.length; i < len; ++i ) {
    o[array[i].name] = array[i].value;
}
 
6:16 AM
Is there a trick to force coersion to boolean?
(!! is the best I can think of)
 
Pass it to Boolean ?
 
Ok, other question. I have a string "true", is JSON.parse the cleanest way to get the boolean true from it?
 
@BenjaminGruenbaum !! is the canonical one I think
@BenjaminGruenbaum === "true"
 
Yeah, you can also do x === 'true'
 
who would spend time looking for library funtions to do something like that is ridiculous.. unless you need to do that all the time in which case there is probably a real problem somewhere else
 
6:18 AM
@JanDvorak @Zirak Yeah, I guess that's cleaner.
I like how JSON.parse would throw an error if it's not either true or false though.
 
@Esailija you can suggest a no-lib version, and I'll upvote
@BenjaminGruenbaum umm... "{}"
 
If you want to be certain, then JSON.parse with a short explanation.
 
it's not critisism of your answer, just wondering in general why people use these horribly named functions rather than just write the code
 
@JanDvorak Yeah, I guess I didn't think of that.. I guess I'll just have to assume I'm not a complete retard and won't pass weird values.
 
@Esailija I still think it's a good idea if you show a no-lib alternative
 
6:20 AM
@Esailija People like using tested code instead of writing their own, it's a very relaxing experience until you realize you test much more than most of the 'tested library code' on the internet.
 
@BenjaminGruenbaum I am talking about finding a clever combination and mix of underscore "convenience" functions and then arranging them together to accomplish something that can be done with a straight-forward simple loop
 
@BenjaminGruenbaum {true:true,false:false}[x]
 
the code you need to test in that case is exactly the same
I am not talking about rolling your own mp3 decoder
there is a difference
:P
 
@JanDvorak Yeah, that works.
@Esailija I'm not saying I disagree, I'm just trying to explain what I think the rationale is.
I don't even know what the question is.
 
1
Q: Underscore.js - Map Array of key/value pairs to an Object - One liner

parliamentI've been going through the underscore docs but I can't seem to find a method (or nested method call) to do the following transformation: Let's say I have the following Javascript array: [{ "name" : "sEcho", "value" : 1},{ "name" : "iColumns", "value" : 12}, ... ] And I need to transform it ...

 
6:30 AM
@BenjaminGruenbaum what if the string is "__proto__" though
I wonder how many node.js servers you could crash out there by using __proto__ everywhere in user input that you can
 
@Esailija or hasOwnProperty
you're right; oops-
 
6:55 AM
cool.. Batman arkham origins
 
@Esailija Why would you you crash anything?
 
Is there a simple heuristic to determine if a remote server is node.js (or, more generally, javascript-based)?
 
I send a header because I'm nice
 
PHP servers normally send x-powered-by
 
It's optional
Frankly the client shouldn't care.
I don't understand why the string __proto__ would crash anything though on any server.
If your input is not whitelisted and sanitized it's your damn fault.
 
7:08 AM
@BenjaminGruenbaum when used as an object key
 
I really don't see the use case.
Why would user input be used as an object key in the first place?
That shows very fundamental lack of understanding imho.
 
@BenjaminGruenbaum Proof of concept, that's why!
 
page={front:'front.js', back:'admin.js'}[page]; if(page){...}
 
@monners I do a ton of PoCs and I don't see why that'd happen.
@JanDvorak It wouldn't never get that far (page)
 
Perhaps you're trying to build a service that lets other devs construct objects or something.... Ok, you're right. Why would you ever do that...
 
7:11 AM
@BenjaminGruenbaum how come?
 
@Safira 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.
 
I can see how it happens, these sort of bugs happen in the PHP world a lot but I'd like to think node developers use node because they have a better understanding - you only use node in specific cases and those specific cases require a better understanding of how things work anyway.
You have to understand the HTTP protocol to use node, and how user input is passed and why and when. If you know these things and mess up in such a silly way it's your fault.
 
umm... thanks
 
@JanDvorak First, this is not how routing works. Second, if it was you would whitelist it first.
@JanDvorak ?
 
I think my server would have crashed
 
7:13 AM
@CapricaSix: Wow I just got in and welcomed in second. But what's this mean? "Please don't ask if you can ask or if anyone's around"
 
@JanDvorak Then you should read a web security book :P Sorry - but you should really not have a bug like that.
 
@Safira some people ask "hi, may I ask something?", then wait patiently
 
@Safira it means that if you have a question you just ask. Don't ask "does anybody here knows X?"
 
@JanDvorak and @dystroy: Thanks.
 
@JanDvorak Half of how Rails site get hacked is because they don't pass DTOs and pass objects straight from user input to the DB, I never got how people can be so careless. I destructure, check against a whitelist and restructure all my objects when accepting any form of user input.
 
7:16 AM
I just included a javascript script inside my PHP file. Now it comes to "exceeds maximum execution", what happens?
 
@Safira most likely an infinite loop in your PHP code
 
Might be other problems, but hard to guess without the code.
 
remember that PHP should only send Javascript to the client to execute. It cannot execute any JS code itself.
 
Why is Infinity - Infinity NaN?
 
@monners How else would you define it?
 
m59
7:19 AM
var cache_life = 60*60*24;
var time = new Date().getTime();
var tommorrow = time+cacheLife; //?????
 
@monners what would you like instead?
 
@monners What is infinity?
 
it's a string.
 
Its mathematical value. 0
 
7:20 AM
@FlorianMargaine :(
 
@monners Mathematically, Infinity - Infinity is not well defined. You need to understand what infinity means first though.
 
you can be so cruel
 
gramatically, *it's. Mathematically, infinity isn't zero.
 
@monners Let's say you have a sequence of numbers: 1, 2, 3, 4, 5 and so on . It is not bounded, we can say that the limit of that sequence is infinity right?
 
7:20 AM
@JanDvorak according to the orthograph, it's "grammatically" though.
 
@BenjaminGruenbaum You are kidding right? Objects are used as hash maps all the time
 
(Without getting into the technical epsilon/delta definition of what infinity is)
 
@FlorianMargaine oops, thanks
 
and the typical "safety" of using hasOwnProperty doesn't apply to "__proto__"
 
@Esailija Not on user input without whitelisting they're not.
 
7:21 AM
or "hasOwnProperty"
 
you would validate that it matches some pattern, not whitelist
 
If someone uses hasOwnProperty to sanitize it's their fault. They should whitelist.
 
m59
ah the timestamp is in ms, no wonder.
 
@Esailija Which is a form of whitelisting...
 
like you wouldn't allow the £ character in a user name
 
7:22 AM
Why not?
 
well just an example of validation
 
Hold up, Infinity represents an abstract concept that can't be evaluated, but from what I can remember it can be quantified symbolically by its relationship to other infinite values. Is that not correct?
 
That worked fine when I tested it in pure PHP. Can I upload some code here to describe my problem?
 
There are many infinities. Only with some infinities can you decide Infinity-Infinity=X
 
@monners It can, but with limit arithmetic.
 
7:23 AM
But when I tried it in codeigniter, it didn't work
 
@monners we can say the difference of two sequences that each converge to infinity converges to zero, but that's not always the case. For example 1,2,3,4,5 and 2,4,6,8 both converge to (the same) infinity.
 
Limits... It's been a while
 
@BenjaminGruenbaum doesn't really matter, lowercase ascii alpha and underscore are allowed in almost all alphabetic validation
 
However, 1-2,2-4,3-6... converges to -Infinity and 2-1,4-2... converges to Infinity.
 
but you cannot store 1 exact string in an object and that's that
 
7:25 AM
@Esailija Can you give me a concrete example of such a map that __proto__ would mess up?
 
@BenjaminGruenbaum any kind of map-switcch
like I've shown
 
Even in your case (assuming you don't even check that the object has a key with that name in the first place), how would __proto__ mess it up?
 
it would invalidate a lot of typical assumptions
 
!!> "proto" in {}
 
{}.__proto__ is truthy, but it doesn't transate exactly well to a file name
 
7:28 AM
@BenjaminGruenbaum false
 
!!>({}).hasOwnProperty("proto" )
 
@BenjaminGruenbaum false
 
!!>("__proto__" in {})
 
@JanDvorak "SyntaxError: illegal character"
@JanDvorak "SyntaxError: syntax error"
 
@JanDvorak just run it in your console.
 
7:29 AM
If Infinity is treated as undefined then why is 1 returned when Infinity is raised to the power of zero?
 
@monners It's not undefined, it's Infinity. If you take a sequence that converges to infinity and raise it to the power of 0 - that sequence will converge to 1.
 
@monners You might want to read a little more about infinity
 
@monners Just like if you take a sequence that converges to infinity and multiply it by 0 you get 0.
 
@monners special-case to make taylor polynomials to work
@BenjaminGruenbaum won't work if the zero is also by-limit
 
@JanDvorak (which is a fun way to get e :) ) But 0 is not also by limit in this case :)
@Esailija I don't see how my code (or yours, or anyone else who does node as part of his job) would get trapped in __proto__ (any more than it would with things constructor for the very least which I don't think. I guess I see how careless people might in some cases get tricked.
 
7:32 AM
it is something you don't want to think about because it's so subtle
 
@BenjaminGruenbaum if infinity is special-cased of being always by limit, why 0 * Infinity is NaN?
 
like a big problem is with optional properties which could be shadowed by an injected proto
 
@JanDvorak That's probably a mistake. When we expanded R to be closed under the limit operator 0*Infinity produced 0 and we proved it was the only proper way to expand it. Then again, I probably want anything * Infinity to be NaN in code.
 
do you really want to think about those interactions when your actual task is something else
it's just simple to note that object is not suitable as a hash map for general strings
 
@Esailija Honestly? I almost always use Maps when I need a map.
 
7:34 AM
@BenjaminGruenbaum I want x*Infinity to be +/- Infinity if x is a non-zero number
@BenjaminGruenbaum not supported by IE
 
@JanDvorak What's x*Infinity? Is it the sequence x*a_n where a_n is a sequence converging to Infinity?
@JanDvorak We're talking about node are we not?
 
@BenjaminGruenbaum in which case the result would be Infinity
@BenjaminGruenbaum teaching people to use different conventions for client and server would be difficult
 
I said "Honestly" because I don't think it's a very good idea, for instance because it limits code sharind and objects are adequate hash maps in 99% of cases, especially if you sanitize your input properly in which __proto__ would not be a problem.
@JanDvorak Right, but that also dictates 0*Infinity should be 0 does it not?
 
yep
 
Or you define x*Infinity as a sequence converging to x times a sequence converging to Infinity, in which case 0*Infinity is NaN
Yeah, that actually makes more sense.
 
7:39 AM
Let's stick to actual infinities, please
then Infinity^0 should be NaN but is special-cased to be 1
 
How do you define multiplication? I think the only logical way is to define multiplication x*y as the limit of any sequence converging to x times and sequence converging to y. That's the same as normal multiplication for real numbers.
(Same as in same result)
Then Infinity^0 should still be NaN since it is defines as e^(ln(a_n) *b_n) where b_n converges to 0 and a_n converges to infinity.
 
user1125394
definition of * for R union {-infinity, +infinity}?
 
@cx That's what we just did (see my message 3 lines above yours)
 
if we're using the geometrical interpretation of multiplication, then 0*Infinity is zero
(what is the area of a straight line?)
 
@JanDvorak Still no.
 
7:42 AM
@JanDvorak 0 too can be defined as a limit
 
user1125394
@JanDvorak can be infinite too
 
so the area of a straight line is undefined?
 
@JanDvorak Yes it is
 
@JanDvorak define area
Are we talking Lebesgue integral?
 
@BenjaminGruenbaum it is well defined in 2D
 
user1125394
7:43 AM
a straight line can be an impulsion, a function with value infinity, in one point, 0 else. this line can be integrable in Lebesgue sense :))
 
m59
......
 
@JanDvorak Go ahead, define it.
 
m59
tested my cms in IE : success
even IE8
 
To simply be able to speak of "area of a straight line", you must imagine a non null width and then make it go to zero. Hence the two limits. NaN is the only reasonable solution.
 
m59
IE didn't break my site, but it did break xampp.
tested in IE, and now localhost won't load in chrome
IE10 introduced new ways to f you
 
7:44 AM
@JanDvorak Take the dirac delta function for example. I think that's what @cx was talking about when he said impulsion.
 
ah, *Impulse
 
IE didn't break my site, but it did break my heart
 
I know of that beast. It's not really a function, however
 
Right, it's not a function but it's still relevant to the discussion :)
 
m59
super hard refreshing fest fixed it.
 
7:46 AM
It's zero everwhere except a single point on the x axis and has area.
 
@BenjaminGruenbaum come to gtalk
help help help :P
 
@BenjaminGruenbaum you can't really integrate over an infinite peak (gives out NaN), but you can define the integral to be some value
 
@Darkyen I'm at work, sorry.
 
then the derivation of the integral is an infinite peak
 
um just want som1 to x-check a few things for me :P
 
7:47 AM
I've got to go, but I'd love to continue this discussion later, after all math is my major :)
 
@BenjaminGruenbaum , @BadgerGirl are both busy
:-< @jAndy you free brother ? just will take 2 of ur seconds :->
 
hello Mr. Snowden, we created a new uncle, just for you !
@Darkyen I'm running around my kitchen creating my breakfast and don't even have gtalk installed on my macbook !
NAKED
 
user1125394
@JanDvorak en.wikipedia.org/wiki/Dirac_delta_function their Lebesgues integral = 1
 
@cx Dirac Delta is not actually a function
because it's defined using its integral
 
user1125394
7:52 AM
yes indeed
 
> "Banach-Tarski" is an anagram of "Banach-Tarski Banach-Tarski"
 
user1125394
a measure more exactly en.wikipedia.org/wiki/Dirac_measure
 
user1125394
Math are great, but it's quite rare to use convolutions or such in common jobs :p
 
user1125394
will do some statistics now, so it's not so bad
 

« first day (1011 days earlier)      last day (3920 days later) »