« first day (1083 days earlier)      last day (4088 days later) » 

19:01
@Srle (1)Don't think of it like constructors from c#/java/etc; (2)the implementation doesn't really do that.
holy shit people
i need help with node js, im learnign it, and i dont understatnd it
@deep Or document.write( eval('you') );
user1596138
!!tell ChrisJohnson solution
19:02
:D
I shouldnt be laughing this hard
@Zirak, can you explain me exactly what implementation do.
If that were me i would wipe that smile off my face
but i am
@FlorianMargaine 9 mins bc I forgot that array is type "object"...
@Srle Hang on, I answered a similar question
19:03
!!s/smile/cum
@deep That didn't make much sense. Use the help command to learn more.
dammit
@deep tit
!!/help !
@deep Command s does not exist. Did you mean: !
@deep !: User-taught command: <>!!!
19:03
Guys what am i looking for
@Jhawins sorry if you answered me before, is there a filter_var filter / flag or w/e that will trim all but strings AND digits?
@deep cum?
i wanna learn how to replace stuff
deep, please, there's a line, it's a line in the sand, but come on. Have some decency.
user1596138
19:04
Can anyone explain or just give me the term to look up for using logic operators in variable definitions? e.g. var multiValues = args || 5;
sorry @JoeFrambach
@Jhawins guard
user1596138
@rlemon I'm not completely sure I understand what you're asking.
19:05
@Srle The implementation does a lot of magical things. Function is not really THE function constructor; it just makes functions. Similarly, Objectis not THE object constructor; it just makes objects. How they do it is internal magic, and thinking about it in classical terms only gives way to confusion.
I really want a combination of FILTER_SANITIZE_NUMBER_INT and FILTER_SANITIZE_STRING
for safe callback names in my GET request
Write a program that uses a single synchronous filesystem operation to
read a file and print the number of newlines it contains to the
console (stdout), similar to running `cat file | wc -l`.

The full path to the file to read will be provided as the first
command-line argument.
user1596138
@rlemon Ah. You mean in PHP?
no in Ruby.
I just posted the PHP docs and filter_var function for shits and giggles :P
I thought surely mr.PHP would know ;)
user1596138
Ah haha. Well you're saying you just want to strip a string of everything that those two filters in PHP would do?
user1596138
19:07
Either I don't get the question, or you need a regExp? haha
ugh, i'll figure it out on my own
useless
@Zirak and i can say that im really confused :D im not long in JS(more in C#/Java) and sentence that force me to think in that way is:
"Instances of Object aren’t very useful on their own, but the concepts are important to understand, because, similar to java.lang.Object in Java, the Object type in ECMAScript is the base from which all other objects are derived."
user1596138
I'm trying babe! I just don't get it.
@Srle Don't think of it like that
ANYONE?
19:09
Saying "instances" in js is moot; you don't have anything which isn't an instance.
@deep Shut up
3
ok
user1596138
Oh!
@Srle Additionally, there is no "object type".
user1596138
I didn't know filter_var was being referenced as the php function.
Everything (nearly) is an object. That means that it has the inherent ability of being a dynamic key=>value holder. That is all.
19:11
@Zirak now im totally confused. Suppose i need to learn more, thanks on the answers.
Languages like java complicate the definition of "object", while in js it's "can contain key=>value pairs".
I cant find any article that explain this in details, every book and tutorial just say "everything is object bla bla, functions are also object bla bla"
There isn't much more to explain.
@Esailija did youi see Yusuke Suzuki's message in es-discuss about implementing promises in V8?
Objects can contain arbitrary key=>value pairs, functions can also contain arbitrary key=>value pairs. Therefore, functions are objects.
//you can do
var foo = function () {};
foo.moose = 4;
Primitive values like 4 or "foo" can't contain arbitrary key=>value pairs, so they are not objects.
Think of it like that.
yes i know and it takes a lot for me to get comfortable with something like foo.moose = 4
!!>hi="hi";hi.hi="hi";hi.hi
@JanDvorak "undefined"
oh...
!!>hi=/hi/;hi.hi="hi";hi.hi
@JanDvorak "hi"
19:18
hmm...
@Srle It's liberating
hint - they're not objects
@Zirak I understand that, but it's new to me
!!>hi=new String("hi");hi.hi="hi";hi.hi
@JanDvorak "hi"
A lot of books cover the topic incorrectly.
19:19
It's a language fuck, I'd reckon.
Rhino book for example claims strings are objects. Silly Rhino.
Some things not being legit objects is weird.
(except for null and undefined, which are intentionally not objects. but maybe that's weird as well? debatable.)
@Zirak, thanks definitely going to read it
Enjoy
@Zirak boxing in C# is completely different though, it's nothing like boxing in JS and Java
19:21
Really? What does it do differently?
tell us
In C# there are no primitives, everything is an object basically
No "Integer"
Or "Double"
Everything is can be treated as an object
like in Ruby?
They're called 'primitives' but they're really not primitives in the Java sense
Yeah, like in Ruby
That's a good analouge
19:23
Primitives don't really have anything to do with it.
It's about value type vs reference type
    int i = 15;
    Console.WriteLine(i is object); // True
@KendallFrey yeah, value types are very nice. They're just not primitive value types like in JS, no type conversion occurs.
I'm going to reopen numbers in ruby to see if they are interned.
They're just values, like the number 5, or the day 07-05-1943
"primitives" like int in C# are just aliases for the type. string is just an alias for String, the part where access is fast is done by the compiler and not by the user.
user1596138
http://chat.stackoverflow.com/rooms/info/17
In simple terms, C#'s type system is - less broken in a sense.
(Although, it has plenty of broken other stuff, like events)
room mode changed to Public: anyone may enter and talk
Made you all refresh :P
Because changing room mode certainly requires a refresh genius SO chat room coders say :)
@Zirak looks like you're getting another 500 from Neal lol
user1596138
19:28
I hate support season
user1596138
How am I ending up with these objects? All I'm doing is robbing from the .content divs and stealing text from innerHTML.
user1596138
Oh shit. There's a global object of users already.
@Jhawins Hey, that's me
@BenjaminGruenbaum On which answer?
@Jhawins That's the `users` variable
oh, the range one
Wow, it was a downright rep cow
19:30
60
Q: Creating range in JavaScript - strange syntax

Benjamin GruenbaumI've run into the following code in the es-discuss mailing list: Array.apply(null, { length: 5 }).map(Number.call, Number); This produces [0, 1, 2, 3, 4] Why is this the result of the code? What's happening here?

user1596138
@Zirak I didn't realize they had already used it. I was doing things as a function earlier so I was fine in that scope I guess, but now that I was just playing in console they're coming in.
You know you love milking dat rep cow.
@BenjaminGruenbaum How are events broken?
Although it's Neal's rep, so you might want to take a long burning shower afterwards :)
Wash off all that jQuery copy pasta
@KendallFrey object sender much?
@lidashuang 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.
19:31
The type system totally breaks there, events are not generic - which makes sense since they predate generics, but they kind of suck because of it, they need a revamp badly.
@BenjaminGruenbaum How does that make them broken?
object sender is just a convention, not anything related to events
@KendallFrey They don't respect the language's type system, you almost always need to cast there which means you almost always need to break compile time type safety. There is no way to make generic events in C# AFAIK.
Sure there is.
Show me :)
Plus, there is no way to raise an event if you don't know the handler. Have to do horrid things.
public event Action<TSender, TEventArgs> Event
@BenjaminGruenbaum What does "know the handler" mean?
19:34
@KendallFrey Right, now think of how that looks in a use case like WPF, or event based routing or coding in practice.
@KendallFrey I have a button with an event "click", I want to raise it from the outside but the button does not expose an OnClick for example.
@BenjaminGruenbaum Why sure it does.
Problem is, manually firing events is a horrible solution
@KendallFrey How, show me how I can raise the event.
@KendallFrey No, sometimes it's not a horrible solution, sometimes there is a legitimate reason to do it.
ugh, when switching from n++ to vim and back I constantly fuck up the keybindings in both
If you want to simulate a click, you probably need to do more than just call the event
I should stick to one editor
19:36
@BenjaminGruenbaum button.OnClick...?
@KendallFrey I want to call the handlers but I don't know them in advance.
Why do you want to call the handlers?
@KendallFrey Read above, in this example button does not expose OnClick , suddenly I have to resort to reflection and decompiling to see what to do.
@BenjaminGruenbaum What UI framework is this?
I run into this all the time, but let's take the most recent example. I use Telerik controls for WP8, the autocomplete control builds the index the first time the user taps on it which freezes the screen for 3 seconds. I wanted to build the index in advance but they don't expose a method to do it so I wanted to simulate a tap while fetching resources.
19:37
That sounds horrible
That is horrible.
that's a hack
Don't they have an OnTap or something?
Of course it's a hack. That's the point, quite often you have to work around horrible code to get your code to work.
In .NET, controls don't normally do anything inside their own events
19:39
@KendallFrey A .BuildIndex would have been acceptable too, but no. Had to use reflection and decompilation, that's just one example.
@weloytty 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.
Closed source ftw.
Fun fact, that control costs 100$
now to make it not horrible
19:40
@rlemon encapsulation
Sounds like Telerik has horrible code, so it's not your fault.
@JanDvorak ??
They're the "most professional" and "best" say Microsoft themself. I'm not just saying this, I got the advice to use them by head of developer relations at Microsoft and then a second time independently by a "Microsoft Developer Champion"
@rlemon I mean, a mess of wires in a shiny box is still a mess of wires, but it doesn't look like
user1596138
@rlemon Interesting. I'm guessing you don't plan on having the bot post that here. Or did you think of some way to return a text result of a PHP script?
19:41
@JanDvorak ahhh I gotcha
The language should bind that event to the object and give me lexical this. Sometimes C# tries to act like JavaScript and fails horribly at it. Events are just one example.
Sometimes, it tries to do its own thing - C# callbacks: huge fail, async/await : huge win.
can the bot do ajax?
Work with the language structure, not against it.
user1596138
@eazimmerman Not cross-domain. But the bot is written in JS, so yes.
user1596138
1
A: Dead simple cross-domain php script

thaoltHow about this , updated <?php // fetcher.php $url = $_GET['url']; $callback = $_GET['callback']; $read = file_get_contents($url); $read = addslashes(htmlspecialchars(str_replace("\n","\\n",$read))); ?> <script> <?php echo $callback ?>({responseText: '<?php echo $read; ?>...

user1596138
19:42
You're doing this?
@Jhawins Why not crossdomain? You can just run the bot in a browser with cross domain restrictions turned off.
user1596138
@BenjaminGruenbaum Because currently that's not how it's setup.
@BenjaminGruenbaum I think C# delegates are cool. How much code would it take to implement multicasting in JS?
@KendallFrey None? Because they solve a problem that doesn't exist in JS?
@Jhawins well I can write a plugin for the bot to utilize it
but really do we need an insult generator for the room?
I think not
19:44
@BenjaminGruenbaum True, but what if you did want multicasting?
@KendallFrey But why? You mean just invoking a list of functions? The JS function syntax is so expressive that's not a problem in the language, just have an array of functions and push or splice than use .forEach(x=>x()) or .forEach(Function.prototype.call) or something.
I mean, C# has a lot of bunch stuff that works for C# but would be pretty pointless in JS, honestly I rarely use delegate syntax now that I have lambdas :)
how I loath you both
!!unimpressedlemon
@rlemon That didn't make much sense. Maybe you meant: unimpressedlemon
forEach won't give you the proper return value
@rlemon 【ಠ_ಠ】
19:48
@KendallFrey So map, or reduce it with addition, or whatever. Doesn't matter really. I was just illustrating the fact it's a problem that doesn't exist in JS since anonymous functions are so expressive.
I'm off to sleep, have a plane to catch - gnight everyone
Have a pleasant flight. Try not to crash.
user1596138
@rlemon True.
Where's the insult generator at?
@Jhawins, @rlemon, @Shmiddty liveweave.com/vcHxUp
The "while" one isn't properly conjugated, but eh
20:01
@Zirak @OctavianDamiean ^^
@FlorianMargaine 9 minutes, 57 seconds for all 5 levels. Well done! The last one gave me some trouble. I forgot that typeof [1,2,3] !== 'array'
!!> typeof [1,2,3]
@Shmiddty "object"
!!> typeof "123"
@Shmiddty "string"
What bothers me is:
!!> typeof null
20:07
@Retsam That didn't make much sense. Use the help command to learn more.
@Retsam "object"
Well; though, I suppose the array thing would probably bother me more, if not for _.isArray
user1596138
I should have read more about closures awhile ago.. This is cool.
4 minutes, 39 seconds, after 2 really stupid mistakes.
I accidentally returned the wrong value twice...
Duck-typing and reduce made most of it rather easy
user1596138
names insulting function 'cuntCentral`
+b===b to test for numbers
user1596138
20:14
you can use b.map to test for arrays
heh, I just used b.toFixed to check if it's a number, and Array.isArray for arrays.
user1596138
Only good for my own entertainment... I'm just going to use a user-script to change random words to more fun words.
b.toLowerCase for the strings one
typeof b === 'string'
was the first thing that came to me
20:16
Duck-typing FTW
!!s/^./F/
@KendallFrey Fuck-typing FTW (source)
and then I got stuck when typeof b === 'array' kept returning false.
because dumb.
user1596138
@rlemon one of the insults involved calling people "canadian" (hoping that it would peg you randomly..). It got you.
user1596138
user1596138
20:19
!!afk smoke
@Jhawins Apricots are people too dammit!
@Shmiddty b.pop :D
I didn't test for the array as such. I did `return i.map(function(a){if (typeof a == 'number') return a; if (!a.map) return 0; return arraySum(a)}).reduce(function(p,c){return p+c},0)
@StefanoCerelli 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.
@Zirak 14 minutes after being stuck on the last question for 12 fucking minutes
:(
and mostly because I wasn't even checking for the arrays
if( Object.prototype.toString.call === '[object Array]')
see what is missing ??
the value facepalm
20:26
@rlemon, @Shmiddty, @FlorianMargaine gist.github.com/Zirak/6816574
yes, I used semicolons and curly braces even though it was timed, because I have class.
@Jhawins what the actual fuck...
@Zirak quack quack quack quack! Lots of ducks there!
Yep, it's great
My girlfriend got accepted at Microsoft but rejected the job
posted on October 03, 2013 by Victor Rodriguez

How to Install Android Apps to the SD Card by Default Robocopters to the Rescue No Edge: The Shape of the Universe. (Part 1: Flat Models)  No Edge 2: The Curvature of the Universe

20:35
@BadgerGirl congrats and good for you!
@copy I hope you were talking about that girlfriend ... and not @Shmiddty
@rlemon Gracias :)
Which part of Microsoft?
I'm still stuck on how to control my categories to be separate from everyone else and toggle individually since I'm using php to generate the content. benlevywebdesign.com/simmzys/menu.php
The part where Frodo threw the ring into the lava
@Zirak There's only one, the retarded part.
user1596138
20:37
@GNi33 Insult generator.
;)
because yea.
ohh, this is brilliant
user1596138
Except mine is a little more... Crude.
user1596138
@GNi33 Then help me think of new verbs!
yea mine is less crude :P
and very limited to the words I put in
20:42
Am I nuts? I thought I could do undefined = 0 and over-write the value. I don't seem to be able to do it in console.
does fat-ass count as an adjective?
@Zirak That's fairly close to what I did
I used i*2 though.
@Shmiddty Yeah, so did I on the first run, but when running it a second time to copy answers I got influenced by rlemon saying he did it as i+i
@Incognito porn more_porn goat_porn pictures_of_mom
q.q
alias justfuckingdoit sudo
rm -rf /
justfuckingdoit !!
function longestString(i) {

    // i will be an array.
    // return the longest string in the array

    return i.reduce(function (a, b) {
        return typeof b === 'string' && b.length > a.length ? b : a;
    },'')
}
20:50
omg
Steven Wills <[email protected]>
10:07 AM (6 hours ago)

to me
Hey, don't be such a rebel. I bet you're where the line, "I'm a loner, Dottie, a rebel." came from.

You probably told tell this to all of the girls.

"There are things about me you don't know anything about. Things you wouldn't understand. Thing you couldn't understand. Things you shouldn't understand. You don't wanna get mixed up with a guy like me."

Don't let hate be such a big part of your personality, and don't put so much public info online.
this is the guy from the question this morning we were like "uhhh not the right fit for SO" and closed
and then asked the same question again
function arraySum(i) {

    // i will be an array, containing integers, strings and/or arrays like itself.
    // Sum all the integers you find, anywhere in the nest of arrays.

    return i.reduce(function (a, b) {
        return a+(+b===b?b:b.map?arraySum(b):0)
    }, 0)
}
huh, it's weird. Do you really think of code golfed that way? A force of habit now?
@Zirak only when I'm trying to be clever
The test cases for the file extension weren't very good
20:55
this user ^^ has since changed his name
function getFileExtension(i) {

    // i will be a string, but it may not have a file extension.
    // return the file extension (with no period) if it has one, otherwise false

    var b = i.split('.')[1];
    return b?b:false;
}
@Shmiddty They really sucked. I was afraid of double extensions, things like that. They did nothing tricky.
took the time to "look me up" i.e. checked my profile -> and email me to tell me i'm a bad person because he's a idiot?
@Zirak yeah
@rlemon wth
20:57
lol yup
I replied with "cool story steve"
function getFileExtension(i) {

    // i will be a string, but it may not have a file extension.
    // return the file extension (with no period) if it has one, otherwise false

    var b = i.match(/\.(\w+)$/);
    return b?b:false;
}
now he's just put himself on my watch list
I shall close all of his crap questions
-5
Q: How is html printed using Python

737In php files it is common to have html mixed in. This is apparently a big no-no with Python. So how does Python output html? Say you want some information to be inside of a div how would you do it?

like this one
@Neal now delete it!
@rlemon check his questions to see if he is making a tor hosting site
My even test was exactly the same as yours, @Zirak
lol
20:59
@rlemon already marked. :-D
@ThiefMaster you around?
@rlemon this guy looks like self self-destroyer to me. he just wants it.
can you look at that user, he's already had two questions deleted and actually emailed me
I had a very good poop and I feel much better.
ugh, annoying. but regarding his questions he already "fixed" the problem on his own - if you know what i mean
yeah, not much we can do about his off-site actions.
yea but three horrible questions, one is a dupe of the other, and he argues that "we should just answer him" instead of trying to direct him to see the folly in his ways.
@rlemon i'm gonna update terraria later. is there a server?
idk, I was not expecting anything to be done about the email, I just mentioned it to show character. If he is not already Q banned do mods do that? or is it a automated thing
@eazimmerman there will be
21:04
it's automated
@OctavianDamiean figured out how to get it running on linux so we can host from a VPS
@rlemon there is a good chance that we won't see any further questions from that guy ;)
@ThiefMaster Well we might... just with a different ID...
You killed him?
(on that account that is)
anyways, I just like to point these people out to mods when I find them. Tell me to stop if you don't care to know :P
home time, bbl.
21:08
Is there a flag to force chrome to trust its cache? Right now multiple refreshes invalidates cache on that page.
Hm, I'm not sure
Usually I have the opposite problem
I know right? I can't find anything about keeping the cache, just removing it!
:(
21:22
Hmmmm 737 is gone. *poof*
@copy you are needed
user1125394
21:48
how would you code the same behaviour as a blocking socket read, but without sockets
With sockets
user1125394
while (true){
    if (events.length>0){
        //treat event
    }
    sleep(5)
}
user1125394
is sucky
Because it's blocking
user1125394
!!google blocking event loop
(and there's no such thing as sleep)
user1125394
true, sorry was thinking of another language
If you really want blocking, remove the sleep. But if whatever gives you events runs in the same thread/process, you'll block indefinitely.
user1125394
yes ok I was told to always put a sleep in such while(true) loops, to avoid 'overclocking' I think, but probably stupid
@AndyPerfect 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.
21:58
Fuck dojo. Worst library... ever. </vent>
["selected"] == "selected" returns true, is that right?
the array gets cast to a string in that case
so yeah, it's true
user1125394
!!> ["selected"] === "selected"
I don't like php at the moment right now JS isn't far behind it either
@cc true
@cc false
22:00
@nEAnnam Once again showing that you shouldn't use ==
user1125394
the more =, the better
is that casting browser-dependent?
No, it's defined in the spec.
!!spec abstract equality comparison
See ^
22:03
thank you very much
Enjoy. Never use it.
lol why not?
Because it's weird, it does things which I can't exactly remember, so I don't trust myself with it.
I know exactly what === does, it's predictable, it behaves like equality.
== isn't even transitive...which is something we generally want from equality.
I always use == unless I know I care about type casting. I like to live dangerously.
It's not just the type casting
It's not equality, so I don't use it when testing for equality.
Also, don't listen to nderscore, my knee has things to do to his crotch.
22:07
<3
user1125394
hm cool the language I'm dealing with, have a BlockingQueue class
</3 nderscor
xD
user1125394
I thought it was faster but no jsperf.com/equalss
These kinds of benchmarks are completely meaningless...
user1125394
knowing when jsperf is meaningful would be faster to understand then
22:32
If you guys need something to do
0
Q: Why does jQuery interpret broken markup differently than the browser?

Joe FrambachI have previously answered this question, but I do not fully understand why the answer is correct. The gist of the answer: <p id="jqrender"></p> $(function() { $('#jqrender').html("<a href=http://www.website.com/>foo bar</a>"); }); On latest Chrome on OSX, jQuery interprets this as <a h...

0
Q: Javascript not displaying inside post

user2803938Hi I'm trying to add a video that uses javascript inside my post within the editor. I always enter it within the HTML editor with the post and have tried several different plugins but with no luck. I've included the relevant code below but it doesn't appear to run when I preview the page. I have...

I'm tired, but this should answer your question:
!!> "<a href=http://www.website.com/>foo bar</a>".replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, '<$1></$2>');
@Zirak "<a href=http://www.website.com></a>foo bar</a>"
Oooh, thank you
Are you writing a response on SO or can I use that
I don't mind answering my own Q
Go ahead
22:41
Good find, btw
@JoeFrambach I went to the jquery source, started looking around for html: (where the html function is declared). Peaked inside, ignored most, saw that the value is being manipulated by rxhtmlTag, looked at that, executed manually to see what the output is.
I tried looking through the jQuery source before posting the question but couldn't find that particular line. I guess your code-sniffing abilities are much better than mine
Hah, I got a "too broad" close vote already
Fuck that

« first day (1083 days earlier)      last day (4088 days later) »