« first day (10 days earlier)      last day (4939 days later) » 

1:00 AM
Anyone have a good page detailing the HTML5 drag and drop api?
 
Can you guys tell me how bad is to rely full on javascript for validation, forms submits and a lot of that stuff, in a codeigniter proyect? this is not because i don't want to validate in php, it's because I don't want my site to run without javascript at all, mainly for UI purposes....
 
There's two things to server side validation. One is for the user, and the other is for yourself. If you care about neither, it's fine.
 
@josecortesp - always validate server-side, no exceptions, also validate on the client-side for better/quicker feedback if possible.
 
@josecortesp One could potentially submit the form with javascript turned off and inject malicious/erroneous data into your database
 
@clarkf what do you mean with malicious data? i know about erroneous, but what about malicious? sql injection and so on ?
 
1:15 AM
Precisely. If you don't validate server-side, they could be putting anything in.
 
@josecortesp - Server-side protects against the malicious user, and this is the very first thing they'll try
 
5
Q: On jQuery, Metadata, and XHTML Compliance

DavidI want to add some jQuery functionality to our sites where one piece of markup will have a click handler which will need to cause action to happen on another piece of markup, i.e. A is a trigger for action from B. There's no guarantee about the relative structure of A and B, so I can't rely on a...

 
@NickCraver @clarkf thanks guys
 
Is it OK to be non-XHTML compliant?
What is the best place for metadata?
 
@PavelChuchuva i think that, it's OK but not elegant.... always try to be compliant
btw, this chat will be my next facebook.... it's so good!
 
1:21 AM
I don't like putting metadata in class attribute. It looks... unnatural.
There are HTML5 data-* attributes
 
@PavelChuchuva I think that jquery and jquery ui stores its metadata in the class attribute, so it shouldn't be that bad...
 
har har har!
 
@PavelChuchuva - there's no issues with using data- attributes in HTML4 as well, I use them when needed
@josecortesp jQuery does not do this, not at all...there is a metadata plugin which reads data from there, but jQuery uses data attributes (since 1.4.3) or $.cache for data storage
 
@NickCraver good point. after I sent that i realize that i was wrong, but didn't have the answer
 
@josecortesp I think @NickCraver is right
In this case data- attributes should be the answer
 
1:26 AM
Yup, and since jQuery 1.4.3 .data() will pick them up from there
parsing them as numbers, JSON objects, etc.
 
Cool, no need for metadata plugin anymore?
 
@PavelChuchuva - nope
 
Brilliant! Now jQuery Validation plugin should be extended to use this new functionality.
 
@PavelChuchuva - added an example to your question for others finding it later, we'll see if it gets down-voted by the "must obey the validator at all costs" crowd :)
0
A: On jQuery, Metadata, and XHTML Compliance

Nick CraverI would use data- attributes for this now, in site of XHTML compliance, like this: <div class="jquery-feature-trigger" data-actson="targetID">Trigger</div> These are an HTML5 feature, but don't cause any issues in HTML4/XHTML other than not being valid attributes in the validator.....

 
@NickCraver Great, thank you
 
1:37 AM
np, seems pertinent given the changes in 1.4.3, I'm certainly finding lots of code a lot slimmer between that and templates
 
@NickCraver "...for this now, in site of XHTML compliance" - spelling?
 
woops
fixed :)
 
Ben
has anyone used jquery mobile with google's map api? I want to set the map width and height to 100%, not a fixed value. However, since the jquery mobile css is in a cdn I can't manipulate the map div parent. Any ideas?
 
2:16 AM
Do it on-the-fly? $('#mapContainer').width('100%').height('100%');
er, if you need the parent $('#mapContainer').parent().width...
 
2:29 AM
I don't mind being corrected, I rather welcome it since it makes the question a better google resource later. However, being corrected for "this is wrong because..." when the corrector is answering a different question it's relatively annoying, answering a question other than what is asked is a never-ending rabbit-hole
 
 
1 hour later…
3:54 AM
test...
 
4:10 AM
test passed!
 
:O
 
my opinion of JS has gone from very very low to moderate in the past year. Thanks, jquery and Crockford
 
Crockford FTW!
 
4:45 AM
That's cool
 
5:15 AM
h
 
hi i am developing a basic html5 canvas paint application can any1 help
i wrote an event listener to perform basic drawing but i want to call the pencil function using the command button rather than the list box
 
 
1 hour later…
6:26 AM
I need some help with Googla Analytics / DFP
 
hi, does anybody here do contract work?
I am having a really really hard time finding some good javascript programmers
 
6:47 AM
any familiar with fancybox
is this right :
$('#close_fancybox').unbind.click(function(){
alert('eh');
});
 
@wcpro I do a little in my spare time
nothing major though
 
Can i do this:
'onComplete':
$('#close_fancybox').unbind('click', function(){
alert('eh');
});
 
@user457827 ..yes..that seems OK
'onComplete': function() {
$('#close_fancybox').unbind('click', function(){
alert('eh');
});
}
 
I don't think you can unbind a anonymous function
var myfunc = function() {};
 
6:57 AM
$('#somewhat').bind('click', myfunc);
$('#somewhat').unbind('click', myfunc);
 
that worked... although no alert box :(
 
will work
 
thanks
 
7:30 AM
oh hai
 
7:48 AM
Anyone still here?
I'm trying to debug some Javascript in VS2010 but keep getting an error when I try to set the breakpoint... "The breakpoint will not be hit. No symbols have been loaded for this document." What am I missing?
 
wy dont you debug ur JS with firebig
firebug
I used to get this error while debugging normal C# code, the symbols file in bin folder wa smissing
 
@JayStevens what browser are you using?
 
8:21 AM
What are the efficiency differences between making a single ajax call to a webmethod with paramaters and having a full page postback with data in hidden fields? (ASP.NET is what I'm using. But I would hope whether the backend is asp or php or etc. shouldnt matter that much)
What are the efficiency differences between making a single ajax call to a webmethod with paramaters and having a full page postback with data in hidden fields? (ASP.NET is what I'm using. But I would hope whether the backend is asp or php or etc. shouldnt matter that much)
Did I post that message twice? It said it timed out.
 
alert("Hello");
 
Hello
 
If anyone has used jstree with jquery, could they help me out here: I'm trying to get a collection of the node objects that contain the LI and context as properties... can't seem to figure it out
 
8:38 AM
You'll have to be less vague.
You want DOM node's with the li and context as properties?
 
@Raynos In simple terms, when doing AJAX query you are only sending data that is relevant to a particular method (so in webmethod call it includes method name and parameter values). When doing a full postback you send back all enabled input field values + viewstate, etc.
 
@Audrius I meant if I were to send the same amount of data via AJAX as a full postback would AJAX be slower. Is AJAX inherently less efficient then a full postback?
 
They're pretty much identical - the only difference is that you do not need to reload (either from cache or remotely) the entire page context in order to show the result.
 
Thank you.
 
I cannot guarantee that, but why should it be less efficient? It does open a new connection to a server, executes query and gets a result. This is the same as doing a full postback: open connection, post data, get response.
 
8:42 AM
So, in my opinion depending on how you handle the result of the AJAX call - AJAX would be a much more optimal route to go than a full postback. Of course all modern browsers should cache content/resources, but when doing a full postback you need to re-render the page, which will take time no matter which browser you use - sure maybe not a huge amount of time but time none the less, time which could of been used to update an element with the result.
takes a deep breath
 
Does anyone know why $.fn.first is so much slower in ie8 then ff ?
Thank you, @Seidr that makes sense. I had the misinterpretation that AJAX was more flexible but slower
 
@Raynos you're welcome :)
 
Good morning guys
 
Hey Golmote o/
 
How are you =) ?
 
8:46 AM
Not bad thanks, working hard :) You?
 
Waking up ^^
http://stackoverflow.com/questions/4021716/convert-simple-addeventlistener-function-to-attachevent-for-ie/4021969#4021969

This function is good for handling events in IE and non-IE browsers, isn't it ?
 
Looks like it should do the job, yeah.
 
Grrr I still don't understand how to put code efficiently in this chatroom
 
Why - are you having troubles with that method?
I must say, I've taken to using MooTools, so headaches like that I do not have to deal with very often any more, so I could be wrong.
 
Well, not really. I just wondered if I should add a fallback with use of direct properties on+event (onclick, ...)
But in my opinion, all browsers handle attachEvent or addEventListener
 
8:52 AM
Yes - I think it's IE that doesn't like addEventListener on some (or is it all) elements as I recall
I love standards - and how some developers decide to write their own :D
 
x)
 
or rather their own interpretations of
 
I'm looking forward to IE9
 
Same here - I've heard good things but have been unable to take it for a spin yet. I'm stuck on XP at work, and when I get home I tend not to think about 'playing' with IE ;)
What has your impression been of it - if you've taken it for a test run?
 
I can't test it... my only computer is XP... ^^ But I read so many good things about it
 
8:56 AM
:p
I really do not like the fact that they've limited it to Vista+
 
Hey... they remain Microsoft ^^ huhu
 
True, I should come to expect - nay rely on - disappointment!
Anyway, back to work :)
o/
 
I got to go :)
See you ^^
 
Cya
 
anyone an expert with jstree?
 
9:06 AM
I have some experience. What do you need, @Greg
Can anyone give a small list of what each javascript library excels at?
I.e. features in mootools, prototype, jquery (vapor) that are unique?
 
@Raynos I've hooked the "select_node.jstree" event to LoadItem(data.inst, data.rslt.obj) ... I really want to be able to call this function on every node in the tree. I can do this now by clicking each one manually, but I want an automatic function to do it...
...the main thing I want is getting at the data.rslt.obj of each node/leaf/whatever
 
I see
A second
 
@Raynos I'd really be interested in seeing this list too
 
jQuery.jstree._fn jQuery.jstree.data and jQuery.data going to snoop around in those.
get_unchecked looks promising.
 
9:24 AM
Yeah, I'll try uncheck_all and then get_unchecked ... see what it gives me
 
Check rollback paramaters. They might have the whole state stored in them
 
@Raynos hmm, when I try jQuery.jstree.get_unchecked(); the console tells me Uncaught TypeError: Object#<an Object> has no method 'get_unchecked'
 
$(id).jstree("get_rollback");
You want to do $(id).jstree("get_unchecked") but best to snoop through rollback data
$(id).jstree("get_rollback").d.html_data is the best I can do for you
 
Tom
Hi folks, I'm trying to get myself a good OOP class structure with private instance members/methods, private static members/method, public instance members/methods and public static members/methods. This is what I got now: gist.github.com/646597 - could anyone verify this?
 
Your going to have to tree walk through it manually.
@Tom you might want to stick to using closure's and prototype inheritance rather then emulating C#/Java based OOP
2
 
Tom
9:35 AM
@Raynos I'm starting on a big server sided project, I like to split my structure in classes
 
Apart from it looking ugly it should work as intended
 
Tom
I made this draft by putting some pieces together from a book called Pro Javascript Design Patterns, but am not sure if all of it is correct
 
@Tom we're doing it the MS AJAX way, which should work best with VS2008 Intellisense, but mostly for historic reasons.
But it sucks the joy out of writing JS.
 
What's the MS Ajax way?
 
@Raynos the way the MS AJAX client libraries are written.
 
9:37 AM
@Tom you might be able to use "this.prototype = " within your function to make it look tidier.
 
Tom
@Raynos, you mean the public static functions?
 
yes tom
 
Tom
@Raynos, how would that make it look better? You mean that I shouldn't chain the prototype and repeat the object name?
 
@Tom you can always split into classes, but the whole distinction between public/private is not very JavaScript like.
 
I think it would look nicer if prototype/static declaration was inside your object constructor
 
Tom
9:41 AM
@Raynos, is this what you mean? gist.github.com/646597
 
@Tom but also I think its more worthwhile to think in terms of closures, object constuctors and prototypical inheritance rather then class based inheritance and public/private/static keywords
 
I would put all functions in the prototype. Why put the functions (methods) in the constructor?
 
@Raynos I think I could get some bad hack going ... do you think it would be possible to fake a click event on each LI in the jstree - would that call the select_node.jstree event?
 
Tom
@DaveVandenEynde to make them private
 
they're not private like that
they're in every instance
 
9:43 AM
how to create variables inside objects, that are not shared?
 
Tom
@DaveVandenEynde How come? I don't think you can access them from the outside
coure06, but defining them inside a closure I think
(which is what I did?)
 
@Greg if you only want rslt.obj then it is can be gotten by tree walking through the dom and wrapping all your dom objects in jquery
 
Tom
but = by
 
@Tom you give me an instace of SomeClass, I can still access the privateStaticMethod function.
 
I have created object like var t = new TObject();
 
9:45 AM
@Tom he means anything with this.function should be in the prototype. If you put them in this you clone each function to the object derived from your class. In the prototype there copied over by reference.
 
There's no such thing as private members in JS.
 
any code snippet?
 
@DaveVandenEynde How can you access the private function defined in the closure from an instance?
 
The only reasonable thing you can do is have a convention, say, use __ as a prefix to all the private members, and mangle them in some form of obfuscation step.
@Raynos say what?
 
@DaveVandenEynde All the instance of SomeClass should have access to are things defined in this & prototype?
 
9:47 AM
any code snippet ? I want to create 4 instances of an object. Each instance will have a seperate copy of inner object
 
@coure06 function() TObject() { this.var = "string" }; use the this keyword then every instance has its own private copy of it
 
Tom
@Raynos, doesn't just using var make it private?
 
@Tom: but how i will access this.var from TObject.prototype.init method?
 
waitaminute
 
9:49 AM
@Raynos: but how i will access this.var from TObject.prototype.init method?
 
if by 'private' you mean 'each instance has its own copy' then yes, putting the function in the constructor makes it 'private', but it's public in that anyone can access it.
 
@coure06 I'm not sure
 
Tom
DaveVanDen, I do actually mean that not everyone can access it
 
The only thing that you can't access are anonymous functions defined in a function and reffered by a local variable
 
Tom
Dave how would you access the privateInstanceMember from the outside?
 
9:50 AM
var o = new SomeObject(); o.privateInstanceMember();
 
@DaveVandenEynde by having a function within a closure only anything within the closure can access it. I cannot call that "private" function directly from within an instance
 
Tom
DaveVanDen, privateInstanceMember is defined inside the objects's return closure
 
hold, on, yeah, I'm now reading your code
 
how to access that private variable inside prototype.init method?
 
@DaveVandenEynde o.privateInstanceMember cannot be called since privateInstanceMember is not defined with this.
 
Tom
9:51 AM
Yes, and you can still use constructors like this: var someObj = new SomeObject().(param1, param2, param3);
 
@coure06 you can't unless prototype.init is defined in the closure. In that case access it directly by name
 
Honestly, I have no clue what that code does. It looks like a very unmaintainable hack to me.
 
Tom
Anyway, @Raynos, you're saying this is bad practice, trying to make Javascript Java like. However, can you tell me how to create well structured and easy to maintain, huge server sided projects? I'm not talking about the small web apps out there
 
@Tom but still avoid thinking in terms of private/public/static and instead think in terms of closures and prototypical inheritance
@Tom I have this basic structure gist.github.com/646622
 
Tom
@Raynos, to me that looks a lot more complex, but maybe I'm wrong. What is the $ for? And why the jQuery?
 
9:56 AM
I'm sorry my brain just exploded.
 
check code jsfiddle.net/HVpdq . i am getting error s.currentBox undefined
 
@Tom thats my client side structure. I dont use javascript server side yet.
@coure06 s.currentBox.innerHtml = this.innerHtml
 
Tom
@Raynos, so how does this allow you to easily scale your app, create new objects etc. without having to scroll through files with thousands of lines?
 
@Raynos: s.currentBox is undefined
@Raynos: although i am filling it with self.currentBox = this;
 
@coure06 your filling it with this onclick. That code gets run before the onclick event
 
10:01 AM
self.currentBox = this is running before the other statement
 
@Tom That's out of my league. You can model java based OOP if you think it will make the codebase organised without training. But still I think you need to ask someone more experienced about Closures & prototypical inheritance
 
Tom
@Raynos alright thanks, I added my code to my question at stackoverflow.com/questions/4008766/… - maybe someone will comment on it
 
@Tom are you using Node.js ?
 
Tom
@Raynos yes
@Raynos, I actually used to use haXe (haxe.org) to allow OOP and it'd convert to Javascript. The problem is I have to create bindings for every library, thus I have decided to learn Javascript and get used to not having a strictly typed language
So far, I have not really found any good resources explaining me how to get going though
 
@Tom I believe the YUI framework has a system for OOP research into that.
 
10:07 AM
good morning people :)
 
Tom
@Raynos, alright, thanks
 
@Tom Javascript the definitive guide 5th edition
 
@Tomalak - hola :)
@Tom - hi toms!
 
@Tom my bad not YUI, the Yahoo javascript resources
 
Tom
@NickCraver Hi!
 
10:09 AM
@NickCraver Hai!
 
@Nick - Is hasOwnProperty() supported in old IEs?
 
@NickCraver 100k, well done man - congrats
 
Thanks!
@Tomalak - how old are we talking?
 
@Tomalak it's not in IE5
I think it's supported in 5.5 though.
 
0
Q: Javascript combine arrays or strings

MirceaI have the following dynamically generated strings: var stringA = ["a1", "a2", "a3" ... 'a600'] var stringB = ["b1", "b2", "b3" ... 'b400'] How can I get an Array or string of both combined like this: var myString = ["a1b1", "a2b2", "a3b3" ... "a400b400" ... "a600"] Thank you

 
10:15 AM
@AndyE Hm, I guess that's ok. Does anybody still use IE5? Even the MS homepages crash and burn on that one nowadays.
 
methinks people didn't read the question :)
 
Tom
Is anyone else disaproving the emulation of private, public instance and static members/method for server sided Javascript with node.js? Eg. an object template like this: stackoverflow.com/questions/4008766/… ?
 
@Tomalak I believe hasOwnProperty dies on DOM objects but you can get around it with the prototype msdn.microsoft.com/en-us/library/328kyd6z%28VS.85%29.aspx
 
@Tomalak Don't think so. hasOwnProperty was definitely introduced in IE 5.5, I just looked it up.
 
@Tomalak Anyone who uses IE5 and theres to ask for a working version of a website for IE5 gets taken out back and shot
 
10:16 AM
@Raynos Yeah, a few Object.keys implementations throw errors because of that issue.
 
@AndyE Thanks. :) IE5 is out of the question anyway, I guess.
 
Kneel before @zod!
 
@Raynos "theres" == "dares"?
 
@Tomalak Yes check the oxford dictionary 26th oct edition
 
@Raynos Hm? I didn't mean to nitpick. ;-)
 
Tom
10:20 AM
@Raynos, actually I think one problem with my draft is inheritance.. as far as I know the private fields wont be accessible by classes extending this object
 
@Tom that is correct. There not private but rather class local
 
Tom
yea, well that's a big problem..
 
This is a general interesting question. As how to structure Object constructors in javascript for a large maintainable project
 
Tom
maybe I should go to the node.js mailing list instead
 
I guess great structure templates are well kept secrets.
 
Tom
10:27 AM
@Raynos, maybe, there sure are a lot of projects being developed for node.js now so you'd think these people must have something setup
 
@Tom is node.js only suited for some projects or is it meant to be a general backend replacement?
Would be great to avoid learning php.
 
Tom
@Raynos, it can be a whole backend replacement. I am using it for that. I am setting up my own Node.js scaleable web server with a templating engine etc.
 
node.js doesn't replace a server-side platform yet, it needs to mature a little first, lots of functionality missing that every other platform has added over the past decade
 
Tom
howtonode.org is run purely on node
as are some other sites, though they are quite small at the moment
 
@Tom - this is what I mean :) It's ok most tasks, get complex and the functionality just isn't there yet, same as any young technology
takes a community or some other driving effort to evolve the platform to cover all the cases it needs to
 
10:31 AM
Can I mix node.js & php back end? I.e. merge a php based forum into a node.js backend?
 
Tom
@NickCraver, could you give me an example of what it lacks in technology?
Actually one thing I can mention is that it lacks SSL support at the moment, it does have it but apparently is somehow broken
Other than that a lot has been created for node, full webservers etc., see github.com/ry/node/wiki/modules
 
@Tom - most of the encryption either doesn't work or isn't there
you don't have to defend it, I don't mean to criticize it, but thinking a brand new platform has covered every edge case the others learned/dealt with over 10 years is a bit...well, frankly absurb
 
Tom
@NickCraver, I'm not wanting to defend it, merely asking for what I don't know - anyway, I figured the technology is mostly based on google v8 which uses javascript, which is not new
 
on the contrary, it's very new, the language isn't new, using it for everything on a server is
the language is one thing, the API for the platform is another
C# isn't new, but a thousand classes added to the framework are new, each version bump :)
 
Tom
Alright
 
10:44 AM
Does anyone have a solution to reloading in javascript.... but ignoring '#' if its present in the url
I guess rather than reload I could get the current url... remove the hash then direcdt them to that url
how can I get the current url?
 
@Starlin - do you mean a different url completely, or just a different hash?
 
as in no hash
I use the hash to direct the user to a certain part of the page.... I now want them to be taken to the top of the page
 
You can just do window.location = "#"
 
Thanks for answering Nick... I thought this place was dead
I do need the page to reload though
 
it comes and goes, depends on who's awake when I suppose check out the activity graph:
@Starlin - in that case, window.location.hash =""; window.location.reload(true);
 
10:49 AM
ahh great
so simple :)
Thanks Nick
 
np
gotta go for a bit, I answer to a higher authority - and she needs waking up :)
 
I think some people just know too much about the DOM
 
@Raynos - who are they? let's visit their hose with torches and pitchforks
if we do it on halloween they won't suspect a thing until it's too late
 
@NickCraver Where is your house?
 

« first day (10 days earlier)      last day (4939 days later) »