« first day (11 days earlier)      last day (4952 days later) » 
03:00 - 15:0015:00 - 00:00

3:35 AM
What happened to this room? Yesterday tons of dudes were talking :(
 
hehe
 
3:50 AM
it might be they are taking rest today :)
 
 
1 hour later…
5:09 AM
hi
 
5:42 AM
hello
 
Hi is there anyone to help me?
 
ys
 
I have a problem in mootools with iepngfix.htc
iepngfix.htc works fine without mootools
but when I have included the mootools its not working
What can be the reason for this?
anyone there?
 
sorry dont know abt mootools
 
how have you included mootools?
 
6:14 AM
solved, mootools 1.3 creating problem with htc file.
I have included the 1.2 and it works fine.
Thanks for the support..
 
 
2 hours later…
8:36 AM
If i have an function with an disable button and a ajax call, can it be possible that if you click the button real fast the ajax call sends more than 1 call, before it disables the button? How can i prevent this?
 
@user457827 Not likely, especially if you do disabling before the ajax call.
 
I disable it before the ajax call but somehow if you are really fast it sends more than 1 ajax call
 
8:56 AM
0
Q: Change inactive page 'Title'

chanchal1987I influenced from StackOverflow Chat. Here when the page is inactive then number of the new incoming chat messages are displayed in the Page title. When the page is activated the this number is disappeared. How can I implement this concept in my application? I also want to highlight that window.

 
9:07 AM
Just need to find a way to check for whether tab / browser has focus
alternatively count in the page by default and empty count on focus of page
@user457827 set a flag to disable ajax calls and reenable it after the call
 
@Raynos How can I check whether tab / browser has focused or not?
 
@chancal198 just do .focus and .blur on $(window) * wrong name :P
 
Thanks @user457827
 
@Raynos how would you do that?
 
@NickCraver: do you know if jQuery uses any conditional compilation to specifically target IE browsers for anything?
 
9:17 AM
umm yes and no
it doesn't test for IE, but it does test for things that are broken, specifically in IE
 
hmm...
I was thinking of opening a ticket for fixing jQuery.isArray for Internet Explorer.
 
for example $.support.boxModel, $,support.hrefNormalized, $.support.leadingWhitespace, $.support.noCloneEvent, $.support.opacity, $.support.scriptEval, $.support.submitBubbles
is it breaking?
 
No, but it will return false for any array that belongs to a different context
 
e.g. another window?
 
yeah
 
9:21 AM
ah, figures
the way it does the SOP object tree is.....special
 
My fix uses conditional compilation comments to detect the JScript version (it's fixed in IE 9), and switch the solution accordingly.
 
0
Q: How to get an element with class after current one in JQuery?

DongHere is the sample html code: <div id="current_element">Current element</div> Many unknown tags... <div class="target">This is target element</div> Many other tags... Note That Target element and current element may not under the same parent, so I can't find it with .ne...

 
yeah
0
A: How to detect if a variable is an array

Andy EThe arrival of ECMAScript 5th Edition gives us the most sure-fire method of testing if a variable is an array, Array.isArray(): Array.isArray([]); // true While the accepted answer here will work across frames and windows for most browsers, it doesn't for Internet Explorer, because Object.prot...

 
people always forget document order!
oh errrr, yeah that wouldn't make it into core, no conditional comments
 
that's what I thought
I do have a non-conditional comments version
 
9:22 AM
there may be another way to detect it though, just by creating a known array in a way that breaks, if it does then change the algorithm, that's usually the approach
 
@NickCraver Yeah, that was another potential fix. However, conditional compilation would be faster than creating a new window, creating an array in that window and then testing it.
 
oh, I'm saying there may be another way of getting it to break, specific to IE
does IE enumerate the constructor correctly?
 
hmm... maybe you're right.
 
was talking to sam last night about the server move, can't wait for ours with the next release
going from a dual quad server 4 generation (6 years) behind to a dual X5670 or 80
 
er... misread that... I mean Nice!
 
9:29 AM
they wanted to upgrade previously, I stopped it, about to put new load on the system, a lot more load...been working on app performance to get everything < 100ms
every page that is
simple pages are ~6-10ms, slower ones are 80-110ms atm
 
now that is harsh
 
lots of data moving around on those, most pages are 1 DB hit for security, 1 for data, others are 1-10 for data, in the middle of optimizing now...moved the DB from oracle to sql the past few days, now I'm sticking in some constraints that didn't move easily
I just think it's funny how little I deal with JavaScript at work lately :)
do you actually spend a great deal of time with it at work, or just SO?
 
@NickCraver yeah, most of my time is on JavaScript
in fact, I haven't had much time to actually answer questions this month
 
@NickCraver Oh cmon, hand optimising databases is far more fun then writing javascript
 
in this case yes :)
 
9:39 AM
@NickCraver Oh :( so much for sarcasm
I have to admit there is something appealing about optimisation :)
 
to be honest, this is more of a de-screwing from a former "dba"
 
Code optimisation is only fun if you wrote the original code. If anyone else wrote it, it's probably not going to be fun :-)
 
@AndyE I dont optimise other peoples code :P
 
true
 
@Raynos then I don't think you realize how lucky you are!
 
9:51 AM
I can't even look at code which opens curly brackets below the function name eeekk
 
@AndyE I don't think you realize how inexperienced I am :)
Do any of you use a good JS unit testing framework?
 
@jAndy: I was writing my JS code like that 18 months ago... don't tell anyone though :p
 
@jAndy If you multiline arguments list then its quite nice to have a curly bracket below the function name.
 
Oct 22 at 13:59, by Nick Craver
@IvoWetzel - what are unit tests??
 
AndyE: hehe, well I guess it's not that big of a shame, even some guys here in my company do it, but I just think it looks soooo ugly
 
9:55 AM
shhh that was off the record
 
@jAndy: I agree with you, but for some strange reason I wouldn't have back then
 
it's especially ugly if you're used to code functional and pass lots of anonymous functions as parameter. That's the reason why everybody should get punished who writes curly brackets below the functionname in NodeJS & jQuery
:p
but then again, I'm really trying hard to avoid anonymous functions over the last weeks. Using somekind of a "handler object" which contains all methods, but man you can't be too lazy for that approach
 
I use named anonymous functions ;) There still not declared but at least they have some kind of descriptive name
 
@Raynos: It's not just good for a 'descriptive' name, it's also great for debugging purposes -> stacktrace
 
10:20 AM
@Raynos unfortunately, Internet Explorers 5 through 8 would have to disagree with you there.
 
@jAndy I got sick of "?()" so thats why I do it
"@AndyE I find it really annoying that IE desides that there actaully function declarations -.- Im going to hit into some kind of nameclash sooner or later
 
@Raynos: it's fixed in IE9, so in 10 years or so you won't have to worry about it ;)
 
that was the most egregious IE JS bug imo
 
@NickCraver: that one was the JScript team's fault, before the IE team took responsibility over JScript.
 
Dear JScript/IE Team, Thanks for XmlHttpRequest, now get off my lawn. Love, Nick
8
 
10:31 AM
lol they even messed up with native XMLHttpRequest.
 
true, but they also created it, so at least they got that going for 'em
 
yeah. In all fairness, a lot of good MS proprietary stuff eventually became standardized.
But it's like any failed relationship - you only remember the bad stuff ;-)
 
I do wish mouseenter/mouseleave was on that list
speak for yourself, i have fond memories of picnics in the meadow with IE, rendering my pages perfectly with awesome speed
 
with -> wish? yeah, mouseenter/mousleave are infinitely more useful than mouseover/mouseout
 
wait no, that was chrome
oops, fixed
 
10:35 AM
:)
 
"Psychology courses have ruined Beauty and the Beast for me. Sorry sweetheart, I don't think you're in love; I think you have Stockholm Syndrome. "
 
"Message":"Maximum length exceeded." . my server returns a really long AJAX string :(. How do I deal with that?
 
need more info that that, json?
 
jQuery calls an ASP.NET WebMethod. the WebMethod returns a string formatted as JSON
 
hey can anyone help me with this problem stackoverflow.com/questions/4030220/…
 
10:44 AM
@R_Dhorawat - the answer isn't going to change...you can't do this, not unless you have the source to exchange
 
Where really long === 28499
 
@NickCraver thanks dude
but i'm trying to find some way
 
@AndyE - I realized I forgot to put the user script version out there for the daily rep bit, here's a gist: gist.github.com/648812
 
@R_Dhorawat isn't that what JSONP is supposed to be for?
 
i'm not need some data to transfer
i think jsnop work there
here my frame element is trying to acces the parent element
and i am not having a control of the source coming from frame url
 
10:50 AM
@NickCraver: great stuff :-)
 
eh, hopefully someone will use it, I think there are other more popular scripts that could make much better use of localStorage though
may port another few tonight, we'll see how motivated I am after the home inspection :)
 
@NickCraver: Might be a good idea for my unfinished rep audit summary script.
The one I used in this question:
3
Q: More reputation audit lies!?

Andy E's headI noticed this bug whilst writing a greasemonkey script to "borrow" some information from the rep audit page and display it under the reputation tab in the user profile. My rep audit shows 263 days represented, for a few tests on the bug I had my script count the number of "date boundaries" in t...

 
hmm that'd be handy, could make it a dropdown from a box like that or something, dunno what your plans are for it
ah gotcha
i wish they'd provide that in a json format, it'd be so easy to do
 
Yeah. The problem is, it's an uncached query each time you access it, so it can be slow for high rep users like yourself
 
also, wish you didn't have to inject your script with chrome if you rely on any loads, e.g. jQuery
it's still pretty speedy i think, let me test
200-400ms
not too bad, but again, localStorage, no need to fetch it unless rep changes
back in a while, time to wake up the better half and such
Screenie for others (colors are whatever SE site you're on): yfrog.com/f/6397tqj
 
11:13 AM
@NickCraver I wonder if Chrome scripts will ever allow unsafeWindow access. I guess it's too much of a security risk.
 
11:28 AM
have I left? weird, I left the room and was still here, still able to speak for a few seconds before I got booted out.
 
@AndyE - dunno, some knowns like the libraries would be nice though
 
@Nick: yeah, like Chrome could allow access to window.jQuery from a user script, for instance?
 
11:47 AM
yep
aiight back for the morning, dog walk complete
 
Hello guys :)
 
'mornin
 
I have a question... how do you code constructor functions that handle prototyped public methods and private variables at the same time ?
(wow... is my question understandable ?)
 
@Golmote Its a bit too vague. You make your constructor a closure and handle this.prototype as usual?
 
I mean...
How can a prototype method access to a private variable ?
function Constructor(params) {
var privateProperty = "I'm private";
}
Constructor.prototype.getPrivateProperty = function() {
return privateProperty;
}

This obviously doesn't work =°
 
11:59 AM
function Constructor(params) {
var privateProperty = "private";
 
@Golmote: do you need a separate closure for the "getPrivateProperty"-esque function? Can't you just move it to inside the constructor?
function Constructor(params) {
    var privateProperty = "I'm private";
    this.getPrivateProperty = function() {
        return privateProperty;
    }
}
 
bah shift-enter. I know that now
@Golmote like andy says, just move the prototype function inside the closure
 
stupid return key
 
(how do you format multiline code on this chat ? :( )
well, then the method isn't using the prototype... and so is defined for each instance
 
@Golmote treat the constructor as the class definition rather then a class constructor. i.e.
class { ... }
instead of
class { className() { ... } }
@Golmote use shift-enter to enter a newline in the textbox
 
12:02 PM
@Raynos I don't get it...
 
@Golmote I mean do what Andy does but with this.prototype.getPrivateProperty = bla
 
@Raynos Yes but with the "`" quotes, multiline code isn't formated...
@Raynos But then, the prototype function would be overridden for each instance...
 
@Golmote now I look like an idiot. thanks :)
 
... :/ I thought these quotes were used to format code... was I wrong ?
 
function classClosure() {
var privatevar = "private";

function Constructor() {
....
}
Constructor.prototype.lol = function() { .... }

return Constructor;
}
 
12:06 PM
Hm... privatevar is a "class" private property, then...
 
Another option is to not make the variable private at all, but just to label it differently. Many devs prefix "private" variables with _.
 
isn't it ?
 
function Constructor(params) {
    this._privateProperty = "I'm private";
}
Constructor.prototype.getPrivateProperty = function() {
    return this._privateProperty;
}
 
@Golmote yes in that case its shared among all objects my bad.
 
@AndyE Yes, that's an option... but I'd like to find the good way to do it... There must one... ^^
 
12:08 PM
@Golmote try some form of chaining. function Constructor() { ... }.prototype( ... ) ?
 
The only way I founded is something really awful :

(Grrr I don't understand how to format the code...)
var Constructor = (function() {
  var instances = [],
  initialized = false,
  getId = (function(n) { return function() { return n++; }; }(0)),
  initProto = function() {
    Constructor.prototype.getPrivateProp = function() {
      return instances[this.id].privateProp;
    };
  };

  return function(value) {
    this.id = getId();
    instances[this.id] = {privateProp : value};

    if(!initialized) {
      initialized = true;
      initProto();
    }
  };
}());
 
Tada! well done. now tell me how
 
The "fixed front" button ^^
 
@Raynos: indent each line with 4 spaces
1 message moved to Sandbox
 
@AndyE I did the chat removed whitespace :(
 
12:12 PM
strange...
@Golmote: there's no real way of achieving what you're trying to do.
 
multiline
     code
}
Oh turns out I can do it.
 
@AndyE Because all private properties are saved in the Array ? Yes I know... :(
 
@Golmote Your best option is too leave behind C#/Java style OOP and think in terms of Closures, first class functions & prototypical inheritance
 
Agreed.
 
@Raynos And so thinking in these terms, there's no way to use prototype methods to access private properties ?
 
12:15 PM
@Golmote thinking in these terms there is no private keyword. There is only encapsulation
 
@Raynos ... I don't like thinking about the user accessing all variables...
 
@Golmote front end is open source. user always has access one way or another
 
Hm.
 
OMG I love the efficiency of the new VaporJs framework
 
@Greg line up againts the wall. The rifle squad will be here soon
 
12:20 PM
too late, I'm running vapor - too quick for you!
 
@Golmote Now that I think about it theres no neat way of doing this :(
 
@Raynos :(
I got to go ;) See you later guys
and thanks for answering my strange questions :)
 
12:50 PM
Cool. My Object.keys implementation made its way into Kris Kowals es5-shim.js, and it's going to be in Prototype 1.7.0.1. github.com/kriskowal/es5-shim/blob/master/es5-shim.js#L390
 
@Golmote I get it now. Trying to have a single prototype access the right private variable for each object doesn't make sense. Thats just not how closures work. that single getter function refers to a single private variable. It couldnt possibly refer to each private variable of each object. So it just can't be done.
@AndyE :) well done
 
@AndyE grats man
 
ta :-)
 
i don't want to mention names, but you notice that some people are posting outside their expertise? posting just very bad answers in a given tag?
 
@NickCraver: hasn't that always been the case? (also not mentioning any names)
 
1:05 PM
i'm sure it happens in all tags, i just notice javascript/jquery gets one occasionally, and almost every answer is just flat out wrong :-/
 
var f = {};

var local = f.something;

f.something = function () { alert("func"); };

local();

Can I get local to evaluate lazily?
 
@NickCraver: it's worst when they get upvoted several times before anyone notices.
@Raynos: if I understood you correctly, f.something = function () { ... } -> function f.something () { ... };
 
aye, very bad when that happens
have to flag them with big bold comments in hopes people know not to use the answer, my favorite is "$(":not(#id)") should handle all clicks outside for closing!"
 
S****z was one such user. I bet he has one of the highest deleted post ratios of all users.
loool
 
completely unrelated, I love Jin's tweets:
How did they call Batman during the day?
 
1:10 PM
lol
 
follow @jzy for a good time :)
 
@AndyE the reason I have f.something is so I can pass functions in by string and call them as f[string]();

The general question is can I do lazy evaulation in javascript?
 
via the BatMobile (phone, not car :p)
 
@Raynos - can you define "lazy"?
people have very broad definitions there
 
just what I was typing.
what I posted before hoists the function definition, it doesn't change how you call f.something.
 
1:15 PM
I'd call something you for kicks
 
var f = {};
var local = f.something;
function f.something() { alert("func"); };
local(); // works, because function declaration is hoisted.
 
however you could do:
var local = f;
f.something = function () { alert("func"); };
local.something();
 
// This is another alternative
var f = {};
var local = function () { f.something() };
function f.something() { alert("func"); };
local();
 
to call local() directly you'd have to change how non-objects are passed in JavaScript
@AndyE - pretty sure you can't have a . in a function name
 
hmm, it works in IE.
 
1:20 PM
i want you to go to the corner and think about what you just said
 
yes, sir. puts on dunce hat
stupid IE, making me think something was legitimate syntax grumble
// This is another alternative
var f = {};
var local = function () { f.something() };
f.something = function() { alert("func"); };
local();
that's what I meant anyway :-P
 
maybe var local = function () { f.something.call(this, arguments) }; to maintain context?
 
The idea was to simply evaluate an assignment lazily when it is called rather then when it is assigned :(
I'd much rather avoid the need for lazy evaluation then emulate by wrapping it in a anonymous function
for some reason I thought that if you assign to a property of an object it would be done lazily. I don't know why I thought that.
 
@Raynos - you are evaluating it when it's called, what you're assigning when it's assigned is the issue :)
you're getting a copy, not a reference to a reference
 
@NickCraver yep, if that's the intention, but you'd want apply rather than call if you're passing arguments.
 
1:30 PM
errr yes absolutely right
 
@NickCraver does it really make a copy? I thought it was all by reference.
 
I almost never use arguments directly
@Raynos - if you have a variable, and you set another variable to that one, you get a copy, unless it's an object, etc
 
jQuery must use the hell out of arguments - there are so many different "overloads" for most of the api methods
 
at the time you assign it you're setting local to undefined, since f.something isn't defined...so even if it was a reference pass, it has no reference at that time either
@AndyE - kinda, more of parameter shifting in most cases, the overloads are carefully chosen
 
@NickCraver I would hope that it just refers to it as some property of f. and goes looking in f when its used.
 
1:32 PM
e.g. if arg2 is function then...
 
@AndyE The userscript thingy I'm working on uses the hell out of arguments, for the same reason
 
@NickCraver: yeah.
 
@Raynos - it doesn't have that property though, it's not defined :)
 
@YiJiang: I've used arguments recently for my console app, certain functions allow an unlimited number of arguments to be passed.
 
@NickCraver but cant i give it a flag saying "i'll promise it has this property before I ever use it"
 
1:34 PM
@Raynos - sure, but that will involve writing an off-spec JavaScript engine and a browser to run it :)
 
@NickCraver I'll just write a javascript parser for LISP and write in lisp. That would be easier
 
make sure to get spare paren keys for the keyboard
they wear out 200x faster when writing lisp
 
@Raynos: you should call your implementation JSSSScript
 
@AndyE dont get the joke
does JSON.parse cry if I have \n & \r in the JSON string ?
 
JThcript might be more appropriate for LISP ?
 
1:37 PM
nope, it'll parse it as a string with returns anew new lines
you have to actually have \n and \r though, not actual returns and newlines, as you'll get a unterminated error
 
@AndyE haha :D
 
is there some kind of online JSON structure validator?
 
@NickCraver thank you
forgot to wrap 'name : value' into '"name" : "value"'
 
1:47 PM
hmm, I wonder if I could pack jsbeautify into a bookmarklet.
 
How wide is the support for JSON.parse & JSON.stringify in browsers?
 
@Raynos IE8+
for IE7 there's JSON2
 
@NickCraver json2.js ?
 
it'll define JSON.stringify() and JSON.parse() only if native methods aren't already available
so include that, and just use JSON as needed, it'll add in the natively-missing bits
 
1:55 PM
who owns json.org ?
 
you know the orange midgets from willy wonka?
 
@NickCraver I am under the illusion crockford is responsible for the json.org website.
 
might be, I've honestly never cared to look, it has the same look/feel of his sites though
 
Is there a stringify version of jQuery.parseJSON ?
 
JSON.stringify() :)
 
2:03 PM
._.
 
but no not really, it'd be added strictly to support IE6/7 for the most part, and it's not worth the weight since json2 is readily available (and recommended by the jQuery team)
 
Then why does jquery have $.parseJSON ?
 
@Raynos ._. :| .-. |:
 
because getting JSON is much more common, and is almost no code in the core library
 
I'm fairly sure Crockford owns json.org, since it was his idea in the first place.
 
2:05 PM
see how little code is required? :)
 
@YiJiang |: .-. :| ._.
@NickCraver I see how small it is. For some reason I expected converting to JSON to be equally common
 
@Raynos - $.getJSON() for example is used like crazy...personally I sent JSON much as much, but for a lot of users they're just getting/using JSON/JSONP
 
Ah jquery just does eval(jsonString)
 
@NickCraver Wait... how does (new Function("return " + data))() parse the JSON?
 
@NickCraver I remember seeing that code before and wondering, "why doesn't it check for native JSON first, before running 3 string replaces?"
 
2:07 PM
@YiJiang that is pretty much return eval(data)
 
@YiJiang - it doesn't, it evaluates it, it uses the native JSON.parse() if available.
 
@AndyE the code lookers neater. Who needs efficiency
2
 
it's faster in most browsers actually
the replaces are in place to ensure there's valid json, so JSON.parse() won't blow up
 
@NickCraver Yeah, but isn't that just replacing the browser's error message with jQuery's own?
 
sometimes, yes, but step back for a second and look at it a different way
exceptions are expensive :)
 
2:11 PM
Also, if json2.js is present, those checks will be run twice.
 
what checks?
 
the 4 regexes
if ( rvalidchars.test(data.replace(rvalidescape, "@")
			.replace(rvalidtokens, "]")
			.replace(rvalidbraces, "")) )
 
true, but only in older browsers
 
fair enough, I guess. It just seems odd. Although I can understand the desire to avoid a try/catch.
 
also they're less expensive the second pass, since there'll be no matches
 
2:14 PM
try/catch is slow (at least in Carakan, I can't remember about V8/Nitro…), as it stops the function from being JIT'd.
 
also true. And I guess JSON parsing isn't the kind of thing you do in a loop, so any performance hit will be more or less unnoticeable.
 
(I don't think it's so extreme in Nitro, but it's still not quick.)
(And v8 doesn't have an interpreter, so it must JIT it so some extent)
 
it use a JIT compiler, same reason with performance takes a hit
 
It's the scoping that adds the cost… I'd be surprised if it didn't do large amounts of it by calling C++ functions, as you'd end up generating quite a lot of code for each try/catch or with.
 
2:29 PM
Isn't that a bug in jquery?
well not a bug
but it's like it could be improved
 
@PabloFernandez improved only in certain cercumstances.
 
/me wishes JS wasn't so horrible to compile
 
@Raynos the most common circumstances
*circumstances
 
I think it would require benchmarking for us to say one way or the other
 
@PabloFernandez Use the edit button!
 
2:34 PM
@YiJiang Thanks!
@AndyE usually I'm in favor of benchmarking before saying that some code is faster than other
but when it is running code vs not running code, it's pretty obvious
 
@PabloFernandez: The problem is, without running those checks a try/catch is required.
 
@AndyE yeah that path might be slower
but it's the exceptional path, properly said
I mean suppose that codepath happens 2 times out of 10
it's a tradeoff, you speed the common case and slow the exceptional case
 
try/catch in general makes stuff slow.
 
@PabloFernandez: yeah, that's one of the reasons I brought it up in the first place.
 
I expect try/catch would make the common case slower than the if statements
 
2:39 PM
@gsnedders: I think that depends on the regex implementation. We're not talking simple equality checks here.
 
@AndyE regexp are quick in all JS impls nowadays
(well, unless you use backreferences, pretty much)
 
@gsnedders you mean it will slow the code in the try block even if no exception is thrown?
 
@PabloFernandez Yes
 
@gsnedders oh, good to know, that makes sense then
I believe you ( I really do ) but is there some evidence of this?
 
I don't have anything I can link to off hand :)
 
2:42 PM
aside from me running benchmarks (which is something I cannot do right now)
alright :)
thanks for the tip
 
/me tries benchmarking, then wonders why Carakan is so slow comparatively… then realizes he's using a debug build
Okay, so ignoring Carakan seeming I don't have a (release) shell, JägerMonkey shows almost no difference, V8 and Nitro both have around a 25% slowdown.
/me vanishes
 
2:57 PM
I'm sending an object converted into JSON to a C# webmethod. its paramater type is "object" can I give it a more useful conversion to some kind of dictionary?
 
03:00 - 15:0015:00 - 00:00

« first day (11 days earlier)      last day (4952 days later) »