« first day (119 days earlier)      last day (5054 days later) » 

00:41
... answering my own question (with props to @david).
0
A: Scoping a variable shared by multiple async callbacks

Nathandavid turned me on to this approach the other day in the JS chat room. See it work at jsfiddle. It makes use of a global object, but I like the logical encapsulation of the methods within the object better than the suggestions by jAndy and kirilloid. var Updater = (function() { var steps...

00:58
Where can I find information about prototype.render ? I am searching Mozilla docs with no luck
01:14
@PhilippeHarewood Is that from the Prototype library?
@Ivo I'm curious how the garden suddenly get so many issues (3, if you combine all the enhancement request there), does the analytics show a sudden uptick in traffic or something?
I am not really sure to be honest .. went knee deep into javascript from scratch earlier this week. I saw it added to functions in the form `myfunction.prototype.newmethod` and `myfunction.prototype.render` so I started looking through the docs for it , So far I have only gotten

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/prototype
@PhilippeHarewood Well no, those methods won't exists unless you add them yourself. Look for a good guide on the internet about how prototypical inheritance works in JavaScript
@YiJiang That looks interesting I will take a read through that. Thanks much ^.^
 
1 hour later…
02:28
Ok I like jquery as much as anyone else, but I notice so many people are quick to post that into any JS answer
lol thats great, love the comments. Sadly its so close to true.
 
1 hour later…
03:40
Anyone like PHP?
..... if I say I do will I be booed out of here?
I keep it a secret on proggit
lol
I just implemented a JS style prototyping system for PHP
nice
And am part way into implementing Jquery in PHP (I've got the Attr plugin done)
that sounds pretty cool
03:46
I know there's querypath and others, but I want something fully extendable.
wait.. ok so are you implementing jquery using your js style prototyping system?
cool
if it works, it should be
Neo
Neo
@Raynos @Raynos Thank You
04:20
@Neo oi. Buzzing me
stop that
@ircmaxell jquery in php? Your doing it wrong
lol
why?
04:45
Im actually getting pretty close to 1k. How crazy is it that on a Friday night Im chomping at the bit to jump on any js questions.
05:24
Hello, does anyone here want to help me with my js lib?
can anyone please help me*
 
3 hours later…
08:34
testing
@ryan Also remember to check out the faq
haha sorry
i was just trying to figure out how stackoverflow does their scrolling
in this chatroom
@ryan It uses the scrollTo plugin, though other than that there really isn't anything to it
08:55
I was thinking about the implications of class based javascript. I summarised an interesting paper. In a nutshell, the class-based worldview is more flawed than the one of prototypes. So, we need to be careful. Here is the summary: carnotaurus.tumblr.com/post/3248631891/…
Oh, you must be sleeping
@Carnotaurus I'm not, but I'm a little busy right now ;)
Ok chap - I'll speak with you have when are free
 
2 hours later…
Ab
Ab
11:19
good morning weekenders
Mornin', @Ab
Ab
Ab
yeye
@lonesomeday trying at JS unit testing
@lonesomeday what are you up to?
actually to being with trying to understand and use callbacks
11:52
YO all
@JamesMSiteGen what dod you need?
callbacks are easy
do async(thing, callback);
when thing is done callback fires :D
@Carnotaurus imho we should avoid classes in js. It natively has prototypes and thats enough
Extending the language to include classes would be a real bastardisation
Ab
Ab
12:06
remember the obj.Myconstructor() scenario, iwas trying to run a code that preloads images then callsback to this and continues
could not integrate this to go along with my code...webreference.com/programming/javascript/gr/column3
obj.myConstructor = function ( /* normal paramaters ,*/ callback) {
     // do stuff
     // preload images
     // call callback when there preloaded
}

Gage.speedomater(/* params, */, function( gaugeObject ) {
     // constructor finished
     // do stuff with your guage object
});
+spelling :D
G.speedo = function(some paramater, callback) {
     // do stuff
     preloadImages(images, function() {
           callback.call(this, this);
     });
};

new G.speedo(params, function(speedo) {
      // images are loaded.
      // do stuff
});
@AndyE how's the head these days?
not bad. I just upvoted one of your answers from yesterday :-p
:p
Answer that bounty -.-
no-one is answering
thats 350 rep wasted >:(
which bounty?
12:22
@Loktar 1k
0
A: Checking the contents of the string, whether if its number or any other character?

RaynosFrom the spec: 11.4.6 Unary + Operator The unary + operator converts its operand to Number type. The production UnaryExpression : + UnaryExpression is evaluated as follows: 1. Let expr be the result of evaluating UnaryExpression. 2. Return ToNumber(GetValue(expr)). So calling ...

Because starting answers with "From the spec:" is win.
@AndyE the $.deferred one. My bounty
@AndyE
16
Q: How can jquery deferred be used?

RaynosjQuery 1.5 brings the new Deferred object and the attached methods .when, .Deferred and ._Deferred. For those who havn't used .Deferred before I've annotated the source for it What are the possible usages of these new methods, how do we go about fitting them into patterns? I have already read ...

Someone better answer that :P
@Raynos what exactly does .deferred do? I read the comments but they are a bit too complex for me
12:37
0
A: What are deferred objects?

RaynosRather then telling you what it does, I'll show you what it does and explain it. A copy of the related source of jQuery 1.5 with annotating explaining what's it's doing. I think the comments are mostly correct. This may be of benefit // promiseMethods. These are the methods you get when you ...

Did you read those comments?
also try the api (working link)
Ahh no not that question, your above questions was the one i read, ill have a look
13:21
@YiJiang Yes there is a rise in traffic
someone posted it on reddit, the PM of LinkedIn tweeted about it etc.
@IvoWetzel \o/. can I hook into createElement?
uh
define "hook"
Garden needs a mobile version, to address those issues, but what's the approach to take, hrm...
@IvoWetzel intercept each call
as in whenever someone creates an element fire a callback
@Raynos Doesn't sound like a particularly good idea; why not create your own function which wraps the createElement and call that instead?
13:32
@YiJiang because I want to use a 3rd party library
var c = document.createElement; document.createElement = function(type) {console.log(type); return c.call(document, type);}
?
Approach 1: Use UA sniffing and @media rule to create mobile specific js and CSS. Approach 2: Create a seperate mobile version like, say, http://bonsaiden.github.com/JavaScript-Garden/mobile
hm, I would favor the first approach
Start with the simple one: iPad version should be okay except for the positon: fixed problem, but the patch submitted doesn't look like it would work
iPad portrait and other smaller tablets will probably need one of the sidebar (nav or aside) to be shifted
Smarthphone version will need both sidebar to be moved
yes, but it's quite hard to come up with something when you can't test it on the actual devices
Maybe I'll own a Android phone pretty soon...
13:38
Well, we can look at the print version first: dl.dropbox.com/u/1722364/garden.pdf
I just pushed this print stylesheet, what do you think?
looks quite good :)
although the code stuff in section headings is a bit small
@IvoWetzel @YiJiang you guys are crazy!
@IvoWetzel I've got an android.
see setInterval And setTimeout
@IvoWetzel Yeah, I fixed that bug - specificity problem
Hm... is there any way to force a page break?
13:41
@IvoWetzel There is the page-break-before and -after properties
so that every "chapter" starts at the top of a page
I think we might want to create a small 'print this page' widget somewhere with a hidable list of options
@IvoWetzel It would be more book-like, yes
@YiJiang What do you use for PDF printing?
@Raynos That's how developing for mobile device works ;)
@IvoWetzel Firefox, print to file
The web dev toolbar also have an option to display print stylesheets
I should take some time off to read last year's 24ways
afternoon
13:49
@YiJiang - If you need iPad Screenshots I can help you guys out?
@MylesGray Sure, let me try adding some iPad specific code
Cool, Do you want them hosted somewhere specific?
Not really, imgur used here will work, of course
@YiJiang what is 24ways?
@Raynos 24ways is one of the best designed sites about using LOADS of nice CSS features
13:52
@MylesGray It's the advent calendar for web developers (telling him how amazing the design of the site is won't convince them to read it ;) )
user492203
Hi! :)
hm
page-break-inside: avoid; seems to have little effect in FX
@YiJiang true that - it does look amazing though
EW
That sites UGLY
Well at least 250 have spent +10 minutes on the site so far
13:54
@IvoWetzel I know, Sitepoint reference indicate no support for that value on Firefox: reference.sitepoint.com/css/page-break-after
EW EW EW.
bugzilla.mozilla.org/show_bug.cgi?id=132035 Sigh, reported 2002, no patch received as of Firefox 4
@YiJiang Hm, I think some " Next section title ->" at the end of a section in print would look nice
@IvoWetzel Not sure why you'd want that...?
@YiJiang Aparrently the iPad doesn't like position:fixed
14:00
@MylesGray We know, there's an issue about that right now
@YiJiang With page breaks there's a lot of white space after the dotted border
@IvoWetzel Unfortunately orphan control is also not implemented in Firefox
Oh, we should set a default text-size in print I guess
My printed version has way smaller text then yours
hm, there's quite a difference between the two versions
/me has to stop writing books for answers
@ircmaxell Indeed, better make a PHPGarden and sell that ;)
14:07
lol
my latest:
0
A: Exceptions in PHP. How to use them? How to extend 'em?

ircmaxellExceptions should be typed based upon the error that you find. The Spl Exceptions are a good start, but you really should be creating your own exceptions as well. Some common ones that I use: FileNotFoundException extends RuntimeException <- self explanatory HTTPException extends RuntimeEx...

does it make sense to mix underscoreJS with another lib ? :p
@jAndy Always! Make sure to also include Prototype and Mootools on the same page
/me never thinks it makes sense to ever use more than one framework on a site
@ircmaxell I second that
well.. the thing is underscore is not a real framework is it.. just an abstraction layer for neat tool functions
14:09
@jAndy @Raynos seems to advise using _.js with JQ
@jAndy What else is on the page?
it really has "some" nice methods in there, but then again.. I figure it's too less to mix it with another lib.. like YUI or jQuery
too much redundancy
In that case either write your own helpers, or just write plain JS
I like underscore.. my dilemma is I like jQ more and use it most of the times. So i need a good argument for myself to use _.js too :p
but at the end of the day, too much methods _.js offers are also included in other libs
14:12
@jAndy: what can _ do that jQ can't?
@jAndy If in doubt, just use vapor.js
@ircmaxell: it has some well abstracted methods, like memoizing, Array zipping ..
I actually hoped someone would come one the stage and shout.. "LISTEN .. you can combine it for that , that and this reason" :p
Could you write a plugin for that?
14:16
of course you could. I guess my biggest problem with underscore is that it doesn't pretend to be a real library, just a collection of helper functions (which really is cool since it marshalls everything down to native methods if available)
@MylesGray fucking lies.
Chrome is really the fastest when it comes to rendering of HTML
@jAndy use underscore, and use jQuery for event, dom & ajax
What you need a stripped version of jQuery
remove some of the junk you dont need
@IvoWetzel I don't notice an appreciativable difference there; I might have dropped the font size of the print version by one after I printed the pdf, but truthfully speaking 28 pages for a single webpage is almost a small book already
Hm, I have no background color set for the pre/code stuff in my version
14:19
@Raynos: I actually did that in the past.. but it ended up as disaster :P
Seriously though use underscore.js it's worth it.
@jAndy did you rip parts out left & right?
@IvoWetzel You need to explicitly set that in the print options
or the difference in color is to low
@Raynos: but I guess that was around v1.2.x, they probably improved modularity
@Raynos The fact is that if you load from Google's CDN the chances of your user already having it in the cache is pretty high
If you use your own version it's going to have to be loaded from your own server, which will be slower
14:20
@jAndy go to the github page and compile the seperate parts together
I use underscore for structure of code
jQuery is just abstracting cross-browser compliance away
I use my own abstraction layer for that
underscore is abstracting functional style data manipulation into my code
@jAndy I prefer to use jQuery and not have to maintain / test my cross-browser compliance
Well.. for a really "big" application jQuery is not enough for sure.
@YiJiang ahhh
mootools ftw :-P
14:22
@jAndy of course. but it does some of the low level stuff for me. Of course I test but I don't have to write the code myself
If I didnt use jQuery I would use a library which is a subset of jQuery but not as efficient
I mixture out of requireJS, jQuery, (andy pub/sub layer) and maybe a tool helper like underscore ..
I have my own wrapper instead of requirejs
_JrequireQuery
user492203
Is there any differences between hasOwnProperty and propertyIsEnumerable?
@Nyuszika7H yes. you can set enumerable properties in the prototype chain
@Nyuszika7H also hasOwnProperty works in IE. isEnumerable doesn;t
user492203
14:25
@Raynos hmm, and how?
@Nyuszika7H dont do it -.-
its like comparing apples and oranges ?
propertyIsEnumrable is javascript 1.8.5 no ?
@jAndy ew. Say is ES5
if you can affort to use that, Object.keys(obj) is probably a better alternative for hasOwnProperty
_.keys(obj) you mean?
user492203
14:27
@jAndy TypeError: Object #<Object> has no method 'keys'
@Raynos: :p
@Nyuszika7H ES5 :)
user492203
@IvoWetzel Chrome doesn't support it :/
if(!Object.keys) Object.keys = function(o){var ret=[],p;
 for(p in o) if(Object.prototype.hasOwnProperty.call(o,p)) ret.push(p);
 return ret;
}
@Nyuszika7H Chrome hasn't made ES5 a target
14:29
@Nyuszika7H -.- Object is a constructor
that's MDCs non-ES5 version
Object.prototype.keys
oh wait
No it is on Object.keys
my bad
yep
> Object.keys
function keys() { [native code] }
Chrome 10 dev
anyway, as you can see it's a trivial method
just implement it yourself like above OR use underscore :p
user492203
14:30
@IvoWetzel Oh it's Object.keys
Firefox 4 release schedule is sometime before the end of this month, no?
user492203
> Object.keys('foo')
TypeError: Object.keys called on non-object

> Object.keys(new String('foo'))
["0", "1", "2"]
user492203
Huh?
@jAndy use underscore.
@YiJiang Uh, they're pushin one beta after the other atm, no idea when they'll ship an RC
14:31
@Nyuszika7H Each char in the string can be accessed using [n] where n is the position of the char
@IvoWetzel Yeah, they'd better hurry, I'm itching to get my hands on it, hrump...
is there actually any news on IE9 and websockets ?
@jAndy They're not supporting it, period?
user492203
> var foo = new String('foo');

> Object.keys(foo);
["0", "1", "2"]

> Object.getOwnPropertyNames(foo);
["0", "1", "2", "length"]
I think we were talking about this a few hours ago
@jAndy They have a "test plugin" you can install on some obscure website
WebSockets are getting destroyed anyway with the new draft
14:34
@YiJiang Yeah we were, They're siting the incomplete and changing spec as the reason not to support it
probably, I'm still not able to decouple my body from my head so I wasn't here when you talked about it :p
is that why they don't support text-shadow and a couple of other CSS stuff too? :P
@jAndy looks at AndyE
@IvoWetzel Hang on, IE9 still doesn't support text-shadow? No way man, no way
@IvoWetzel: what do you mean with destroyed? New spec from the scratch or just rejecting ?
@IvoWetzel seriously?
14:36
@jAndy The new draft is basically "implement our own protocol with full blown RSA encryption on top of TCP"
caniuse.com/#search=text-shadow says no, holy crap. goes into a corner and crys
Awwh piss off
this sounds like a bad joke if they won't support websockets at all.. they always were behind on the specs and finally.. when they almost created a browser which does it halfway they stepback from such a point ?
pack of lazy ......
seriously not fun
14:37
They have a trillion of special bit fields in the new draft -.-
It's gonna be a real pain to implement and an overhead of 128 bytes per "*packet*"
@jAndy Firefox and Opera's dropped WebSockets too, no web technology's going to fly without Firefox either
@YiJiang If you really want depressed look at the IE9 column: fmbip.com/litmus
so what does that mean at the end of the day? No consistent spec for socket-connections at all ?
will FF4 not support websockets?
@jAndy It won't, confirmed. It dropped support in beta 8 over security issues
14:39
with no replacement ?
@jAndy you can use websockets through a silverlight bridge in IE9 :D
@YiJiang I was wondering why the HTML5Demo worked in the FF4b6 then broke recently
Well "security" issues....
@Raynos what exactly does Silverlight do/solve?
user492203
14:41
Anne van Kesteren of Opera also announced that Opera are dropping Websocket support.
somebody using a mis configured proxy is a security issue
user492203
Opera are?
@MylesGray That was meant as a joke, ya know
sounds like a major step in the wrong direction at all
Next up: Drop HTTP support, because it's insecure!
4
14:42
@YiJiang I know that, but i still dont get what silverlight solves as a platform
@MylesGray Nothing, WP7 is considered dead
"IE7 and a half 8" browser on that thing
anyway, the "Transparent Proxies: Threat or Menace?" paper is serious
@IvoWetzel Their next next update codenamed Mango is going to update that to IE9 standard support level, or so they say
Aparrently Chrome still supports websockets: fmbip.com/litmus/#mdz_websockets
@MylesGray silverlight is like flash but made by microsfot. Its absolute shit
14:44
@YiJiang Really? Hm, they still have to make that fast
@Raynos Not that Flash is any better, hrmp...
@Raynos I thought it was something like that but are you forced to use that shit renamed FrontPage app of theirs "Expression Web"?
I have to use that in one of my modules and it's actually slower than hand-coding
I can't believe Flash's performance on Linux is still so anaemic
nothing is one click
@YiJiang I cant believe flash crashes every 5 minutes on linux :D
14:46
@MylesGray EW isn't for Silverlight, it's their front-end web dev tool
@YiJiang do they have an IDE like Flash does?
"our results demonstrate that all the major current mechanisms for verifying consent are broken in the face of certain transparent proxies."
booooom, "in your face, whoever wrote the websocket specs"
@MylesGray Not exactly, Blend is for the visual aspect, but most programmer will work with VS with Silverlight, so a bit more like Flex and Flash Builder
Microsoft Expression Blend is a user interface design tool developed and sold by Microsoft for creating graphical interfaces for web and desktop applications that blend the features of these two types of applications. It is an interactive, WYSIWYG front-end for designing XAML-based interfaces for Windows Presentation Foundation and Silverlight applications. It is one of the applications in the Microsoft Expression Studio suite. Expression Blend supports the WPF text engine with advance OpenType typography and ClearType, vector-based 2D widgets, and 3D widgets with hardware acceleration v...
If you use such a "thing"
...
I don't consider you a developer
@YiJiang +1 thanks, I get it all free from my uni along with a LOAD of other M$ stuff... wanted to know if it was worth it
Its ridiculous that they just ram ASP down our throats as if "this is the best dynamic language for the web" and act as if php doesn't even exist or is moot due to it being open source and therefore "not secure"
14:51
I just checked the official MSDN table, no text-shadow support in IE9. WTF!!?
@YiJiang Read the comments on the latest IEBlog entry for more WTF
@IvoWetzel @YiJiang take it. IE9 sucks
Their table says CSS3 | 134 | 100% -___-
@YiJiang back to the old Microsoft.directX2d.filter.whatever.thisIsShit.whyDoMicrosoftEvenTry.blur.shadow.shit(0, 66, 12.54, pi, 3000000);
3
@YiJiang Sure, 100% of the CSS3 stuff they've implemented :P
14:53
@Greg: haha
I guess it's time for _.css
@YiJiang Your surprised?
@jAndy no. No DOM in underscore.
@IvoWetzel Mind taking two seconds to answer this? github.com/BonsaiDen/JavaScript-Garden/issues#issue/5
Oh dear... forms 2.0 looks like it wont be implemented by any browsers other than opera until the net major rev
I've already made the 'this isn't what the garden is for' point, you have anything to add?

« first day (119 days earlier)      last day (5054 days later) »