last day (5170 days later) » 
08:00 - 20:0020:00 - 00:00

08:38
o hai
3
hello
The permalink for my last chat message is awesome: chat.stackoverflow.com/transcript/message/1000#1000
Hi guys
Does this thing allow Markdown formatting, or syntax highlighting?
where is all this JavaScript then?
08:39
let's try :P
@MathiasBynens Limited set of Markdown allowed, just like in the comments
@MathiasBynens: A limited subset, yes
@cheeaun Try it in the sandbox room
@Y
oops sorry
@YiJiang ok, I'll test there
@cheeaun Tab to autocomplete
08:40
> So Math.SQRT2 etc
yes

Sandbox

Where you can play with regular chat features (except flagging...
4
@balpha Thank you
@MathiasBynens: And "onebox" links:
0
A: How to list the properties of a javascript object

Andy EAs Sam Dutton answered, a new method for this very purpose has been introduced in ECMAScript 5th Edition. Object.keys() will do what you want and is supported in Firefox 4, Chrome 6, Safari 5 and IE 9. You can also very easily implement the method in browsers that don't support it. However, ...

quite interesting piece of chat software
the notifications are nice
08:42
Thanks @balpha and @Andy E
@cheeaun hi!
5 messages moved to Sandbox
@siong1987 hey
@cheeaun You know, Javascript, discussion here... ahem?
This thing is built with jQuery, by the way
cool
08:43
cool
@YiJiang That's the problem with all other chat interfaces - not enough jQuery ;-)
lol. notification is cool. agreed.
Which also means you can do really <del>stupid</del> cool things, like building a spambot in your Javascript console
@YiJiang good idea! i'll try this immediatly ;)
Can anyone think of good feeds to display in this room?
08:46
@Florian Don't bother, I've already done it before
is this built on nodejs?
@cheeaun The server backend is standard StackExchange C# and SQLServer
doubt it, SO is built on ASP.NET MVC and assuming this is too
good question for node
argh dot net!
in The Tavern (General) on Meta Stack Overflow Chat, 16 hours ago, by Yi Jiang
var randomStuff = ['Waffles!', 'Ponies!', 'Yeah, me too...', 'Hmmm...', '):'];

function sayRandomStuff(){
  $('#input').val(randomStuff[Math.floor(randomStuff.length * Math.random()) + 1]);
  $('#sayit-button').click();

  setTimeout(sayRandomStuff, (Math.random * 300000) + 1800000);
}

sayRandomStuff();
08:47
@Florian whats wrong with .NET?
Don't use this though, there was a bug in the code that I fixed later
Hi @Skilldrick
@YiJiang thanks, but i was kidding
Hi @Andy E!
@AutomatedTester just trolling
I'm going to go back to work before I get sucked in :P
@Skilldrick yeah, I don't see myself doing much work today :-P
@AndyE It's Friday, why are you working at all?
@Andy E hehe. Anyway, enjoy JavaScript everyone, and see you later!
Just wait for the next Layer Tennis match to start
08:52
@YiJiang I'm not, yet...
Although I do have my current VS project open :-)
happy coding all :)
Well, since this is a Javascript room, I'm going to post this here
1
A: jQuery version of this UI Control (sliding toggle switch)

Yi JiangWell, it's certainly not easy to make yourself. Not easy, but quite fun. This is my first attempt at creating a plugin so please excuse the poor code quality. The code uses (but is not an extension of) jQuery UI. Specifically, it uses the draggable component for the handle, and some UI CSS classe...

Requesting code review and improvments
@YiJiang: +1 on that, but I do have one suggestion - take a look into the element selection on double-click (though, I only tested in Chrome)
It looks like you're cancelling the default action of the double click, but it still highlights
I haven't had as much time to refactor the code and add in the features I need to make this really usable.
Or rather, production ready
Oh, also, it looks terrible in IE7 compatibility view
:-)
09:04
@AndyE It was a weekend afternoon, had nothing to do, so I coded this long solution. Now I feel slightly guilty that I hadn't had the time to come back and polish it
I mean, it's that close to becoming finished
@AndyE I would just tell you that that was intentional :)
@YiJiang: Don't worry, I've been working on a universal "input" event for jQuery for weeks ;-) Still can't get around to finishing it
A jQuery implementation of this: whattheheadsaid.com/2010/09/…
@AndyE Nice post! looks for upvote button Awww....
@YiJiang Thanks :-) I try and do that all the time with blog posts now lol. I guess that's what tweets and diggs are for. A comment would be nice, though, my blog's a bit sparse at the moment ;-)
 
2 hours later…
10:49
Hi for all the cool guys over here
 
1 hour later…
11:49
2
Q: Is Function really an Object

Q_the_dreadlocked_ninjaI am a self taught web developer and am still trying to come to grips with some JavaScript fundamentals. Below are some quotes extracted from Douglas Crockford's Good Parts. "Functions in JavaScript are Objects" "In JavaScript, arrays are objects, functions are objects, regular expressions ar...

Hi @MarcGravell
heya - all well in here?
Yes, it's rather quiet at the minute, though :-)
you should've called the room jQuery. Today's kids don't know what this "javascript" thing is
20
@balpha how true.
"JavaScript and jQuery" ?
11:56
@AndyE Well, now we've got two mods stuck in here it's rather cozy
nah, I can make room ;p
@MarcGravell That wouldn't be fair on the "ugly" stepsisters, PrototypeJS and Mootools :-P
it wouldn't be equal, but IMO it is "fair" ;p
zing!
d'oh, he found his way back in...
12:05
hi all
hi @RodH257
on the topic of jquery/prototype etc, what are the major advantages of jquery over the others?
@RodH257 'Ello!
@RodH257 The syntax is simple, if you've worked with CSS before
12:06
hey @spoulson
Hello @Nick
g'mornin
or evening, depending on location
Why yes, it is a good morning
@NickCraver Evening here, at GMT+8
@RodH257:
12:07
2 mile walk, followed by scrapple, egg and cheese bagel.
159
Q: Which JavaScript framework (jQuery vs Dojo vs ... )?

cletusThere are a few JavaScript frameworks/toolsets out there, such as: jQuery; Dojo; Prototype; YUI; MooTools; ExtJS; SmartClient; and others I'm sure. It certainly seems that jQuery is ascendant in terms of mindshare at the moment. For example, Microsoft (ASP.NET MVC) and Nokia will use it. I ...

ahhh
@AndyE Ah, much better
wow jquery certainly won that one outright
I've been using JQuery and love it, was just wondering why it was better than the others
@RodH257 It's not a popularity contest, if that's what you're asking ;)
12:08
have been working on a project with someone who loves Prototype
@YiJiang and let's face it; if you're writing jQuery you're probably also writing css
@RodH257: It's still subjective, but jQuery is the most popular.
Each framework tackles a slightly different area, though there is a bunch of overlap. jQuery took off with the most community and plugin support, so it tends to cover the common problems a bit easier...that's for most, not everyone.
Just curious, what is the opinion of those of you here on the BBC's Glow Javascript library?
@NickCraver: been waiting for you to appear. Do you know anything about implementing custom events in jQuery?
12:10
Yup, what's the problem?
@NickCraver I'm creating a plug-in to implement the input event in Internet Explorer. In IE, it maps to the propertychange event. The problem is, propertychange event doesn't bubble, whereas the input event does. Got any ideas on how I might tackle it?
If you already have the event you want monitored (covered different ways it looks like) you can just .trigger("myCustomEvent") and it'll bubble, if you didn't want bubbling there's a .triggerHandler() version.
Then anywhere above, just .bind("myCustomEvent", handler)
hold that thought, I'll brb
(this works with .live() as well, in jQuery 1.4+, mostly in 1.3 as well)
k
@NickCraver So, should I attach propertychange to all input elements that are descendants of the elements returned by the selector?
12:20
@AndyE Yeah I don't see any alternative there since it doesn't bubble, but off that event I'd trigger your own so it's all handled cleanly that way.
that's more or less what I thought I'd have to do.
@NickCraver Thanks for your help :-)
non-spec events are often messy, unfortunately...at least Mozilla (usually) puts it in a JavaScript x.x standard when they do it so you know what you're dealing with :)
@AndyE np :)
@Andy - One note though, propertychange handlers aren't cleaned up well at all in older IE versions, be sure to use one handler and map them all to that function, not a function per in the loop...can really help memory (garbage collection rather) issues in IE6 especially, if that matters.
@NickCraver: thanks for the advice, I will.
13:05
@NickCraver: just noticed the JSLint addition to JSFiddle. It's just a shame that JSLint and I disagree on quite a few things :-)
@NickCraver Do you know of any good guide to creating jQuery plugin that uses jQuery UI?
@Andy - I think the plan is to add the options in there at some point, same as jslint.com
I'm trying to create plugins like what Filament Group does, with jQuery UI as a base
@YiJiang if your intent to create a new widget, or a widget based on an existing widget?
@NickCraver Based off draggable, and similar to buttons
If you scroll all the way to the top you can probably see my request for code review
That would be the one
13:11
@NickCraver I don't think JSLint has an option for tolerating if statements without opening braces. Which really infuriates me! :-)
@AndyE ah that one....yeah.....
@AndyE Well... you can always choose not to press that button ;)
jsfiddle didn't have it before, and I don't think you're under any obligation to press it
@YiJiang I don't know of a good tutorial really, taking a look at your code now to see if I can better illustrate that way
@YiJiang I almost certainly (probably, maybe) will choose not to :-)
@AndyE I just ran my code against it, and it said it was jslint legal... I suspect that button is faulty, because jslint almost always have something to pick on!
13:15
@YiJiang JSLint doesn't like it when you omit braces:
var j = 1;
if (j == 1)
  alert(j);
Problem at line 3 character 3: Expected '{' and instead saw 'alert'.
Yeah, if(condition) return; is very common, should be an option at least
I know JSLint is designed to be very strict, but I think it really needs a nice cup of herbal tea so that it can relax and let the odd non-critical issue slide.
13:28
@NickCraver: you were spot on about the bubbling issue. Applying the propertychange event to descendants instead worked great, since I was already triggering the custom event through that handler. Now I just have to work on unbinding.
cleaning up the custom event or the propertychange handlers?
@NickCraver the propertychange handlers. I was thinking of generating a namespace when binding and unbinding using that namespace.
hey just wanted to ask a simple question about analytics..
@Gideon Go on
i wrote a small library to detect stuff about the browser, os etc etc.. i wanna do something like google analytics and push all this back up to my database on the server..for every page that is visited.. (as in also note the url visited and the time it was visited etc)
13:41
@Gideon Certainly not a small question, but go on
how would I do this (beware the JS noob) should i just use jquery.ajax() and post the results from the javascript into as asp.net page..
@Gideon Well, if you ask for my honest opinion, you should just go with GA.
Since you have control over the server side, why not do this on the server side instead?
I wish! =( it a web app hosted on LAN (in a bank!
@Gideon Serverside solution?
you mean get some analytics on the page_load event? is that "good design"
izb
izb
13:44
@gideon is the information you want (browser/os) available from the requests on the server end? i.e. no need to make another JS call?
@Gideon Erm... I'm not familiar with ASP, but shouldn't the server be able to detect the User Agent string and infer the browser/OS from there?
true... so true.
What do you need to detect on the client, that's not already in Request?
being a junkie im always worried about bad design... i mean google analytics and most other analytics have you slap in a nice js link in your pages.
i just assumed that was "better design"..
izb
izb
JS is nice for things like recording stats for actions, e.g. 'User clicks our promo link -> send a record of the click to GA' but for user agent type stuff, you already get that in the request
13:46
i need browser, url, time visited, IP
In an intranet environment you're really not going to get any better data than you could from Request.Browser.
so then use request.browser in the page load event.
or better yet i can make a base class that does this for every page..
for example IP: Request.ServerVariables["REMOTE_ADDR"], browser info: Request.Browser, time is just DateTime.UtcNow
izb
izb
master page?
if you're interested in this logging I'd add it as an HTTPModule or in global
13:48
@izb this is all be code right, so i'll have a nice PageBase class that overrides the OnLoad and does all this?
@NickCraver is that better design (* asks the informally educated*)
??
yes I do have to log it all.
I'd say so, then it happens regardless of handler, say they requested something not handled by one of your pages, any other handler type really
in IIS7 it's trivial to add it for file requests too
or, use IIS logging altogether, just turn on user agent logging, if you have the space to do so....about 10 ways to do this
izb
izb
IIS can write this to log files... i wonder if there's a way to capture that. some sort of extension? (imagining this API exists)...
=S user agent loggin i will read up more on that im not as IIS expert.. but the loggin needs to go into the database..
@izb - There's an IIS log parser that's very useful: microsoft.com/downloads/en/… some usage examples: blogs.msdn.com/b/carlosag/archive/2010/03/25/…
cool!
still i think something global.asax poping info into my database would be nice .. especially since I have linq on my side =)
thanks guys.
13:58
welcome :)
hiya
@antz29 'ello
ahoyhoy
very cool chat implementation
thr
thr
feels like im back at 1999 again :D
*in
14:05
+s magic irc commands lost to the days of yore and freenode servers
> +1. Good work, spec boy :) – Tim Down 10 secs ago
I wonder if Tim's noticed how much attention I pay to the ECMA-262 spec ;-)
How far up is that discussion?
@user257493: it's a comment on this answer:
7
A: Is Function really an Object

Andy E If Function is an Object then why is its type a function and not object? Because the typeof operator is defined like that, probably for usability: Object (native and does not implement [[Call]]) returns "object" Object (native or host and does implement [[Call]]) returns "function" Object ...

It's getting busy in here :-) Can anyone think of any decent RSS feeds worth announcing in the channel? Or would that be a little annoying?
@AndyE Not very useful. What do you have in mind?
Cool, I don't have to hit refresh (F5) to see new mesages!
14:21
@YiJiang Just anything that could be interesting to us JS developers. Possibly Framework release announcements or something... just throwing around some ideas :-)
@AndyE Far too slow to be interesting... well, if you really want to, sure, why not
Maybe somebody's twitter feed
I was looking for a JS game framework and found one that looks pretty good: gamequery.onaluf.org
14:33
@DanGoldstein: that's pretty cool :-)
I'm going to try it out when I get a chance. It meshes nicely with jQuery and addresses sprites in a relatively simple way.
hi @donald
@Dan I'd like to see the raphaeljs library take off, but I'm doubtful that will happen with html5
it has a nice niche in that it works with IE6 and other browsers (to various degrees, however). It's a nice light-weight alternative to using flash and massive amounts of CSS and DIVs for gradients.
what's the best javascript templating library?
14:49
Anyone have any good SenchaTouch tutorial resources?
@AndersRuneJensen code.riiv.net/zparse Zparse is awesome. Very flexible.
@AndersRuneJensen I can't vouch for the best, but I think jQuery is getting it's own templating plugin - go search for it, it seems pretty good
herp. derp.
yc
yc
@YiJiang Are you referring to the 'official' one that Microsoft released? blog.jquery.com/2010/10/04/…
@YiJiang I tried that one, too much wierd typing. ${ is not really easy to type ;-)
@EldarDjafarov I'll have a look thx
 
1 hour later…
15:59
I just wrote some code using handlebars for templating, pretty sweet.
@anders jquery.tmpl supports the alternat syntax: {{= foo}
jQuery quick question. is there something like .live() that isn't event based? like i have a selector that i'm doing a .each() over and doing a .before() on. but more elements get inserted by ajax calls and i want .before() done on those too
if it isn't so quick i'll need to post it obviously
@rchern - .livequery plugin
crap i forgot about that
now i need to figure out how to embed that with my userscript
16:14
This answer smells
0
A: Can loop unrolling or duff's help this situation?

Mike DunlaveyYour time hog isn't the loop. It's this: ff[z] = scc(text.charCodeAt(z) & 255); Are you incrementally growing ff? That will be a pig, guaranteed. If you just run it under the debugger and pause it, I bet you will see it in the process of growing ff. Pre-allocate.

"Pre-allocate" in Javascript? Does that actually improve performance?
jQuery jQuery jQuery jQuery jQuery jQuery jQuery
What is the answer to every JavaScript question posted on SO, Chacha?
jQuery jQuery jQuery jQuery jQuery jQuery jQuery
tb
tb
@Chacha102 I lol'ed.
45
A: The Many Memes of Meta

TheTXIMeme: jQuery Originator: Unknown (possibly Ólafur Waage) Cultural Height: TBD Background: A Stack Overflow-centric meme, jQuery begin its career early on as the answer to beat for any question that even remotely referenced JavaScript. Its popularity became so great that eventually jQuery becam...

It's not nearly as bad as the answer suggests, but hey, everyone knows that jQuery cures cancer, right?
16:22
once i was flying on a plane and both of the plane's wings fell off, but it was cool cause jQuery was also on the plane, and jQuery landed the plane without wings and also gave everyone a fruit cake as a parting gift
anyone got lots of experience with nodejs?
tb
tb
@p01nd3xt3r At this point, no one has lots of experience with Node.js
tb: haha
yeah nodejs is.... a couple months old?
tb: its almost a year old so there are some people that have a good about of experience with it. I myself have developed 2 full projects with it.
I know a coder that did a complete project in Node. That's as much as you will find.
16:26
@tb so i disagree. Even though its only about a year. There are people that have lots of experience with it.
tb
tb
@p01nd3xt3r No doubt. As have I, I'm just saying it's super new and we're still learning
My experience is still limited-- but I hope to make it a permanent part of my stack
@p01nd3xt3r Are you rolling your own installs or using a Node host?
@tb: right now there are some things that are kicking my ass. Did you use a framwork? for my first project I didnt but for the one I am doing now I used express. It makes lots of things easier but its still kicking my ass
@tb: i roll my own on ec2 instances
tb
tb
@p01nd3xt3r Cool. I'm trying the Heroku beta now. No frameworks. Just making small tools/apps.
tb: u lucky bastard. I could not get an invite.
tb
tb
@p01nd3xt3r I've seen a couple other Heroku-style providers recently. Something about a Hippo?
16:30
yea there are a few but it was so easy to roll on my own. I am attempting to do a large project in node right now. node / mongo / redis /
and express js
i was wondering if anyone knew of any good node debuggers
i was using inspector but it really sucks
and i am trying to debug something in the node-amf module which helps node talk to my flash app (i hate flash but its the best way to do video chat right now)
the only error i get is cant bind to object and an object id
then node just quits and i have to restart it
tb
tb
@p01nd3xt3r That sounds cool. Hope <device> gets a big push eventually
@tb: yea im just doing it because i want to be able to say im a node ninja so i want a few projects under by belt but the lack of documentation and stuff like that is really getting annoying
What are the favorite javascript unit test frameworks? Any tip, tricks, or pitfalls?
@Robert jsunit
it kicks ass IMHO
Speaking of testing, at a bit of a higher level, does anyone use Selenium or something similar and how do you like it?
16:39
@Doug you should look into Windmill
I have used both Selenium and Windmill and prefer windmill hands down
2
@p01nd3xt3r Thanks, I'll take a look at it
@tb thanks
16:56
hello
zod
zod
hey
just got the privilege to chat :)
any experience JSunit vs QUnit?
@zod Congrats
zod
zod
thanx :)
hey one question.. is there anyway to find who down vote? i think there should be some system or checking , when somebody down vote thy should leave a message why they do that , then only a newbie will not repeat that .. Is it???
17:12
Not that I know of. You could always ask :\
@p01nd3xt3r if your debugging amf, then something like charles may help
@zod Nope, no way to see who downvoted you
Voting is anonymous, as it should be
@zod When they downvote they're asked to leave a comment
but it's not required
Post a link here, we'll tell you if we have ideas as to why you were downvoted @zod
zod
zod
17:37
ok
17:48
hey guys, question, did you know the browser are detecting stackoverflows , like doing foo(){ foo(); )(); will be stopped after some cycles ?
like 25000 in ie9 and 2000 in ff
Luckily it does :)
Wonder if any javascript engine would detect a tail recursion, and optimize it away!
Yesterday I found out (another javascript question) that javascript, amongst other languages, returns negative numbers for some modulo operations. That was a big surprise. I wonder, how many innocent javascript users have to find that out the hard way...
isn't that mathematically correct?
euclidian
i was trying to write a tool to log all function calls made by js in the browser
i eventually gave up
i think you have to write a viral function that infects window and propagates itself to newly constructed objects
4
Q: Is there a way to wrap all JavaScript methods with a function?

blake8086I want to wrap every function call with some logging code. Something that would produce output like: func1(param1, param2) func2(param1) func3() func4(param1, param2) Ideally, I would like an API of the form: function globalBefore(func); function globalAfter(func); I've googled quite a bit...

if there is a way to list all global functions, then it should be ok
did you try looping over the golbal scope properties ?
then check the type
18:06
Just wanted to let you know that I have created the jQuery chat room dedicated to this fantastic library, you are welcome to join if you wish!
you can list all globals, but then you still have non-global functions to deal with
sebastien, that's what the answer to my post was
but i want to list ALL function calls
well, you can do it recursively
should I read the question first from so ;)
test
it seems that no one knows how to write js like that
there's plenty of AOP stuff where you can manually instrument any one function
dan
dan
18:21
I just want to test the chat room : javascriptkata.com/2010/10/14/…
please use the sandbox for that

Sandbox

Where you can play with regular chat features (except flagging...
18:41
Hello
Anyone know of a faster performing solution than MarkerClusterer for a google map with 3000+ markers?
isn't that the thing that merges local groups of markers into a single marker with a count on it?
i think that's sort of just intrinsically a Hard Problem
@blake8086 yeah
you could probably speed it up by reducing the quality of the clustering
so you think there's optimizations to be made in the clustering algorithm?
18:51
probably
you're basically looking at thousands of distance comparisons
i guess you could also progressively cluster, but that may confuse users
19:16
:D of course nick is in here
i should have known
Why don't browsers just implement jQuery instead of javascript, it's a way better language.
jQuery is javascript.
Test
@BBonifield foobar
Perhaps you're talking about implementing jQuery as a standard API wrapper for the DOM?
I'm saying that jQuery is now more popular than java, so why fight it?
19:23
Java != Javascript
well, depending on if you're from microsoft's point of view
Javascript is the language; jQuery is a framework for DOM access. They're not competing.
I encourage you to read the source of the jQuery framework. It's pure javascript.
If it was javascript, wouldn't we all just use javascript, and not jquery, then?
hey guys
agree @AlexSexton
19:28
thanks @BBonifield
jQuery is much cooler than javascript
stupid java
jQuery IS javascript
jQuery is written in JavaScript and makes manipulating the DOM easier and more intuitive.
What's a DOM? Is that some Java bean?
That's what we're saying. jQuery practically has become javascript at this point. so why not add it to the browser
19:30
@AlexSexton I see what you're saying; good point.
we just need to be able to get dates and times in jQuery then we'll be set
new Date FTL!!!
$('Next Tuesday').newDate();
You'd have to get a jQuery standard and then all the browser vendors would probably implement it differently anyway.
$.mb_strtotime('Next Tuesday').toDate()
ugh
Then add $.kitchensink(), rename it to "prototype", and ship it!
19:45
/me was trolling ftr
i <3 javascript
anyone know of a good, open source implementation of the W3C Range/Selection interface for IE 8?
I've tried this: code.google.com/p/ierange but its not working out
I do like the way IERange is able to just drop in (meaning, load the script and it extends/plugs in to the right places)
a 'polyfill' if you will...
no, haven't tried rangy. looking at the page now...
jQuery practically has become javascript at this point? Only if you use jQuery...there are plenty of other frameworks
19:55
no one really thinks that
so no worries
@geographika and there's always... just JavaScript
/cc pete higgins
@AlexSexton I wonder at times. Usually when reading questions on SO
im just saying. we just having fun before
we apologize
I know there's general work to find the slow parts of JQuery and other frameworks and turn those into native code in the JS engines. See recent features like JSON.stringify and document.getElementsByClassName
19:58
jQuery doesn't have either of those...
@Alex - Sizzle simulates the second though
not really...
a selector just looks similar
but it's pretty different as far as options go
querySelectorAll
may have been a better analog
08:00 - 20:0020:00 - 00:00

  last day (5170 days later) »