« first day (92 days earlier)      last day (4842 days later) » 
00:00 - 17:0017:00 - 23:00

12:03 AM
@IvoWetzel Oh, it totally does. But the amount that many JS benchmarks are bound by silly things like foo["0"] v. foo[0] is quite amazing.
 
well who in their right mind would use ["0"] anyways
 
People caring about premature optimization and Firefox 3.6? :P
 
Those people ship 45 versions of the code anyways :P
 
sloooooooow
My best clue is that getters/setters don't get inlined
 
12:09 AM
Yeah, that's my guess.
 
gnah I should go to bed instead of talking about JS performance all over again
 
I wonder how many people on jsperf realize some comparisons are bogus because they're testing repeated reads from higher up in the lexical scope v. local variables.
Because there seem to be quite a lot of things there that are basically quicker primarily because of scope differences.
 
a lot of the tests there are flawed
in the end, micro tests are rarely useful
(although FX4 does a good job at inlining (caching?)) the method version in the above test, it's about 80x faster than get/set and about 4x faster then the same in chrome here
There are a handful of things were speed matters, like encoders and graphics, but for 90% of the web stuff out there, gnah, make it work and make the code look good
if it's still too slow, figure out what exactly the reason is
everything else, waste of time
of course we're programmers so less code and faster is always what we want...
 
The only benchmark that actually tests most of that stuff is Kraken, and a lot of that you can trivially rewrite the benchmark to avoid common-subexpressions, reads of non-local variables, and get massive perf gains.
So while it's interesting from a how-much-optimizing-does-the-JS-compiler-do POV, it's not overly representative of the sort of code people actually write to do such things on the web.
 
indeed, I rather focus on the code being clean and following coding standards, than doing magic. Leave the performance to the underlying engine
The worst example I've seen lately was when I tried to find the answer to a Node.js question
a twitter module didn't work
well it didn't compile the C extension for base64 encoding
so I took a look into it, and low and behold the formerly accessible C++ functions from node where converted into static inlined ones
The worst thing about compiling a 80kb C++ extension that relied on non public APIs was that all it did was to do ONE base64 encode for sending the username+password via http basic auth >_>
I mean... yes, why read the Node.js API docs to find out that there is a base64 encode available, when you can go the extra mile of doing a C++ extension
Well I'm off to bed, @YiJiang I made a post over @ forrst to ask for some feedback about the Guide, already got some "Great!" "Awesome" comments, people also really like the design :)
Guess I'll move the Copyright Notice up to the Intro section so both our names are a bit more present on the page
anyways, have a good night/morning/day
 
12:27 AM
@IvoWetzel 'Night
 
 
9 hours later…
8:58 AM
Hi! :)
Anyone there?
 
9:12 AM
@Nyuszika7H It's 1.5, for goodness sake, don't tell me jQuery jumped 4 versions
 
@YiJiang Oh, yes, 1.5. :P But I can't edit it now!
 
9:39 AM
anyone know basic PHP i can ask a few quick questions
 
10:19 AM
Hi again! :)
 
 
2 hours later…
11:57 AM
Hi all! I have a question about css of input. in my css i have this;
input:hover { background: #f9f9f9; color: grey;}
input:active { background: #f9f9f9; color: black; }
input:focus { background: white; color: grey; border: 1px dashed;}

but i also have image buttons (input type="image") wich now react to this CSS. Ofcourse this is logical, but how can i give this css only to input text fields?
 
input[type="text"]
will match only text inputs
 
http://jsperf.com/css-selectors-vs-regexp-filter Check it out. It seems CSS selectors (jQuery uses them) are actually 79% slower!
@Opoe Or, if you want to exclude some types:
input[type!=image]
input[type=!foo][type!=bar]
 
oooo thanks you guys!
so the hover would be like this?
input[type="text"]:hover { background: #f9f9f9; color: grey;}
 
@Opoe Yep. BTW, use ` and ` for inline code, and for multi-line code, write it in a separate message, and after writing it, press Ctrl+K before posting.
 
Okay thank you i'll keep that in mind! Makes it more organized right
 
12:05 PM
@Opoe Yep. Like this:
function myFunction(foo, bar, baz, qux) {
  // do something
}
Or this.
 
uhhhhh
don't return arguments...
 
@IvoWetzel Really? :P
function myFunction(args) {
  don't return arguments;
}
 
19 hours ago, by Ivo Wetzel
user image
 
hahah
 
Morning everyone
 
12:16 PM
hello
 
@Greg good morning
 
what's a happening today?
 
jsPerf 4ever!
jQuery: Actually, the class selector is 94% slower than the ID selector!
Everyone says, use .myClass instead of div.myClass, but the second is a bit faster than the first.
 
@Nyuszika7H does .myClass catch div.myClass and a.myClass ?
anything with that class?
 
@Greg No, but if, for example, you only have div s with that class, it's better to use div.myClass.
Anyway, it's only 1%, so never mind. :)
 
12:20 PM
wait so if there's <a class="myClass"> you can't select it with .myClass ?
 
@Greg You can select it with .myClass but you can't do it with div.myClass.
How can I change my avatar on SO? I don't want to register a Gravatar account for that!
 
I don't know how to do it either, @Nyuszika7H
 
@Greg I don't like my current avatar.
 
@Nyuszika7H The only way is to register a Gravatar account
 
its just one of those automatic ones like what I have
 
12:25 PM
@Greg mine too
 
if I was @Opoe I'd change the big pink one :P
 
@Greg haha yes, but i'm not a man so it suits me :')
 
oh I thought everyone on here was male
 
@Greg Ahem... points at @RebeccaChernoff
 
12:27 PM
is male
@IvoWetzel I've stolen your avatar! :P
I'm just kidding :P
Hooray, I've changed my avatar! :)
 
I can't see the change
maybe you will need to sign out and in again?
 
Nope, just empty your cache and do some refreshes after that.
 
someone wants to join the flamewar? :P
 
@IvoWetzel Tell 'em, that the site itself recommands you not to use tables
And that the center tag is deprecated and should not be used
Then uses them anyway. How's that for facepalming action?
 
> The markup of the W3Schools site itself is awful and does not conform to best practices: table in table in table in table, with lots of inline styles.
 
12:38 PM
@YiJiang I suspect it's a battle against windmills
You just can't win
 
@IvoWetzel I'd rather w3schools than about.com :D
 
Example (just clicked on one of their JS tutorials):
> JavaScript statements can be grouped together in blocks. > Blocks start with a left curly bracket {, and ends with a right curly bracket }. > The purpose of a block is to make the sequence of statements execute together.
Pure BS. JavaScript has no block scope. {} aren't needed for "executing stuff together".
 
you don't have to copy my stuff from the HN article over here :P
 
Another thing they tell people is that "var foo = 2;" and "foo = 2;", are equal, more BS.
 
I can't rant here for my own
 
12:40 PM
doesn't know what's BS
 
Bullshit
 
@IvoWetzel LOL
 
> At W3Schools you will find complete references of all PHP functions:
haha
that's another great claim
I mean, who needs the offical docs if you can go to The Double U
 
@IvoWetzel Oh god, if you want PHP references, why not just go to php.net!?
 
@YiJiang Because The Double U is the best site for tutorials, didn't you know!
 
12:44 PM
Surely everyone knows that php.net is one of the best references on the internet, not just for PHP but amongst all online programming references
 
the forum thread is awesome
> (Defending new Boolean()) How else do you illustrate that even a boolean value is a (special, but still) kind of object?
hm... true.toString() anyone?
 
@IvoWetzel Hahaha
 
they even defend
> for (var=startvalue;var<=endvalue;var=var+increment)
 
Just point them to the page on JavaScript events... god, if only it was that easy!
 
Quote (My mind)
> <xsl:for-each select="problem"><xsl:value-of select="solution"/></xsl:for-each>
> w3schools.com/js/js_loop_for.asp. for (var=startvalue;var<=endvalue;var=var+increment) Not only do they forget about using the var keyword to prevent the variable from leaking to the global scope, but you can't even use var as a variable name—it is a reserved word, and this code will generate a SyntaxError.
 
12:51 PM
Haha w3fools' twitter account has Mister T as the profile pc
 
They've changed it to variable in meantime.
off-topic: I love my new avarar :P
 
they still have no var statement in there
 
@IvoWetzel yep it's true
 
so much bad practice in so little code
 
> The for...in statement loops through the elements of an array or through the properties of an object.
Syntax
Example
<html>
<body>

<script type="text/javascript">
var x;
var mycars = new Array();
mycars[0] = "Saab";
mycars[1] = "Volvo";
mycars[2] = "BMW";

for (x in mycars)
  {
  document.write(mycars[x] + "<br />");
  }
</script>

</body>
</html>
for (variable in object)
  {
  code to be executed
  }
 
12:54 PM
Next Code-Bowling: Write Hello World. But put in as much bad practices as you can
That will be soooooooo fun
 
@IvoWetzel I'll start it with eval("eval('eval( :P
Nope. eval() is enough :P
 
> you declare a variable within a function, the variable can only be accessed within that function. When you exit the function, the variable is destroyed. These variables are called local variables. You can have local variables with the same name in different functions, because each is recognized only by the function in which it is declared.
>_>
Java and JavaScript are two completely different languages in both concept and design!

Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.
 
@IvoWetzel it should be a blockquote :P
 
gnah, I'm lazy
> JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing
oooooooooooooooooooooooh
 
> Q: Is geolocation part of HTML5? Why are you talking about it?
> A: Geolocation support is being added to browsers right now, along with support for new HTML5 features. Strictly speaking, geolocation is being standardized by the Geolocation Working Group, which is separate from the HTML5 Working Group. But I’m going to talk about geolocation in this book anyway, because it’s part of the evolution of the web that’s happening now.
function supports_geolocation() { return !!navigator.geolocation; }
ooooooooh
is leaving for a hour
 
1:18 PM
I have:
success: function(msg){
if( $(msg).find('.albumGridViewItem') ) {
$('#MyAlbums').append(msg).fadeIn('slow');
}else{
alert(msg);
}
}
If it doesnt find .albumgridviewitem in msg, then it doesnt alert, why?
 
@Karem Use .length - the jQuery object always evaluates to true
if( $(msg).find('.albumGridViewItem').length ) {
 
Lets read a bit about english punctuation and fix half a ton of the guide :D
Thank you git, for great merges
> Different documents in a web browser. a Web Browser.
 
1:42 PM
@Yijiang still nothing
@yijiang no alerts
@yijiang
if( $(msg).find('.albumGridViewItem').length ) {
$('#MyAlbums').append(msg).fadeIn('slow');
}else{
alert(msg);
}
@yijiang and the response(msg) is text without any .albumGridviewitem...
 
2:04 PM
omg
 
2:20 PM
Hi! :)
@Karem Use Tab to autocomplete, and hover over the message's timestamp to reveal the reply button. Also, take a look at Markdown Editing Help. ;)
@Karem and the response(msg) is text without any .albumGridviewitem... Then don't expect it to work…
 
@IvoWetzel hey, you seem to be a git expert... I was modifying the master (by accident) in a branch, can I somehow grab these changes in the master to commit them?
 
@Greg What do you mean exactly by "modifying master in a branch"
 
I'm working inside a branch, and modified the master files in that branch... thinking that I was working on the master. Now only that branch has the changes - I want all branches to replicate the change
 
And no I wouldn't really call me an "expert" more a daily user
@Greg Then you have to merge those changes into the other branches
 
@IvoWetzel hmm I'll see what I can do ... might just revert the changes and copy/paste the differences into the master :D
 
2:39 PM
Google Analytics on the Garden is, well quite useless
It seems like 90% of the people are blocking analytics with noscript and the like
 
@IvoWetzel What do you see?
Eh... Adblock doesn't block analytics by default I think
 
> This guide is the work of two lovely Stackoverflow users,…
For the god's sake, it's Stack Overflow! :P
 
@YiJiang I see like, well nothing, 20 pageviews so far, but alone the forrst post has ~100 views
+ I spread it out on Twitter a bit
 
@IvoWetzel The pageview doesn't get updated that often, does it?
 
@YiJiang Not really, but it got updates just an hour ago or so
 
2:43 PM
Just checked the ABP blocklist, analytics isn't blocked on the list I subscribe to
 
@YiJiang EasyPrivacy, maybe?
 
@Nyuszika7H meh, none of the other add-ons/extensions are as popular as ABP and it's Chrome counterparts
 
Still I suspect many people run FX and have NoScript installed
hm, still have of the views are from FX users
 
Object.getOwnPropertyNames is very handy.
 
3:42 PM
> shit" in "WC"
TypeError: Cannot use 'in' operator to search for 'shit' in WC
 
@Nyuszika7H You should use jQuery for that. It makes it easier to search in lavatories.
 
@lonesomeday So you mean $('WC').find('shit')? :P
What does this mean? :P
> WTFs you
 
@Nyuszika7H Probably missing a word there between WTF and you
 
Hey. I didn't think this was worth a whole SO question so I am placing it as a chat question:
IE is dying at this line: var unit = (isNaN(properties[p])) ? properties[p].replace(/[0-9]/g, '') : 'px';
I can't for the life of me work out why
The only error I am getting is~
 
@YiJiang what the …s (you know what does the F mean in WTF, right? :P) you
 
3:48 PM
'Object does not support this property or method'
Does anyone have a clue why this might be?
 
@Wolfy87 IE9 supports the new ES5 method, Object.getOwnPropertyNames().
 
@Nyuszika7H Of course
 
@Wolfy87 properties[p] for some reason is not a string
 
@Wolfy87 Is p a number or a string?
 
That was my initial thought, but I am going over it all and it can't be possible...
p is a string, p is part of a for in loop.
p is the index of the for in loop
 
3:50 PM
the fact that you're checking to see if isNaN suggests you may think properties[p] is a number
integers/floats don't have a replace method
 
Yes. It is either a number or a string
If it is a number, unit = 'px' otherwise it = the string less the numbers in that string
The replace method is only being used on strings
It works in Firefox etc
No errors in Firebug therer
*there
So there is nothing that stands out to you about it? As in a syntax error.
Or a cross browser thing.
 
@Wolfy87 Use (!isNaN(properties[p])) instead of (isNaN(properties[p])). Currently, you replace the numbers with nothing if p isn't a number.
@Wolfy87 OR do it this way: var unit = (isNaN(properties[p])) ? 'px' : properties[p].replace(/[0-9]/g, '');
 
GOT IT...
I just did alert
In firefox the default values for things are 0
In IE it is auto
Derp...
So I just need to convert auto to 0
Job done.
(I hope)
Hmm
No I don't think that will work
Okay, in firefox, when you get current styles it returns its height, like a good little browser, in IE, it returns auto
Humm
I need to get it's current height but not via element.style
OffsetHeight?
I need to get the computed height in IE, is that even possible?
 
$(localStorage.getItem('$_USERNAME')).find('$_BRAIN').each(function(i) {
    if (this[i].is('$_SOLUTION')) this[i].call('$_UsersDB', 'FindAnswer');
    $(this[i]).bind('answerFound', function(answer) {
        $(this).attr('$_ANSWER', answer);
    }
});
PHP and JS combined. :P
(Actually, I don't know much about PHP, don't blame me if I did something wrong.)
is leaving for a hour
 
It is offsetHeight right?
var original = (window.getComputedStyle) ?
window.getComputedStyle(this.elements[e], null).offsetHeight :
this.elements[e].currentStyle.offsetHeight;
Oh
Its just element.offsetHeight
It worked!
:D
Now I have to go upload tonns...
 
4:11 PM
@Wolfy87 offsetHeight includes margin and border. jsfiddle.net/Nyuszika7H/zAPmv/embedded/result,css Anyway, why not use jQuery? It makes your work much easier.
 
@IvoWetzel I just realized, SO disables rel=nofollow on profile pages of users with > 2k rep, which means that if we stick a promotejs.com banner in our profiles, we can help with that too!
 
I think of promotejs as a failure :/
A great idea, but it didn't work
 
@IvoWetzel Sigh... perhaps, but still
 
oh
now look at that
guess w3fools had an impact
I checked arewefirstyet.com > 24 hours ago
they were 248 for "js tutorial"
now they are 28
 
4:36 PM
heisenbugs FTW
it's awesome when another callback inside your code makes node loose half of the HTTP response data
if you remove the callback, it's there again...
add it, it's gone -.-
 
00:00 - 17:0017:00 - 23:00

« first day (92 days earlier)      last day (4842 days later) »