« first day (955 days earlier)      last day (4218 days later) » 

10:00
dude
you gotta spend more time on irc
heh, I remember the first program I wrote
an irc bot in C
had to make the sockets myself et al...
it was fun
btw. none of those involved was me. :)
you're not firebot?!
10:17
Is this a clean code guys?
$('.unfollow').live('click', function() {
$($(this).closest('.button')).attr('class', 'button small follow');
$($(this).closest('.button')).css('color', '');
$($(this).closest('.button')).html('<i class="icon-plus-sign"></i> follow');
});
@Arthur no.
@Arthur no.
live is deprecated and removed from 1.9
that's not what I saw first.
Can you tell me whats better or not?
10:19
heh, Sparkman. :D
wtf is the caching?
Use on instead of live
You repeat $(this).closest('.button') three times. Either store that in a variable or use chaining.
$('.unfollow').on('click', function() {
    var button = $(this).closest('.button');
    button[0].className = 'button small follow';
    button.css('color', '');
    button.html('<i class="icon-plus-sign"></i> follow');
});
Instead of setting the class attribute, you might want to use addClass
@FlorianMargaine $(document).on('click', '.unfollow', ...
10:22
excuse me where I can read all information where is deprecated and removed because also $.browser.msie
@FlorianMargaine given Arthur's code, I bet .unfollow does not exist on page load
@MirkoCianfarani api.jquery.com
ehehe on the site's original, how i am stupid :P
var button;

$(document).ready(function() {
$('.unfollow').on('click', function() {
button = $(this).closest('.button');
button[0].className = 'button small follow';
button.css('color', '');
button.html('<i class="icon-plus-sign"></i> follow');
});
});
10:25
formatting please. CTRL+K
@Arthur you will need to follow @JanDvorak advice about page load
@Arthur ... unless .unfollow exists on page load
in Italy we have a superhero who spreads the shit or pie or poop
http://translate.google.it/translate?sl=it&tl=en&js=n&prev=_t&hl=it&ie=UTF-8&eotf=1&u=http%3A%2F%2Fnonciclopedia.wikia.com%2Fwiki%2FShpalman
there isn't site in english of this superhero... :(
@JanDvorak yeah, sorry I should have included that.
10:30
@mikedidthis @JanDvorak I'm sorry, i don't understand
@Arthur does .unfollow exist on page load or is it loaded in later?
@Arthur if new .unfollow elements are being added dynamically, you need to use $(document).on('click', '.unfollow', ... instead of $('.unfollow').on('click', ...
@mikedidthis That depends
then use delegation.
@Arthur just follow what @JanDvorak says, he has a better understand and explanation than I do.
10:33
event delegation = let another element (here, document) receive the events and filter them, since you can't bind an event to something that doesn't exist
I asked this question before, I am asking it again to confirm.
Which book should I buy to understand javascript ?
I was thinking to buy "rhino book"
BTW, I am beginner with good programming concepts
@Mr_Green If you already know some JS, probably 'The Good Parts' it's a one day read
(Just around 200 pages iirc)
ok will that cover complete javascript?
Morning Folks!
I have a class file, and I want to call a function from this class file which returns an array. How to do this via jquery
your typing speed is very fast
10:37
@Mr_Green It will cover the good parts.
ya the name says that.. foolish question :)
@Mr_Green That is typed before hand!
@udaysagar troll.
@OctavianDamiean I see what you did there :)
10:38
@mikedidthis I'm brilliant. My deduction skills are unmatched.
ok thanks all
@mikedidthis I'm also not arrogant at all.
@Mr_Green I think to answer your question. Both the 'rhino' and 'butterfly' books would be a good read.
@OctavianDamiean No one thought you were?
whoze gonaa answer my question.....
@mikedidthis I did. :D
10:41
shortly- How to call a php function via jquery
@udaysagar You don't call anything from jQuery. jQuery is just a JavaScript library.
sorry, AJAX
@OctavianDamiean oh. :)
Well, that's a completely different question.
I heard of $.post
and i called a php file
via $.post
10:42
It depends, to you have data to send to the back end or do you just want to get data?
but how to call the function of a class file
the function actually performs the sql query and returns the data(perferable an array)
preferably*
Wait, what?
I don't care what your PHP function does.
@JanDvorak Is this the correct way?

$(document).delegate('click', '.unfollow', function() {
	button = $(this).closest('.button');
	button[0].className = 'button small follow';
	button.css('color', '');
	button.html('<i class="icon-plus-sign"></i> follow');
});
You could use on instead of delegate. It's the modern way.
@udaysagar What is your question now? How to return data from a PHP script or how to call the PHP script?
10:46
Not sure what @FlorianMargaine has against .attr("class", ...), but what I have against it applies here as well: you remove any existing classes.
Also, I'm not particularly happy you're using the <i> element, but I can live with that
@JanDvorak That's due to Bootstrap.
@OctavianDamiean what is, the i?
Outside $(document).ready(function() { }); ?>
It is Bootstrap's abuse of the italic element for an icon element.
ok I will buy "rhino book" first
then I will go with "butterfly book" later
10:49
@OctavianDamiean how to call the php script
@Mr_Green You should do it the other way around ...
@OctavianDamiean ... oh o-o
@OctavianDamiean I'm still not happy about that :-/
you mean first "butterfly" then "rhino" ? (just confirming)
10:51
Outside or inside the document ready, it doesn't work
@udaysagar If you just want to get data from it you can go for $.get()
0
Q: How to define optional parameters in Java Script

AnonymousHere is my object construction, function Employee(name, dob) { this.Name = name; this.DateOfBirth = new Date(dob); } Now, I have created an instance for this, like var emp = new Employee("sample","12/12/12"); Its working fine when i print the output. But, if i create the o...

@Mr_Green Yup.
@Mr_Green Yeah I think that would make sense. Butterfly will take you a week.
ok thanks guys
thanks to benjamin too :)
10:52
@Arthur fiddle please jsfiddle.net
@OctavianDamiean I dont think you are getting me..
i used post
look at the code below-
  $.post("check_username.php",
  {
    username: $(this).val()
  },
  function(data,status){
if(data == 1)
{
   document.getElementById('un').innerHTML='<font color=\"green\">Username Available!</font>'+type;
  //  alert("Username exists");
    flag = true;
}
else
{
   document.getElementById('un').innerHTML='<font color=\"red\">Sorry, Username already taken!</font>' + type;
//alert("Sorry, Username already taken");
flag = false;
}
  });
@JanDvorak Well, yea, you gotta tell Mark Otto about that.
Just a question someone might want to answer!
But Now the check_username.php is a class file and the logic is transferred to a function
and now i should call that function instead
did you get me?
10:54
I have no idea what a "class file" is in that context and if it is PHP then you are in the wrong room to ask.
class check_username
{
public function i_should_call_this_function()
{
}
}
Hope you get now...
> ... if it is PHP then you are in the wrong room to ask.
there's nothing like that built into PHP
@phenomnomnominal cool, answered
and before calling such a function, we need to create an object, isn't it?
10:58
I am the dumbest programmer in the world
@BenjaminGruenbaum, nice, good answer
Who certified you? @TemporaryNickName (Just joking!)
I went to another programming competition today and while everyone was solving hard questions that can get them a movie ticket, I was solving easy questions and ate whole bunch of lollipops
@OctavianDamiean Precisely. Everything in this room is off topic except javascript.. and everything else with the exception of PHP.
@rlemon I do, yeah
11:01
@Neil Well, I'm just gonna say this, there is a PHP room, he should use it if he needs PHP assistance.
@TemporaryNickName that's how I got my rep on SO
@OctavianDamiean Well I mean he could use this room, though it probably wouldn't result in any good. Though he'd still learn something.
@JanDvorak Nice job, but my belly doesn't feel well
@udaysagar I'll say it again, go join the PHP room and ask there as your question is not related to JavaScript in any way and we're never discussing off-topic stuff in here, except when we do but now we don't except if we do.
I was proud to use Javascript while everyone else was using Java or C++ or C
One judge came to me and asked me "are you using HTML?" so I told him "No it's Javascript r-tard"
11:05
@phenomnomnominal Thanks
@TemporaryNickName See, that's why you didn't win.
@JanDvorak i'm sorry, this was the problem:
$('.follow').on('click', function() {
	$($(this).closest('.button')).attr('class', 'button small unfollow');
	$($(this).closest('.button')).css('color', '#008000');
	$($(this).closest('.button')).text('following');
});

$('.unfollow').on('mouseover', function() {
	$($(this).closest('.button')).css('color', '#FF0000');
	$($(this).closest('.button')).text('unfollow');
});

$('.unfollow').on('mouseout', function() {
	$($(this).closest('.button')).css('color', '#008000');
Why did you call him an r-tard? You should have called him a retard.
One doesn't simply misspell retard ... without looking like a retard. (imagine picture of Sean Bean)
r-tard is an euphemism of retard basically.
11:09
hah, imagine image ...
it is a way to call a retard retard w/o the retard noticing
!!/YouTube hangover retard
!!/tell tempor eval [1,2,3].sort
!!> [1, 2, 3].sort()
!!/live
11:10
anyone with android page curl knowledge by harism
That isn't even a sentence.
@prateek huh?
not even "is there anyone here with android page curl knowledge by harism" is a sentence
I rubber duck majestically pants absorbed.
11:12
oops sorry for the typo
See, I can do that too.
Anyone with android, page "curl knowledge by harism".
posted on May 28, 2013

Just now I noticed a Twitter discussion on packaged web apps and their purpose. The same question was asked during the Mobilism panel, and I still regret not speaking up and explaining. So here it is. The point of a packaged web app is to allow for its peer-to-peer transfer from device to device. A user has a nice web app and proudly shows it off to friends. They also want it, so the user o

did you mean "is there anyone here who has the book 'android page curl knowledge' by mr. Harism?"
I am in a fix
don't make fun
11:13
I'm just asking what you meant
nope I don't mean that I just meant who has tweaked it somewhere
You're more like a drunken Yoda than a fix.
@prateek are you tweaked?
@phenomnomnominal :( leaving
enough
o_O
11:14
@prateek, I will weep for you.
@prateek You'd better try to be clearer instead.
@phenomnomnominal ok then lets make it clear
so anyone who has forked this project github.com/harism/android_page_curl
Never heard of that project
@prateek Uh, do you want to achieve a similar effect using JavaScript and CSS?
@OctavianDamiean nope I just want to edit the same codebase just to suffice my needs
11:18
@prateek What are you doing in here then?
@OctavianDamiean trying to find someone who has already done it earlier
Seriously, you came to the JavaScript room to find someone who deals with Android (Java) stuff?
@prateek we're not your bitch.
@phenomnomnominal :o I know
First PHP, now Java ... whats next some random guy asking for Cobol help?
11:20
Coincidence ?
-1
Q: How to flip webpage like a book

Ravi KumarI have created a simple webpage with 4 different page. On home page there is a navigation link of each page like - Page1 page2 Page3 Page4 So now I implement something like if I will click on any link it should open that page like we flip pages of a book with some transition effects. So how ca...

So if you want to edit a codebase, and you know no one in here is going to do it for you, and you looked on google and you can't find it, why don't you just do it yourself.
With programming? — Axel Amthor 1 min ago
haha awesome. :D
I'm trying to find the best practice of referring to "this" inside an object literal.
@RickKuipers you can't (at least not directly exactly this)
for example:
var obj = {
name: 'rick',
callback: function() {
console.log(this.name);
}
};

$('.clickhandler').click(obj.callback);
I know the above won't work
11:26
@RickKuipers typically one would use the this keyword.
But it won't do anything.
$('.clickhandler').click(obj.callback.bind(obj));
.bind(obj) would set the context I guess?
yes, and prevent execution on bad browsers, which is a feature
11:27
Or would you say itÅ› best to just keep saying obj.name everywhere?
var obj = { name: 'rick' }; obj.callback = function () { console.log(this.name) }
@phenomnomnominal how does that change anything?
^ that's what I was wondering
Hahah oh shit
I missed the event handler bit
I was like what the fuck is the problem.
$('.clickhandler').click(function(){obj.callback()});
cross-browser, but not as cool
11:29
Basically I want to prevent myself from having to write obj.name all the time. If you would i.e. change var obj to something different you would have to edit all those calls.
In this case I would probably use an object factory as an IIFE.
Or use prototype.
If you're using jQuery, like a lot of its retarded functions, it has .bind in alternative syntax called $.proxy
There are so many possible solutions...
If I were you, I'd just shim .bind, shimming ES5 methods in ES3 is perfectly ok
^
except only a partial shim is possible
11:32
@JanDvorak, why's that?
the real bind accepts extra parameters
Do I miss something or is this question totally useless ?
that can't be emulated in ES3
2
Q: When Javascript math.random method is seeded

user2426433I would like to know when, in a browser environment Javascripts math.random method is seeded. Is it: A) When computer is switched on B) When the browser is launched for the first time on a session C) Each time the browser is launched D) When the page with JS code containing math.random ...

It's possible to shim the extra arguments, that's not the problem
(hint: just use .apply)
11:33
@JanDvorak that should be okay right?
The problem is that .bind has behavior that requires defineProperty like methods
@BenjaminGruenbaum how do you make a property non-enumerable in ES3?
15 secs ago, by Benjamin Gruenbaum
The problem is that .bind has behavior that requires defineProperty like methods
There are no non-enumerable properties in ES3
that's what I meant by those extra arguments
@jAndy there are, but you can't create any
11:34
@jAndy right, but you can't arbitrarily create ones
nitpickers
I think iĺl just go with the .bind(obj). Seems to fulfil my needs :-)
I appreciate your help :-) ty
@RickKuipers It's IE9+ though, just remember that
@RickKuipers if you can live with the consequences do it :p
11:36
I can't :
:'(
@RickKuipers Then use a polyfill
ES5 compliant browsers, its about 30% slower in performance and you can never re-assign another this value
!!/tell RickKuipers MDN Function.prototype.bind
ew gawd! A new jAndy!
3
@jAndy Can't you call .bind on a function you called .bind on before?
no bot :/
11:37
@BenjaminGruenbaum good question, only tried with .call and .apply
Man I'm such a star whore slut (no one's paying).
Try this:
(function(){console.log(this);}).bind("Hello").bind("World")()
@phenomnomnominal didn't understand, starred just in case...
(I get Hello)
I could use that except I'm trying to keep this as modular as possible.
except*
11:38
@JanDvorak Why do you use button[0] by the className?
@BenjaminGruenbaum the same happens when you're binding by wrapping
WTF chrome: String {0: "H", 1: "e", 2: "l", 3: "l", 4: "o"}
@Arthur that gets the native DOM element out of the jQuery object
Thats a bit excessive
11:39
function foo() {
    console.log('this is: ', this);
}

var bar = {cat: 42};

foo = foo.bind( bar );
foo();
foo.call({});
foo = foo.bind({});
foo();
@phenomnomnominal that's expected, it's a String object
its bar every time
is the purple thingy a squid or a jellyfish?
@JanDvorak Yeah, I never tried it, I guess it makes sense
.bind() will bind the this value forever
I guess...
Sauron made it
11:39
golden
> Set the [[BoundThis]] internal property of F to the value of thisArg.
(function(){}).bind(window)
function () { [native code] }
I like that
@FlorianMargaine o-o
WTF Chrome?
One scope to rule them all,
One scope to find them,
One scope to bring them all,
And in the darkness bind them.
pretty accurate actually
It's not until you join one of these chatrooms that you realize you know nothing about javascript...
11:42
@JanDvorak we talked about that the other day, it makes sense
@phenomnomnominal link?
I always knew I knew nothing - this just confirms it
(function () {}).bind('hello')
function () { [native code] }
and punishes me at the same time
Ummmm, who remembers when that was
11:44
because bound methods are not defined by their source code and scope chain?
$.proxy(function() {}, window)
function (){return a.apply(c,f.concat(F.call(arguments)))}
heh
at least, thats one fundamental thing you can't shim whatsoever
that immutable scope once and forever
@verism You noticed that there is a paradox right?
i'm riddled
@OctavianDamiean is riddlor(d)
11:47
If you know nothing, how can you know you know nothing?
You could not have known that you knew nothing because then you would have known that you knew nothing which means you knew something.
2
God I love words.
that's... confusing.
what about, "I know nothing 'cept that I know nothing"
Seems valid.
That'd be valid.
11:49
Just that the one thing you know is wrong.
Because you know that you know nothing.
i know that i know nothing about several subjects - given that i know there is more to know than i'll ever know
So you know something.
lol
!!s/several/almost all/
dammit
actually you could start this way earlier
like you know how to express yourself
11:50
@verism Without ever knowing everything about a certain topic, how can you tell that there's more to know than you'll ever know.
how to type, words, etc.
Yeah, you know how to form a coherent sentence.
This is getting way too meta.
yeah, really
I'll stop messin' with your mind now. :D
Had my fun.
11:51
it'll take a bit more than that, thankfully
Nothing is certain - That is the only thing I certainly know
does that make any sense :p
and this is the slightly modified picture
ninja dick slap
11:53
Ninja please.
user image
2
DON'T CLICK IT
@jAndy stop it
Did anyone not click it?
:D
@jAndy You sad ... uh ... bitch.
guys, I figured that
the only thing which is missing there is a hint for THE GAME (which I just gave you)
^5?
@phenomnomnominal I don't like that paradox as it implies there can't be alternating timelines.
11:57
no I am not 5.
@OctavianDamiean the normal grandfather paradox, or that fucked up version?
no, "^" as in "high"
@phenomnomnominal nice
oh, dang it
@phenomnomnominal nice indeed
I guess you've all seen this: youtube.com/watch?v=8Q_GQqUg6Ts
@TemporaryNickName I have never seen you saying a single word about JS in this room

« first day (955 days earlier)      last day (4218 days later) »