« first day (614 days earlier)      last day (4350 days later) » 

12:13 PM
@GNi33 oh, it's in a month for me ^^
but I should get the fanatic badge before that!
0
Q: What are some practical uses of the "new" keyword in C#?

Joel EthertonA co-worker and I were looking at the behavior of the new keyword in C#. We've read the documentation, and we understand what it basically does and how it does it. What we couldn't really get a handle on is why you would need to do it in the first place. The keyword has been there since 2003, and...

thanks c# for doing stuff differently than everybody else :D
@Esailija $.extend is not to merge two objects? I never found the need for $.extend :|
 
ChildClass.prototype = $.extend( Object.create( ParentClass.prototype ), {
        childmethod1: ,
        childmethod2: ,
});
and anytime you pass an object for argument
 
hm
so inheriting
anytime you pass an object for argument? what do you mean?
 
this.options = $.extend( {}, this.defaultOptions, passedOptions );
or similar
$.extend( this, passedOptions || {} )
 
12 months -> 899rep vs 11 months -> 4952rep
maybe i should get a little more active ;)
 
12:21 PM
so you get either default options or passed options
@GNi33 5116 rep :p
 
@FlorianMargaine it's hard to come up with more on the spot but it is useful :D
 
woah, the chat is a little behind
 
@Esailija uh?
 
well I gave you 3 examples
but there is many more that I don't remember
:(
 
@FlorianMargaine y u no blog in englisch? :(
 
12:22 PM
@GNi33 well yeah, that was yesterday
> $.extend( this, passedOptions || {} )
what does that do?
@GNi33 because my audience is french!
 
It copies everything from passedOptions onto this
 
and it's english, not englisch, you german
 
*austrian
 
dammit :D
 
lol
 
12:24 PM
@ThiefMaster oh nice, this way all properties are copied from the object..
yeah, I can see its use.
now, on to jquery source! /o/
 
yeah jQuery source uses $.extend pretty heavily
you see more use cases there
 
I like jQuery but its source.. eww :p
 
@FlorianMargaine you should blog in basecode - then everyone can read it.
 
@Esailija I meant jquery source of $.extend
 
12:25 PM
or a binary blog.
 
@rlemon basecode? what's that?
 
@ThiefMaster any source that has been battle-hardened over the years with many bug fixes looks like that :D
 
binary blog would be fun
 
01001100011011110110111101101011001000000110100001100101011100100110010100100000‌​011101110110111101110101011011000110010001101110001001110111010000100000011110010‌​110111101110101011100100010000001100001011101010110010001101001011001010110111001‌​100011011001010010000001101100011011110111011001100101001000000111010001101111001‌​000000111001001100101011000010110010000100000011101000110100001101001011100110010‌​1110
 
for (; i < length; i++) {
heh...
 
Florian i like for(var i=array.length; i--; ) {}
 
uh? that's an infinite loop
 
Nop
 
i-- will always work
 
!!> "0100110001101111011011110110101100100000011010000110010101110010011001010010000‌​001110111011011110111010101101100011001000110111000100111011101000010000001111001‌​011011110111010101110010001000000110000101110101011001000110100101100101011011100‌​110001101100101001000000110110001101111011101100110010100100000011101000110111100‌​100000011100100110010101100001011001000010000001110100011010000110100101110011001‌​01110" .match(/.{1,8}/g).map(function(v){return String.fromCharCode(parseInt(v,2));});
 
12:28 PM
i-- when it's 0, stop the loop
 
@Esailija ["L","o","o","k"," ","h","e","r","e","\u0010","\u0000","v","÷","V","Æ","F","â","w","B","\u0007","\t"‌​,"o","u","r"," ","a","u","d","i","e","n","\u0000","6","R","\u0006","Æ","÷","f","R","\u0007","F"‌​,"<","\u0000","r","e","a","d"," ","t","h","i","s","\u0001","\u000e"]
 
@FlorianMargaine hrmm... that method is over 20 lines long... and I see lines over 80 chars... no wonder Matt and Raynos hate it. Not to mention Semicolons.... Eww..
@Esailija "Look here wouldn't your audience love to read this."
 
var a = Array(5);
for( var i = a.length; i--; ) { console.log(i); }
I Usually use it when the way I iterate on the array does not matter, cause indexes will be 4 3 2 1 0
 
@rlemon lol
maybe it was missing something
lost from copypaste
 
@DieVarDump that's fun
 
12:33 PM
If the way ( asc / desc ) does not matter, or you have to iterate the reverse array, it's usefull
 
var l = array.length;
while(l--) array[l]();
 
And i personnaly like the syntax
 
@Esailija Add a .join('')
 
@DieVarDump I still prefer arr.reverse().forEach() however :p
slower, but nicer on the eyes
 
@RyanKinal I get "Look hereÛÝ[‰Ý÷W"VF–V”±½Ù”Ñ¼read this"
 
12:34 PM
Hmmm. That's unfortunate.
 
Can you stop a forEach ?
 
no
 
no
you can use every if you want to stop halfway though
or some
 
oh do you stop on every ?
(i never use it)
 
!!> var l=[],t,b="01001001001000000111011101101111011100100110101100100001".replace(/\s+/‌​g,""); for(var i=0,l=b.length;i<l;i+=8){t='';for(var j=0;j<=7;j++){txt+=b[j+i];}l.push(String.fromCharCode(parseInt(t,2)));}t=l.join(''‌​);t;
 
12:35 PM
@rlemon "SyntaxError: Invalid regular expression: missing /"
it stops when you return false because there is no point iterating after that
 
@rlemon "SyntaxError: Unexpected identifier"
oh god
 
And it return the element on which it stopped ?
 
where did I go wrong?
 
I am using Zirak's version
and it's missing the fix for the unicode invisible chars artifacts
ffFFFFFFFuuuuuuuuuuu
oh fuck it
 
12:38 PM
@DieVarDump no, every and some return true or false
 
Yeah thx, i looked at the spec ^^' I should have done that before asking
 
// Is any value of the array undefined?
anyValueUndefined = arr.every( function( v ) {
    return !!v;
} );
 
return !!v...
or
 
I always forget about it :/
 
arr.every( Boolean )
 
12:41 PM
heh
 
!!> [1,1,1].every(Boolean);
 
s/Undefined/Falsy
 
@Esailija true
!!> [1,1,0].every(Boolean);
@Esailija false
 
@Esailija It's because of your " esthetic answer of the day "
nice enswer*
 
!!> [1,1,0].every( function( v ) { return typeof v !== "undefined"; } );
 
12:42 PM
@FlorianMargaine false
 
@DieVarDump elegant :p
 
@FlorianMargaine true
 
!!> [1,1,].every( function( v ) { return typeof v !== "undefined"; } );
 
@FlorianMargaine true
 
!!> [1,1,].length
 
12:43 PM
@FlorianMargaine 2
 
okay :(
!!> [1,,1].length
 
@FlorianMargaine 3
 
the trailing comma is ignored
it causes error in ie
but [1,,1] doesn't cause error in ie
 
!!> var L = [], t, b = "01001001001000000111011101101111011100100110101100100001".replace('/\s+/‌g', ""); for (var i = 0, l = b.length; i < l; i += 8) { t = ''; for (var j = 0; j <= 7; j++) { t += b[j + i]; } L.push(String.fromCharCode(parseInt(t, 2)));}t=L.join('');t;
 
12:45 PM
@rlemon "I work!"
 
Eff yea!
 
592 question votes (98% done).
oh yea
 
445
 
though, "you have 1 vote left today"
 
is there any possible way a web worker can not be called? Just a doubt. The breakpoint inside my worker is not called, however the data is being retrieved, but the user was complaining that it wasnt retrieving anything.

Anything could be interefering on it, or whatever?
 
12:51 PM
the user using ie6 could have interfered on it
 
@Esailija I told them to use only firefox or chrome. I'm gonna check it, it can be the cause.
 
that he answers his own questions?
 
-4
Q: How to remove text from after an element with jQuery

Registered UserThis demo code loops 3 times and every time appends text. What I need is that text is not get appended but replaced, so that previously appended text should be removed before adding the new one. I have tried a lot of things, nothing worked. EDIT: You can't add an extra tag after the span! <...

 
yeah
except this time it's not even a question
 
12:55 PM
HI Somebody is in trouble
 
it doesn't even explain why would anyone want to do this
 
if it is a question and he answers his own it's actually what he's supposed to do (encouraged where applicable / possible )
 
If it was a question then yes - but it's not
 
but the questions are always useless. What's the point of having tabs that you cannot use ? (Since they take you to a link)
 
@rlemon except it's not a question and also a many times duplicate
 
12:57 PM
hello @Nikhil
 
@FlorianMargaine do you understand the point of doing this? explain :P
 
@Esailija "personal blog" "stuff I don't want to bother with around and have my hack next time"
0
A: How to remove text from after an element with jQuery

Florian Margainevar i = 3; while ( i ) { $("#i_1")[ 0 ].nextSibling.nodeValue = 'text'; i--; } There you go, enjoy. You can also use data instead of nodeValue if you prefer.

 
no I mean, please explain why enhance some links with javascript and jQuery tabs, only to have those links link somewhere out of the page
:I
 
oh
this, I don't know :D
@rlemon I'm 8 points away from you :o
 
ahahahaa
@Esailija I wanted to create a menu, and doesn't have time to create the css, that's why I used jqueryUI tabs. — rjmcb 2 mins ago
are you kidding me
 
1:03 PM
... are you serious?!
 
yeah, that's why you call javascript... just to use the css styling for links of jQuery UI :X
 
@Esailija WHATTTTT??!! 0_0 LOL cant stop laughing here. this is one of the funniest things I've seen. Just the time he lost asking the question, he could have created the menu. LOL
 
we had simliar ideas
 
yeah
except mine uses nodeValue, which is what jQuery uses for text()
 
if it's a text node then you want to change .nodeValue or .data
 
1:05 PM
because it's the only safe way to get the text
 
meh textContent / innerText works on text nodes.
 
they don't work the same way however
and I'm not sure about this :o
it does?
 
so in chrome there are 4 props doing the same thing? :D
.wholeText, .textContent, .nodeValue, .data :D?
 
pretty much (what it looks like )
 
well it has .wholeText not .innerText
 
1:07 PM
Really? A plugin for this? — Florian Margaine 1 min ago
 
> If the element has no sub-elements, just text, then it (normally) has one child node, accessed as ElemRef.childNodes[0]. In such precise case, the W3C web standards equivalent of ElemRef.innerText is ElemRef.childNodes[0].nodeValue.
 
am I the only one to think this?
 
doesn't work in ie8 though
yeah but elemref here can be either element or node
 
fucking IE8 is the new IE6
 
since you took nextSibling
 
1:08 PM
"Here is your fix"
"doesn't work in IE6/8"
"Arghhhh!!!!"
 
@FlorianMargaine whats the problem in using the $ instead of document.getElementById in ur answerr?
 
nextSibling should work in IE8 iirc not IE7
 
@rogcg many roundtrips for nothing since I'm not even using jquery's features
nextSibling doesn't work in IE7? oO
 
@rlemon it does work in all browsers
but in all browsers it can return any node
and only elements should have .textContent
 
I dont get the point of that comment. =/ If the users asks to do that using jQuery
 
1:10 PM
@rogcg because my code doesn't need jquery at all
it's like I order a tank and end up using the knife
 
@FlorianMargaine That's understandable/able to be understood/to be exptected/reasonable
 
gist: jQuery afterText Plugin, 2012-06-21 12:42:26Z
/**
 * jQuery afterText Plugin
 *
 * Copyright (C) 2012 hakre <http://hakre.wordpress.com> 
 *
 * This program is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU Affero General Public License as published by 
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 * GNU Affero General Public License for more details. 
 * 
 * You should have received a copy of the GNU Affero General Public License 
 * along with this program. If not, see <http://www.gnu.org/licenses/>. 
 * 
 * Also add information on how to contact you by electronic and paper mail. 
 * 
 * If your software can interact with users remotely through a computer 
 * network, you should also make sure that it provides a way for users to 
 * get its source. For example, if your program is a web application, its 
 * interface could display a "Source" link that leads users to an archive 
 * of the code. There are many ways you could offer source, and different 
 * solutions will be better for different programs; see section 13 for the 
 * specific requirements. 
 * 
 * You should also get your employer (if you work as a programmer) or school, 
 * if any, to sign a "copyright disclaimer" for the program, if necessary. 
 * For more information on this, and how to apply and follow the GNU AGPL, see 
 * <http://www.gnu.org/licenses/>.
 *
 * @author hakre <http://hakre.wordpress.com>
 * @license AGPL-3.0 <http://spdx.org/licenses/AGPL-3.0>
 */

(function( $ ) {
  $.fn.afterText = function(text) {
      $.each(this, function(index, value) {
          var node = value.nextSibling;
          if (node !== null && node.nodeType == 3) {
              node.nodeValue = text
          } else {
              $(value).after(text);
          }
      });      
  };
})( jQuery );
isn't this broken?
 
@hakre someone ate his Troll-e-o's this morning. — rlemon 13 secs ago
 
there is some $.after method?
 
$(this).after("text") there you go no plugins needed
 
1:13 PM
@FlorianMargaine api.jquery.com/after
 
yeah I was on it, it's insertAfter
 
in PHP, 11 secs ago, by rlemon
@hakre now you're just trolling for the kicks. You do realize that newbies to JS will never learn when you're out there being a dick like that.
he's in the php room having a lul over it all
idk i know he's trolling but he has hi rep and lots of noobies will follow.
 
he's got all his reputation in php tho
 
anyways my coffee is getting cold and my lungs are getting pink. time for a smoke and a coffee
 
1:16 PM
he doesn't know much about js
(from his tag count :p)
 
yea but 101 rep noobs will just see hi rep and be like "Ohh Mahh Gaddz! He hazz to be right!"
 
yeah :/
 
w/e I upvoted you - only one with a vote now. hopefully the OP will read yours at least and learn something
 
lol
I'm back on to the tag /o/
@rlemon and btw, 2 more rep points than you :p
 
takes vote back
bwahahahahahahahaha
 
1:22 PM
:D
I'm sick of people not understand the asynchronous concept of node.js -_-
0
Q: Node.js and Redis

Chris ManessI am trying to link up a redis database with a Node.js application I am building to be able to store comments about items. I'm using the node_redis library to handle the connection. When I attempt to retrieve the comments out of the database however only "[true]" is returned. For testing purposes...

is there a template answer for this?
 
6.3k overall
 
lol
where do you get that?
 
haha @rlemon btw the OP is really problematic
-6
Q: parseBoolean with javaScript

Registered UserI have this situation that I need a functionality of parseBoolean I need to convert the 'anystring' to parseBoolean('anystring') so that it returns false. But also need to return true on parseBoolean('anystring') !== false //I need this to call the alert if('anystring' == false) { ...

 
yesterday that was fun in comments
btw hakre's plugin return undefined :D?
 
1:27 PM
is that a good answer?
0
A: Node.js and Redis

Florian MargaineNode.js is asynchronous. Which means it asynchronously does the redis stuff, and then gets the result back in the callback function. I suggest you read this tutorial and fully understand it before getting further: http://howtonode.org/node-redis-fun

@Esailija yeah, chaining sucks
 
yeah maybe some ridiculous chaining but normal chaining is cool
it's completely stupid to do this to avoid chaining for example
var obj = $("asd");
obj.addClass("lol");
obj.remove();
it's not better in any way than $("asd").addClass("lol").remove()
 
I was trolling :(
of course chaining is good
you don't even have to cache the object, jquery does it for you by allowing chaining
chaining is a good thing in jquery
aaaaand
 
grats
did you know that the OP asked last night for a function that returns false
and that false should == false but also !== false
 
... wut?
 
so this requirement is also completely made up in his sick mind
//I need this to call the alert
    if('anystring' == false)
    {
        alert('');
    }

//I need this to call the alert
    if('anystring' !== false)
    {
        alert('');
    }
 
1:33 PM
 
@FlorianMargaine Hakre is just being a dick.
 
yeah I saw that in php room
 
@Esailija I have a solution for that! Build a supercomputer to process it, however it would take 10-million-year to find a solution. If the Vogons doesn't destroy it first we will know the result. ;)
 
0
down vote
OP acts like a douche bag, deleting answer

link|edit|flag
deleted by owner 3 hours ago
edited 3 hours ago
hahaha
the OP was also the same way here stackoverflow.com/questions/11128843/…
he is either a brilliant troll or ..
 
just bored
Florian Margaine, Marseille, France
5.2k 3 21
yay, node.js
 
1:36 PM
stupid users. keep filtering on dates where there is no data, and blame the system is not listing it.
 
rlemon, Ontario
5.1k 1 6 28
yay jquery
 
and I don't have a jquery bronze :D
me > @rlemon
:p
 
you wish
 
ewww java
 
1:38 PM
nice @rlemon grats
I just want the canvas bronze and Ill be happy
 
i got the jQuery bronze a while back
 
@rlemon my main focus was android the last 3 years. and python the last 1 year
 
March 24th apparently i got the jQuery badge
 
@rogcg wow, 3 golden badge :)
 
1:40 PM
that html one was hard.
just got that
 
haha im serious though
 
Whhhhhaaaat? :-P
 
only 401 people have it
 
@Neal stop it! LOL
 
1:41 PM
seems like itd be easy to get
nice @Neal
 
@Neal jquery golden badge? go back to your cave please :(
 
Hehe
 
you should be ashamed.
 
@FlorianMargaine :-P not my fault haha I also have the golden badge :-D
 
I want the android golden badge,
 
1:44 PM
w00t
 
@RegisteredUser: Don't let yourself being irritated by that hard to understand javascript code. I suggest you take the plugin, it works well and has a more fluent interface. Especially when your HTML changes. Otherwise, arrays are documented here: ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdfhakre 2 mins ago
should I flag him as "trolling, proof is on php chat"?
 
@Neal dafuq is dis?!!
 
@FlorianMargaine what do you mean by proof
 
@rogcg wadya mean?
 
and the plugin isn't fluent
I mean it doesn't have fluent interface, it breaks the fluent interface
 
1:46 PM
@Neal this is all ur stackexchange rep. correct?
 
in PHP, 53 mins ago, by hakre
Let's have some fun with a jQuery user:
 
@rogcg yep yep
 
LOL
the plugin is even created at the same time he made the answer
should have noticed it before :D
 
@hakre The copyright text turned me off. It is too long( 1.7KB ) — Registered User 1 min ago
LOL
 
What's everyone's preferred method for giving old IE browsers a different stylesheet?
 
1:49 PM
@Greg depends on your needs
 
Conditional comments
CONDITIONAL COMMENTS
 
but yeah, all use conditional comments
 
@FlorianMargaine LMAO TROLLS TROLLING TROLLS
2
 
@FlorianMargaine I've got multiple backgrounds on an element, but in IE8 I only want one.
 
Registered User is a troll for sure now
 
1:50 PM
but it's used either to add a class on the html element, or to load a stylesheet
@Esailija yeah totally
@Esailija ITT = ?
 
in this thread
 
10
A: Report high-Google-ranking SE content copiers here

rlemonhttp://www.advancesharp.com/Questions/7587/why-does-crash-my-page is a direct copy of Why does $($) crash my page? and so far (other than the retained links from the sister sites) I do not see any citation or linkage to the SO site or question. The do not follow the the content attribution rules...

I actually stumbled upon a question he answered and linked back to his site.
made me like ORLY?!?!?!
 
@Esailija Hello my friend, glad to see you here. Do I miss something, it will be awesome to hear your input! — Registered User 25 secs ago
hahahahahahahah
 
Finally some action!
I flagged all of his answers linking to his site as spam
used up half my flags for the day
 
@FlorianMargaine Especially as it's there so it can be read and then you know that you can create a short version out of it.
 
1:55 PM
well spent
 
@hakre you and OP were just trolling btw, it doesn't matter anymore to me :)
@rlemon lol @ your comment "it's where the cool kids hang out"
hello @RegisteredUser :)
 
This type of communication is new to me. I am catching up
 
@RegisteredUser o/
 
@FlorianMargaine Well, please tell me the name of the user that made you answer the question ^^
 
@hakre I didn't read the plugin's code before adding my answer, sorry
 
1:58 PM
this is gonna be awesome! LOL
 
@FlorianMargaine hakre needs someone to stroke his ego
i need more coffee
brb
 
@FlorianMargaine That's not what I have asked for, so thanks for making the Freudian slip obvious.
 

« first day (614 days earlier)      last day (4350 days later) »