« first day (107 days earlier)      last day (4836 days later) » 

1:30 AM
Anybody home?
home hom ho h h...
 
1:47 AM
Hey
 
@Raynos how are you?
@Raynos up for some absolutely shameless plug??
:)
(how can you say no to that simley face)
Can this chat be used for shameless plugs :)
 
@Trufa always!
 
@Pekka nice! is there anyone here that know anything about jQuery :P (is there a doctor in the room, for god sake the man is dying!)
 
@Trufa kind of... not really a Guru. Why?
 
@Trufa go for it.
kind of writing a wall of an answer
 
1:55 AM
@Pekka jeje ok, see muycorto.com
I having big time confusion over somthing
 
Right, I'm there
 
well
its a mini url shotner
if you write an url
 
right
 
and press enter
(not the button)
everyting works correctly
even the thingy in yellow
which copies on click
 
Right
 
1:57 AM
Zeroclipboard
0
Q: Zero Clipboard Doesn't work when it's called dynamically

TrufaFor coping to the clipboard I'm using Zero Clipboard, recommended by this answer. The code works perfectly fine when used in this form. <div id="d_clip_button" style="background: #FFFFCC;"> Click to copy </div> <script language="JavaScript" type="text/javascript"> ...

 
@Tufa its 2am so no.
 
but if you do the jquery call
jaja
@Raynos thanks anyway
!!
 
Ah I see
hang on
looking at the request
 
thank you oh so very much
 
You are setting the HTML using innerHTML =
 
1:58 AM
!
 
I think that doesn't execute Javascript
 
hmmmmmmmm
 
One of the jQuery thingies does, I think .html() executes it
Hang on I'll check
I can't find anything on it, but I think .html() executes Javascript.
 
Shameless counter plug!
0
Q: Question about jQuery source == on window

Raynosdata: function( elem, name, data ) { if ( !jQuery.acceptData( elem ) ) { return; } elem = elem == window ? windowData : elem; Copied directly from the jQuery source. Why is it not safe to use elem === window? Why does jQuery use type coercion on the window object?

 
So try
 $("#resultado").html(msg);
instead of the innerHTML call
 
2:01 AM
@Pekka i'm on it!
 
btw, you can change
var tosend=document.getElementById("longUrl").value;
to
var tosend=$("#longUrl").val();
 
Cant believe I spent 40 minutes going through JSLint errors..
 
for true jQuery style :) (It's not necessary though)
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
40 messages moved from Town Hall Chat
 
@Pekka
hi
 
2:11 AM
Hi! Well, this worked well.
That is a nice feature.
 
@Pekka what am i doing seriously wrong now
 
@Trufa the JS is outside the script tag I think
 
@Pekka youve mayde me a happy man!
wanna earn some quick points
 
@Trufa very nice. Works for me too
 
??
 
2:15 AM
@Trufa no thanks, not for this if that's what you mean
 
0
Q: Zero Clipboard Doesn't work when it's called dynamically

TrufaFor coping to the clipboard I'm using Zero Clipboard, recommended by this answer. The code works perfectly fine when used in this form. <div id="d_clip_button" style="background: #FFFFCC;"> Click to copy </div> <script language="JavaScript" type="text/javascript"> ...

 
Ah I see
there was a question already
 
no no
nothing of sockpupettry
hehe
(but glad you declined)
 
Yeah. I answered it
Well! I have to get back to my taxes :)
Have a good night and see you!
 
@Pekka thank you very much you brilliant mind!
you'll have my points
!!
 
2:19 AM
@Trufa no problem. See you later then!
 
see you to
 
Oh btw,
in The SO Tavern (General), 9 mins ago, by Justin 'jjnguy' Nelson
@Pekka That indeed is me. (in my pic)
 
 
3 hours later…
Tek
5:17 AM
Hi, anyone around?
 
 
4 hours later…
9:05 AM
Bronze javascript badge. Feel like its a minor achievement
 
 
2 hours later…
10:44 AM
Cool someone is there
 
@drlouielouierd [Great... a little confusing though.] yes I'm here, shall we talk by editing our text to save space?
 
sounds like a good idea
Anyone up for some debugging? Ajax, YUI, jQuery, Drag-n-Drop, Carousel?
It's a memory consumption issue, the carousel starts to slow down as more and more items load over time.
 
@drlouielouierd what's the link?
 
I'm kinda tired of looking at the carousel so I will delegate it to anyone who cares, at this point i dont lol
im working on other stuff
 
@drlouielouierd ha ok, I'll leave it open with the profiler open to see where the problem is
@drlouielouierd ..... why why WHYYYY is the right click menu disabled???
 
10:52 AM
nothing loads automatically... you must click the right arrow to scroll through items and this is when it starts slowing down
was going to implement my own...
 
its ok I just opened it using the menu
 
good to go, yeah much easier to tell whats going on with right click :P
 
out of curiosity, why have you disabled the context menu?
 
was going to implement my own...
like my interfacing?
all hard coded.... front back db processing everything on unix
 
@drlouielouierd I am not noticing any slow-down, and the cpu profiler doesn't show anything too high... neither does the heap snapshots
 
10:56 AM
ahh sounds wonderful
glad to hear it
the snapshots is what I was most concerned about... data is easier on memory by all standards
anyway its drag n drop.... other custom scripting does other cool stuff with the templates and with other parts of the site...
 
11:33 AM
Thank you for your help Greg!
 
11:48 AM
IE:
window == top; // true
window === top; // false
What is IE doing?
 
11:59 AM
@Raynos being IE
 
12:33 PM
@Greg explain to me why triple equivelance does not work on window & top
or window === window.window; // false
 
12:53 PM
@Raynos I can't explain ... I'm trying to figure it out myself.
 
1:45 PM
>>for (var i in frames.console) frames.console.log(i);
LOG: log
LOG: info
LOG: warn
LOG: error
LOG: assert
LOG: clear
undefined
@Greg check the SO question. It's because window.external is a bitch
 
1:59 PM
a javascript function equals to is_numeric in php?
 
@Karem typeof x === 'number'
 
thanks
how can you disable a link ?
anchor link
 
@Karem By removing the href attribute?
 
if there isnt a href attribute
 
2:08 PM
Then it's not a link
 
CQFD.
 
no but it executes a ajax request
and i wish to disable it after once
 
Then why are you using a link?
 
@Karem If you're using jQuery, you can use one.
Else, you can probably delete or detach the event handler, depending on how you attached it
 
unbinding it..
thanks!
 
2:36 PM
@yijiang im trying to before ajax request $('.removeAlbum').unbind('click'); and in the success of ajax request, $('.removeAlbum').bind('click');.. but then it doesnt run the function that its inside
 
It may not be polite but RTFM.
 
Has anyone written a working wrapper for console.log in IE ?
 
Hi! :)
 
Someone else took care of Friday for us
1
Q: Make an application that determines if a sequence of numbers is sorted

YSNYet another installment of the weekly code-bowling game as the previous incarnation is over a week old and fairly well explored by now. As a refresher: Code-Bowling is a challenge for writing the most obscure, unoptimized, horrific and bastardized code possible. Basically, the exact o...

 
I've recently discovered that there is a const keyword in JS. Is this a new ES5 thing? It seems to be the same as var, but triggers a TypeError if the variable is already declared. In non-strict mode, it only triggers on built-in variables, but in strict mode, you can even check for jQuery, like this:
(function() {
    'use strict';
    var errorFlag;
    try {
        const jQuery;
    } catch(e) {
        errorFlag = 1;
    } finally {
        if (errorFlag) {
            // jQuery exists
        } else {
            // jQuery doesn't exist
        }
        delete errorFlag;
    }
})();
 
2:50 PM
@Karem Just use one
 
$('#foo').bind('click', function(event) {
  alert('This will be displayed only once.');
  $(this).unbind(event);
});
Hmm. Not $(this).unbind(event.type)?
It works either way.
 
Hrm, trying to build a singleton are we? In a language that doesn't have the necessary bindings to build a true implementation...?
 
@ircmaxell my hero \o/
 
@Shikiryu: ?
 
does anyone know what bytes are in a RECT?
 
2:57 PM
@ircmaxell How are you ? :)
@Greg UM?
 
@Shikiryu sorry I meant to ask in the C# room
but... do you know?
 
no.
 
I'm good. But I'm a little bit preturbed. Why am I your hero?
 
You are the PHP savior!
 
@ircmaxell have you managed to escape the barcode factory yet?
 
3:01 PM
foo --(< ingore me

>> bar <<

<?php code('makeFactory'); ?>
 
@Greg: Nope
@Shikiryu any specific rationale behind that?
 
Hey all, this may sound like a stupid question, but why is the slice method only a method of an Array object. The reason why I ask is because if you want to use it for the arguments property of function object, or a string, or an object, or a number, you are forced to use Array.prototype.slice.call(). And by doing that, you can pass in any type of primitive or object into it. So why not just default it as a method of all primitive and objects?
function Core(){

var obj = {a : 'a', b : 'b'};
var num = 1;
var string = 'aff';

console.log(typeof arguments);//Object
console.log(arguments instanceof Array);//false
var args1 = Array.prototype.slice.call(arguments);
console.log(args1);
var args2 = Array.prototype.slice.call(obj);
console.log(args2);
var args3 = Array.prototype.slice.call(num);
console.log(args3);
var args4 = Array.prototype.slice.call(string);
console.log(args4);

var args = arguments.slice(0); //arguments.slice is not a function
 
@ircmaxell no.
Sorry.
 
oh ok
 
I won't do it anymore.
 
3:10 PM
See how I am forced to use prototype.slice.call. Why not just default as a method so arguments.slice would work?
thanks for response
 
was just curious
 
I mean I know that primitives can't have methods, but I know behind the scenes when you call a method on primitive, there's a corresponding object for that primitive that has a bunch of methods prototypes. So why not just add it to those prototype methods by default rather than forcing somoeone to use prototype.slice.call?
 
how can i remove a option in a select ?
with js
 
@Karem Remove an option or deselect it?
 
if i have
<select id="albumPicker">
<option value="1">1</option>
<option value="2">2</option>
</select>
How
How can i remove the option with value 1
remove av option
 
3:21 PM
$('#albumPicker option[value=1]').remove();
 
ok and if theres a variable for the value it should remove
$('#albumPicker option[value='+variable+']').remove();
yup that worked
thanks
 
@Karem I think I told you yesterday to use fixed font for codes. Post them like this:
How can I do XY? I've tried this:
 
bla
 
$('p').click(); [Press CTRL+K before sending the code]
@Greg you can only do one in a post

Sandbox

Where you can play with regular chat features (except flagging...
 
@Nyuszika7H damn, I was trying to write boobies
 
3:40 PM
So i'm reading this book and the author says this block of code should work:
var alien = {
sayHi: function (who) {
return "Hello" + (who ? ", " + who : "") + "!";
}
};
sayHi.apply(alien, ["humans"]); // "Hello, humans!"
I try to run this on firefox and I get undefined sayHi method error
 
whats the opposite of display : none
 
The same exact block of code
 
display: display?
 
display : block??
inline
inline-block
 
thanks
 
3:42 PM
np
 
If my understanding of apply is correct, the fact that alien is local scope and not global scope now, and there's the sayHi method within that scope, it should work.
But firefox says otherwise
 
what book is it?
 
JavaScript Patterns
 
I dont see how anything could see the sayHi method
 
You gotta love it. No upvotes or anything to any answer, although each actually answers the question (at least from my standpoint)
 
3:47 PM
alien.sayhi works fine
 
0
Q: substr md5 collision

Neel BasuI need a 4 character Hash. At the Moment I am substr'ing first 4 characters of md5() hash. I am hashing a <= 80 characters long string. would that lead to collision ? or how much is teh chance of collision ? assuming I'll hash < 65,536 (16^4) different elements.

 
It's under the section titled Function Application (Currying)
His point is that by using sayHi.apply(alien, ['hello']) - that there is a sayHi method of the alien object and since we specify alien as the scope using apply, then the method should be repointed to this object where it would be found.
Is his interpretation of the apply() method incorrect?
Because this does not work in Firefox at all and I haven't tested it in any other browser.
 
chrome it doesnt work either
 
So then what does the first parameter of apply do? I thought that refers to what "this" is pointing to?
and "this" should be referring to alien, no?
 
weird.. idk, im reading the section right now
 
3:53 PM
The book is good otherwise. But that throws me off big time.
 
yeah thats pretty weird
read it over like 5 times, i understand what hes saying.. it just doesnt work
 
@ircmaxell Again, you made me learn something today :)
 
i just dont know how anything could see sayhi, to even apply alien to it to begin with
and the browsers seem to agree
 
Oh yeah?
Good! (I still need to learn something today. Time to go browsing!
 
I was unaware of the Birthday paradox.
 
3:56 PM
Yeah, it's an interesting statistical side effect...
 
Opera doesnt like it either @JohnMerlino
maybe ie.... lol
 
I think the idea was that alien is an object in the global scope and that apply method is called in the global scope, so that it can see alien and then force "this" to refer to alien, and therefore the sayHi method would refer to the alien object, where it is defined.
I copy and paste this from a website: The apply method allows you to call a function and specify what the keyword this will refer to within the context of that function. The thisArg argument should be an object. Within the context of the function being called, this will refer to thisArg. The second argument to the apply method is an array.
So based on that definition, Soyan Stefanov's code block should indeed work. But like you saw, none of the browsers support it.
Also, to the first topic I mentioned earlier, I think the reason why slice is not a default method of all object instances (Array, Number, String, etc) is because the designers of the language wanted to make the code consise and figured that if you want to access the method for another instance, then you just have to use call rather than having them duplicate the same method in multiple constructors - forcing the language itself to be larger.
 
4:22 PM
@JohnMerlino the book is wrong
.apply runs a function and set's this inside the function as the first argument of .apply It does not allow you to invade scope.
 
@JohnMerlino when in doubt "google: apply mdc"
 
5:10 PM
IE...
 
5:24 PM
Hi there! :)
Hmm. If I'm using SEChatModifications, I need to delete the `$.livequery.run()`part and call that function manually, this way, the chat works properly.
 
Word up @Ivo
 
Had some issues with quirks mode and JS
 
Nice
 
Oh and IE <9 does not keep track of global var statments
it parses them per file
which made things explode...
 
Nice
 
5:30 PM
if (not browser...) {var Class = require...}
 
(function() {
    'use strict';
    var errorFlag;
    try {
        const jQuery;
    } catch(e) {
        errorFlag = 1;
    } finally {
        if (errorFlag) {
            // jQuery exists
        } else {
            // jQuery doesn't exist
        }
        delete errorFlag;
    }
})();
 
did override the included definition in the previous file -.-
 
any comments?
 
why is use strict in quotes?
 
why delete error flag?
it's a pragma
 
5:32 PM
@IvoWetzel hmm, it's like a cleanup, not sure if it's needed to delete it
 
and otherwise it wouldn't be backwards compatible
it will fall out of scope and get gc'd, no need for delete here
 
@ircmaxell to prevent errors in ES3. also, use strict without quotes returns SyntaxError: Unexpected identifier, even in ES5
 
OK the final problem... the test doesn't work in IE6...
 
Ahhh ok
 
anyone has a real IE6 handy? This IE Tester thing doesn't give me any error at all...
 
5:35 PM
I do @Ivo
 
could you give it a try? :)
The page stays blank here... but this "IE5.5" thing works...
 
hrm
give me a few
my IE6 server doesn't seem to want to let me on...
There we go
(I don't like running IE6 as a domain administrator, so wanted to be sure I logged in as a non-priveldged user)
 
That's understandable
Oh and debugging with IE9 is really stable... not
crashed 5 times in 20 minutes
 
ahhhh, then it's a bug of this IE Tester thing :)
 
5:47 PM
That's 6.0.3790.3959
Which IE tester thing?
 
Yeah, that doesn't actually test against IE6, just the rendering engine that was pulled out
 
well nearest thing I can get on this Win7 starter "OS"
 
Well, you can't get anything else
 
Which sucks
 
5:51 PM
experience has taught us that nothing can replace IE6 installed on a comp, and IE7 installed on a comp
those testers come close, but it's not 100%
 
MS should provide a solution for testing though...
 
So we have a few VM servers that are dedicated to old version IE and FF testing (FF 2.0 and IE6 on one server, FF 3.0 and IE7 on another)
It would be nice if MS took responsibility for their actions, but that's going to be a great day...
 
there's a guy that complains about this on every entry of the IE blog
 
yup
 
enough of this windows stuff...
I can't stand the OS any longer
 
5:54 PM
yeah
 
how to create a full screen web-page in iphone? also want to hide the address bar
 
Make an app
 
afaik that's only possible when a user adds it to the home screen
 
how to get the height of screen, so that can create body of same height?
 
@coure06 You can use screen.availHeight, though it's better to use window.innerHeight. But you should make it 5 or 10 pixels smaller anyway, to avoid unneccessary scrollbars. Though it's better to use
Maybe something like this:
window.onresize = function() {
    document.body.width = window.innerWidth - 10;
    document.body.height = window.innerHeight - 10;
}
Or with jQuery:
$(window).bind('resize', function() {
    $('body').css({
        width: window.innerWidth - 10,
        height: window.innerHeight - 10
    });
});
> John Resig == awesome but Douglas Crockford === awesome.
 
6:22 PM
> When you search for help online, one of the first results is often W3Schools (which I'm explicitly not linking to here). The short version is that it sucks. It's full of errors, it's missing information, and while it's not 100% useless it isn't a good resource. Avoid it. For the long version, visit W3Fools, a site put together by the jQuery team (and some other helpers).
 
hey thanks @Nyuszika7H never heard of w3fools
i also avoid the heck out of w3schools
 
I didn't know the jQuery team put together that site… until now.
(reading Learn To Code: The Full Beginner's Guide on Lifehacker – no, I'm not a beginner, it's just interesting :P)
 
Nice, im actually planning on teaching my son shortly
 
6:48 PM
@raynos thanks for clarification on apply
 
@JohnMerlino no biggie
 

« first day (107 days earlier)      last day (4836 days later) »