« first day (460 days earlier)      last day (4506 days later) » 

12:00 AM
@Raynos console is safe to shim because it has no side effects
(more or less)
 
@adscriven same thing.
Object.freeze has no side effects either :D
But bloody hell Y U NO SEE MY ARGUMENT AND SUBMIT >:(
 
So code using Object.freeze works identically in IE7 and, say, FF9, for all code?
 
Hello, javascripters! Can anyone recommend a DOM shim for me to use?
 
yes/no
FF9 becomes slower
@JosephMarikle DOM-shim
 
is that a particular one?
 
@Raynos Eh? So Object.freeze works in IE7 then?!?!
 
sweet! thank you, @Raynos!
 
@adscriven of course not, you need the shim, but if you use the shim it "works"
Look, Object.freeze, freezes the object in firefox and does nothing witht the object in IE7
 
@Raynos how does it "work"?
Oh, so it doesn't work then.
Silent failure !== work
 
Look, ...
 
12:07 AM
I'm looking!
 
(function () {
  "use strict":

  this.trolls = true;
}());
Works in IE7
And fails in Chrome
Is that a "silent failure"
 
That's why IE<10 must die.
 
Is that a good reason to not use "strict mode" ?
Seriously, is that a good reason to not use strict mode?
 
I use it, but I don't rely on it
 
@JosephMarikle note it only supports IE8+ and modern, it also expects an ES5 shim to exist.
@adscriven you can do the same with Object.freeze
I personally say "never use" Object.freeze anyway because it has a huge run-time penalty
I would always overwrite Object.freeze with a no-op function in production for the speed benefit
 
12:09 AM
Right, and if I can fail noisily then I will, hence my desire to use es5-shim, but patch it.
 
that way you can get the debugging / analysis benefit in development
 
@Raynos I thought that's what I said!!
 
@Raynos ah... where can I find an ES5 shim? or is that on your github
 
@JosephMarikle kriskowal/es5-shim
 
@Raynos See my remark above this one.
 
12:11 AM
@adscriven no you said overwrite it with an error throw "for noisy failure"
 
@Raynos Well if you don't then and you just overwrite Object.freeze in production, then you have different code in dev and prod. Very bad.
 
Thank you again, Raynos!
 
12:35 AM
anyone out there
need a tester for my last revision of my game to submit to lundum dare
I wanted to add one more feature that would make it fun, the ability to place dollars
that would attract the 1% but my time is almost up
 
Anyone with a math background want to tell me if my question is totally dumb? math.stackexchange.com/questions/100299/…
 
:( @Incognito I suck at math otherwise id help
woot
submitted it
 
12:53 AM
@adscriven no, not bad at all
I have "safe" code in development
"safe" code comes at a run time penalty
Like having ifdef assertion all over your code for debuging
 
@Raynos Code in dev must be identical to that in production. You can't change it and then cross your fingers and hope for the best. It must be tested.
 
@Raynos and it's not just the case of disabling some assertions. If Object.freeze, for example, has different semantics in different browers, then you can't just test in one browser.
@Raynos and if the behaviour needs to be the same in both browsers, and Object.freeze doesn't work in one of them, then you need to disable it in the other.
@Raynos I'm just saying that I'd want to patch es5-shim for production use in IE7 to explicitly forbid features that don't work properly since IE7 is the target environment.
@Raynos The features that don't work can fail silently in production, that's fine, but they have to fail noisily in development builds.
 
user986408
1:17 AM
hey guys.. if i have:

<body>
<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
</body>

how would i iterate these ?
 
user986408
for(var i=0;i<3;i++){window.document.body.childNodes[i].style.display='block';}

doesnt work.
 
user986408
it says that the style of childNode[0] is undefined..
 
@ThatWebNerd You can use children instead of childNodes. You are iterating over the whitespace text nodes as well as the divs
 
user986408
ah.. now it's working
 
user986408
thank you
 
user986408
1:20 AM
whitespace text nodes ? what is that
 
the newlines after each div get counted in the DOM
 
user986408
ah.. good to know thanks
 
1:38 AM
@adscriven they have to fail noisely in development in at least once browser
Its the exact same logic for "strict mode"
 
2:05 AM
0
Q: JS.Alescurf notification

DzulI am trying to remove this virus that cause certain browsers like Opera cannot open this website because it detects malware. This is the blog: http://tinyurl.com/7bprswz How to solve this?

 
Anyone know the bitwise trick for the sum of on-bits of a value?
For instance "6" is "0110" in binary, and has a sum of 2.
 
2:31 AM
that's the population count; if you replace k%2 with k from stackoverflow.com/a/7463787/388787 parity returns the population count
> function count(n) { var k=0, d=n; while (d!=0) { k=k+1;d=d&(d-1); }; return k; }
undefined
> count(6)
2
 
I was really hopeful I didn't have to iterate, but I can't see any alternative.
Thanks :)
 
value.toString(2).replace('0', '').length
 
@RyanKinal I feel like that might be slow.
 
Me too
But there's no iteration!
 
what's neat about that algorithm is that the loop repeats only as many times as the population count which makes it very fast.
 
2:39 AM
:-D
 
I'm fixing my euler 001 general form answer.
 
@DanD Inversing bits may make it faster, but now we're getting fancy :P
@RyanKinal My answer would give a wrong value for any answer(series,set) where set.length !== 2
 
@RyanKinal /0/g, not "0"
tiny nitpick
 
So I'm trying to find a mathematical proof for my correction that preforms the inclusion-exclusion principle. I can show it works but not express it as an equation.
 
2:41 AM
It works either way
 
on code no one would likely ever use
 
And it's probably slow either way
 
Neat thing with regex string replace I found in JS: really slow for small sets, but when you use it for a huge set of a few thousand chars it's fast.
So, foo.replace("herp","derp") is faster than foo.replace("/herp/","derp"), but not when derp is >2000 chars.
 
No one on Meta chat or Casual chat. Can you guys answer a quick meta question?
 
I wonder what the O() is on that
 
2:44 AM
On the reputation recalc page, the amount shown does not match my reputation. Is the amount on that page my "real" reputation? If I hit recalc, does that amount show up on my profile?
 
@Incognito it doesn't do any "Inversing"; d&(d-1) does b0110&b0110-b1 => b0110&b0101 => b0010 which is clearing the top most set bit.
 
value.toString(2).split('').filter(function(elem) { return elem === 1; }).length;
:-D
 
@ThinkingStiff Yeah, recalc updates your profile.
 
@RyanKinal still looping
 
@Incognito Awesome. Thanks.
 
2:49 AM
@Raynos Yeah, but would internal v8 stuff be faster than the script interface to the engine?
 
@Raynos I'm just fscking around :-)
$.getPopulation(value);
 
@RyanKinal note that O() notation normally leaves out constants (but they matter) and the behavior you are seeing is due to regex replace having a larger constant while normal replace has a smaller constant
 
@DanD I'm aware of the treatment of constants in O notation. I was wondering whether regex replace is actually a more efficient algorithm.
 
 
1 hour later…
4:21 AM
0
Q: jQuery Tree View help!

AlxVallejoI'm looking to use the jQuery TreeView script on wp_list_pages to get a nice accordion effect going. The script requires that I add some classes to the list elements such as: <ul id="red" class="treeview-red"> So I tried putting this in my template: First, load jQuery with wp_enqueu...

 
data points, data points \o/
y u no data >:(
 
 
2 hours later…
6:12 AM
@gsnedders jsperf.com/stackoverflow-8380204-eval-vs-script/2 explain please. Thanks.
i.e why are there differences? Where do they come from? I can understand the hybrid being marginally slower because eval("") can be optimized to shortcut early. I don't understand why eval is faster then script. I think I normalized everything else
 
@Raynos how do you load images dynamically in javascript?
 
herp derp?
var image = new Image();
image.src = url;
 
how do you get progress bar for it?
like how much of the image has loaded before displaying it
 
progress events
I think you can listen to readystatechange
Also .hidden How awesome is that?
 
6:25 AM
Man the DOM is full of gems like that
@anonymouslyanonymous there should be a progress event
so img.addEventListener("progress", herpderp) should work
 
thanks...javascript > c++ do you agree? (in terms of RAD)
 
of course ...
C++ && RAD -> no-no.
 
 
2 hours later…
8:04 AM
0
Q: Is there a open source solution for pushing realtime updates to the browsers?

Hasan KhanIs there a ready made solution that would require no or little code to be written to be able to push realtime notifications to the users of my web application and also maintain history of the notification for later retrieval. I know there are technologies that can be mixed and matched to use thi...

 
 
2 hours later…
10:06 AM
DERP
Too much derp :(
 
Too much enterprise level trolls on G+
"You cant do enterprise applications in JS because DERP DERP DERP"
 
biggest troll of the day is stackoverflow.com/questions/8922630/…
the answer is fundamentally flawed and he fixed syntax errors 3 times and it still has syntax errors
not to mention it won't work even without syntax errors
 
That makes no snese
Nor does snese..
I'm just gonna go back to writing emails and being important :(
 
the biggest troll is "this worked for my project"
 
10:12 AM
> My self pranay rana currenly working as senior software engineer in midesize company (Ahmedabad). I have 5 years of the experience in web development in Asp.Net with C# and MS sql server.
Sometimes I think "Meh, I only have a few months of programming experience, I need like 5 years"
 
proof that 5 years experience with asp.net gets you nothing
 
Ahmedabadbad
 
it's as if someone with 1 week experience with computers posted that answer
 
I was giving a training course to 2 C# ASP.NET developers on Tues/Wed, they had some serious logic fails sometimes
 
Then I see people like that, with 5 years who are years behind me
 
10:13 AM
It makes me sad, ASP.NET devs are generally held in a much better light than PHP devs, for example
 
@rudivisser PHP devs are shit though
ASP.NET devs are shit too
JavaScript devs are shit too
Java devs are trolls
devs are shit.
 
there is less not sure if client or server trolls in php than asp.net
 
Well yes of course as a generalisation all developers are crap because it's a fact that 99% of people that call themselves developers are in fact shit
 
people are shit.
everything is shit.
your mother is shit.
 
granted I haven't done any math on it but from anecdotal evidence it seems so
 
10:14 AM
You're shit!
:<
 
I'm not shit.
 
:<
 
Raynos.define.not.shit();
 
any question with asp.net in stackoverflow reeks of not sure if client or server
 
Anyone who fails the "great .NET developer" test is not a .net developer
he's a herpa derpa code monkey of no value.
 
10:17 AM
What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState?
LOL
 
Describe the difference between a Thread and a Process? Threads are in my clothes and Processes are used to get things done
 
Who uses ViewState
carbon footprint calculators
 
God himself
 
99% of PHP developers, 99% of .NET developers and 99% javascript developers do it.
that's the main problem
People don't learn their shit before they do their shit
 
That is completely language independent
99% of all people that call themselves developers (I will not say developers straight up) do that
 
10:24 AM
I guess thats the way it is
 
People without such basic knowledge and I suppose discipline(!) should certainly not be called developers
 
I guess most people just step into a language 'somehow' and fool around with it for quite a while.. and someday when they are clever enough they really put effort into learning every aspect of that language
but the time from just fooling around and feeling 'smart' to the point where they really sitdown and learn, is the danger ragequit zone
 
var template = [
    "<div>",
        "<span> I'm a template",
    "</div>"
].join("\n");

var elem = makeDocumentFragmentFromHTML(template);
Is this evil?
 
why would you join with \n ?
I do this "micro micro templates" all the time
so I don't consider it as evil
 
@jAndy readability I guess
Although it doesn't really matter
 
10:29 AM
I guess it beats \ or " +
"
 
however I prefer
    var template =    "<div>" +
                                   "<span> I'm a template</span>" +
                               "</div>";
 
but should micro templates live in javascript files?
or should they be elsewhere
 
without the crappy format..
grrr
 
<script type="text/html" id="template-x">
    <div>
        <span> I'm a template </span>
    </div>
</script>
...
var elem = documentFragmentFromHtml(
    document.getElementById("template-x").textContent
);
 
@Raynos: actually, no they should not live in js files (but I'm sloppy there aswell)
 
10:30 AM
they should live in a way that you don't need any quotes
 
@Raynos create a php script serverside that outputs json of your templateyness and use that shit ;D
 
those micro templates should be in your html
 
@rudivisser fuck that
@jAndy but that gets ugly for non SPA
 
@Raynos but that is the obvious solution
:DDD
 
@rudi_visser no trolls. Anymore trolls and I silence you >:(
 
10:31 AM
:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
 
@Raynos: the cool thing is, you can even use <!-- <div>template</div> --> within your html file and access that comment node in js
so you have a clear code separation
 
@jAndy slow :p can't select comments by Id
 
@Raynos: true, but if you have the markup smart enough its still cool
 
yes it is, it's a pain with html optimisers though
because they remove comments
 
another option would be to hold those little html fragments in seperate files on the server and request those on-the-fly
 
10:33 AM
I prefer <script type="template/html">
 
but that is really slow'ish then
 
@jAndy I think the seperate files is optimum
you just need some kind of bundler/packager/http request optimizer for production
document.scripts y it no work in firefox
 
firefox is sux
I'm not even trolling :D
 
well its a whatwg document
 
agree, they've had 2 years to catch up with awesomeness of chrome and they are not even close
 
10:34 AM
does not neccesarily reflect the real world :p
@Esailija: 11 days left for FF 10
it will be awesome !
 
@Esailija Well I prefer to say the awesomeness of WebKit, but even then Opera is still ahead in most things other than HW Accel :/
 
no opening directories of files and no .mp3 support, it will always sux for me
 
@jAndy HTML is the real world
I plan to extend DOM-shim to include HTML-shim
so it bloody well will implement everything from HTML
 
@Raynos: ya, I didn't really read that doc, just saying that whatwg is not W3C, just a bunch of people suggestions what may be some day
 
10:36 AM
...
@jAndy don't be a troll.
go learn your standards body history
WHATWG HTML and W3C HTML5 are pretty much the same thing
except the WHATWG is basically the browser vendors
and I listen to the browser vendors before I listen to the W3C
 
for real?
I always thought whatwg is just suggesting and discussing (future) features and stuff
and when some committee there agrees it eventually goes into the w3c spec
 
> The WHATWG was founded by individuals of Apple, the Mozilla Foundation, and Opera Software in 2004,
Nope, HTML & HTML5 are build from the same document
HTML and HTML5 differ slightly, but those are edge cases
W3C is the standards body that recommends browser vendors
WHATWG is the browser vendors.
 
so w3c and whatwg are entirely independent organizations ?
 
yes
 
0
Q: CSS3 styling v/s jQuery styling - which is better?

DriftingStepsI've been in a dilemma lately on whether to use CSS3 for styling and animations (which I'd planned to learn) or stick with jQuery/javascript. I use jQuery and javascript for such because I feel they're more stable and can be viewed in all the major browsers. But CSS3 is progressively growing and ...

is this for real ?
 
10:46 AM
oh my god
 
@jAndy welcome to the trollernet
Where do these gems come from?
I mean that's like a full document saying how JScript works
 
JScript is pro
 
> When the CollectGarbage function is called, the JScript 5.x implementation may attempt to reclaim unused or unneeded resources that are associated with the currently running application.
 
@Raynos was just reading that - that's the closest thing to CollectGarbage() documentation you can find on MSDN.
 
hi everyone
i want to know if we can create some sort of application in jQuery/javascript
for playing videos
 
10:59 AM
5
Q: is it possible to emulate non-enumerable properties

RaynosES5 has a enumerable flag. Example Example var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor , pd = getOwnPropertyDescriptor(Object.prototype, "toString"); console.log(pd.enumerable === false); // true Introduction This allows for properties to be non enumerable. This clearly ...

 
but i do not want to install any media player plugins in my browser. and it should work in IE 7+ and Mozill 3.5 + browser s
 
IE has a new Enumerator(array) thing build in
 
murtaza di dyou had a look at videojs.com
?
 
@Raynos: I thought of using vbscript to emulate getter/setter support before, but I don't think it's possible because vbscript isn't object orientated
 
11:02 AM
yes i had a look in for videojs.com but it does not support IE 7/8
 
@AndyE it is,
 
it is HTML 5 support which is not working in IE 7/8 version
 
@Raynos: my mistake. I didn't realize it had classes.
 
@Murtaza Because IE7/8 doesn't support HTML5
 
11:04 AM
@Murtaza obviously you can't use a <video> tag there, only thing you can do is embed it using <object> in IE and hope they have the codecs......
 
@Murtaza you can't do video without html5 or flash or image streaming
 
@Raynos: I was totally going to look into that about 3 years ago and didn't because I thought VBScript wasn't OO :-p
 
image streaming is really expensive on bandwidth and is laggy as hell
 
@rudivisser @DanieleB thank you for your quick response but i know that
 
@AndyE im going to patch ES5 shim soon
 
11:04 AM
@Murtaza So why are you asking
 
thats the reason i asked the question here that can we make any such player in jQuery/javascript
 
@Raynos: nice going, good work. I wish I'd followed through now, I had some projects where it would have come in useful.
 
i dod not ask anything related to videojs.com it was the reply
did&
 
@Murtaza what the hell is videojs.com I'm talking generally
 
excuse me!
 
11:06 AM
You're excused
 
i would request you to understand my question first
 
I do understand your question, you want to do the impossible :)
 
my question is can we create any player using jQuery/javascript
 
No.
 
but i dont want any plugin for player to be installed on any browser
 
11:08 AM
"No"
 
other wise i could easily use mediaplayer.swf and play my videos, audios, and show images
 
Yes
Use that
Well, use <video> with that as a fallback
 
Oh christ
GOLD MINE
G-g-g-g-g-gold mine
 
i was actually thinking of creating with the help of html tags and play a video in my browser
 
11:11 AM
anyways , but i still think i will need a flash player to play the content into it
 
how can you play a vide without a plugin or a decoder?
 
even if i do not use <video> tag
 
maybe you can find some way to simplify things or make all the code more "standard"
 
@DanieleB yes you are right! was thinking of the same
 
Browsers that support <video> support certain codecs, you can use <video> in these browsers, alternatively you can fallback to Flash where either your codec or the video tag is not supported
That is all you need to know to realise that your request of not ever having a plugin is impossible
 
11:14 AM
I have a javascript/html question. I'm using backbone.js, and I open a popup with the colorbox plugin
I put my html in the colorbox
 
yes this seems to be understandable..
@rudivisser solution is helpful
Thanks
 
Man those documents were really nice
 
the popup contains a form. Now my quesiotn is: how can I trigger an event when pushing the submit button? Usually it should be done with the event property of backbone, but it works only with the objects contained in the view. The popup is not a child of the view
 
I didn't actually think IE would document these thigns properly
I didn't show any way to set dontEnum though -.-
 
@Raynos ? It's Microsoft they document everything correctly over at MSDN!
 
11:16 AM
How to call overloaded c# function in jquery
 
@Esailija Csharp.Interop.Call('methodName');
 
does anyone uses backbone.js?
 
no
 
ok thanks anyway.
 
11:19 AM
@Raynos now that would be useful.
 
dhtmlkitchen where are you
@AndyE see SO question :P it was about setting dontEnum
 
shudder DHTML :|
 
I thought it was about getting dontEnums?
note to self - learn to read
 
@rudi_visser nothing wrong with DHTML
@AndyE that's easy
 
@Raynos :|
 
11:22 AM
@Raynos it is?
I didn't think getOwnPropertyNames could be shimmed
 
@AndyE .propertyIsEnumerable
 
@Raynos: I mean getting all the dontEnums of an object.
 
thats not possible as far as I can see
but you can check the dontEnum flag
anywya what's @MattMcDonalds website
 
@Raynos: what happens when you create a getter/setter with vbs, is it enumerable?
 
11:39 AM
@AndyE no clue
 
I'm going to guess at "no" :-p
 
@Raynos I LINKED TO THAT YESTERDAY THEIF
@Raynos although I went straight to dev.opera.com/articles/view/… boom
@Raynos the "Magic Moustache" is awesome
 
@rudi_visser y u ..
 
<3 Opera
 
> Hm. It's not an exact duplicate. ("F" vs "a"). – Michael Krelin - hacker 19 secs ago
 
11:44 AM
@AndyE link
 
1
Q: Multiple character for X number of times

Alex Possible Duplicate: Repeat Character N Times For example: var x = 5, char = 'F'; // here return 'FFFFFF' How can I do that ?

comment was deleted so I'm going to go with "stupid"
no wait, it's still there.
that mental note I made earlier is not working.
 
lol at the answerer admitting direct copy paste and still getting upvotes
anyway Alex is one of those accounts who ask retarded questions over and over again never learning
 
lolololol
@MattMcDonald the dhtmlkitchen is awesome :\ why havnt I read this stuff before
 
lol
 
@Esailija a female?
 
11:55 AM
Ugh
There's so much good stuff out there.
Why don't people show you / teach you it
 
@rudivisser most likely not
 
isntead we have people teaching "herp derp jquery plugin tutorial"
 
cos people are thick
The "able developer" pool used to increase now it's just decreasing
 
:(
 
12:17 PM
LUNCHTIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
12:29 PM
Well there is your proof. Whatever w3schools says, take the opposite of that and you have factual information. – Esailija 2 mins ago edit
lolol
 
It's true
@Raynos - Red Sky Crisps - GET SOME GET SOME NOW
 
 
1 hour later…
1:38 PM
I just got told this - there are tons of 15 year olds that would make you think 2x about what you think you know about coding
:D
This has made my day
 
what does CollectGarbage do and how do i call it?
 
What do you honestly think a function like 'CollectGarbage' could do?
 
1:57 PM
i meant how does it work internally
 
@rudi_visser there are.
@anonymouslyanonymous IE propietory function, its barely documented
 
@Raynos I used to be one of those 15 year olds!
 

« first day (460 days earlier)      last day (4506 days later) »