« first day (20 days earlier)      last day (4922 days later) » 

5:00 PM
interesting. thanks for the headsup
 
np, thanks for answering my "is it a secret"....guess it is :)
 
ok, i found few options called "invalidHandler" which has callbacks called "form" and "validator"
and, i also found option called "showErrors" which has callbacks called "errorMap" and "errorList"
i want to retrieve errorList in invalid handler..
 
validator is the main object, you can get error lists and such off there
 
i see. i can't seem to get the documentation correctly.. should i be looking through the js?
ah
validator.errorList
errorList is a stack
in validator object.
 
when i doubt, console.dir(validator)
 
5:07 PM
thanks :)
 
5:33 PM
WEEKEND!
Who else is excited?
Ok, Im out guys
 
it's always friday in iceland
 
@NickCraver But Friday is a weekday
 
hah
 
5:41 PM
 
6:00 PM
Question
how many questions do you guys answer everyday to get such high reps?
and do reps depreciate over time? lol
 
@tpae No, although some of us wish they do :P
 
well
you didn't answe rmy question
how many questions do you answer everyday lol
i try to answer like 10~15 a day
 
@tpae Go and check the user's profile page, the activity tab tells all.
 
@tpae there's a reason it's called reputation. Some people get high reputation for answering a lot of questions. Some people get high reputation for answering some questions very well. Time will come for you to get a better SO-rep-score. The best way is to read lots of questions, and ask your own questions.
 
i see.
 
7:05 PM
(unrelated to javscript) Does anyone know a math room where you can get help with Math?
*chat room
 
Tek
um
of course
it's at the bottom of every stack*.com website
 
Tek
or that
 
7:33 PM
nice ty
Although not very active
 
Tom
What does it mean when $.contains(container, contained) results in a "a.compareDocumentPosition is not a function" error?
Sizzle.contains = document.documentElement.contains ? function(a, b){
 return a !== b && (a.contains ? a.contains(b) : true);
} : function(a, b){
 return !!(a.compareDocumentPosition(b) & 16);
};
(that's jquery source causing the error)
And, why doesn't jquery throw descriptive errors so I don't have to debug like this?
 
which browser?
 
Tom
@NickCraver firefox
 
it does throw a descriptive error, that function isn't available
I'm guessing you're not passing in a DOM element to $.contains(), is that right?
 
Tom
@NickCraver I'm tracing the elements I pass, a is a div and b is a text node
 
7:40 PM
is it a div, or a div wrapped in a jQuery object?
 
Tom
@NickCraver let me see
@NickCraver is there an easy way to trace if it is or is not?
 
not sure if textnodes can do that either, never tried actually
sure just console.log() it, see if it's wrapped in [] or not
 
@tom pause execution (breakpoint) in firefox and hover over the element, it'll tell you
 
or varName.jquery
 
@NickCraver I've been led to believe that jquery can wrap anything
 
Tom
7:41 PM
@NickCraver it's not a jquery object
 
then I guess text nodes don't have compareDocumentPosition in firefox anyway
slap a demo up on fiddle?
 
Tom
@NickCraver how does one create a text node?
 
document.createTextNode("text");
 
7:46 PM
that test passed a jQuery object
 
from what I'm seeing on QM compareDocumentPosition is a DOM function, not a node function, yes?
 
Tom
@NickCraver so text nodes are possible
 
yup
 
I would like this one animated:
<html>
<head>
<title>@tab</title>

<style type="text/css">
body {
font-family:"Trebuchet MS";
font-weight:bold;
background-color:#000;
cursor:default;
}

#wrap {
width:640px;
height:480px;
background-color:#222;

-moz-border-radius: 6% 6% 6% 6%;
margin:auto;
margin-top:6.25%;
border:solid #eee 10px;

background-image: -moz-linear-gradient(top, #aadffa 44%, white);

}


.mount1{
position:absolute;
margin-top:180px;
width:200px;
height:300px;
background-color:#00c21a;
-moz-border-radius: 100% 100% 0% 30%;
 
Tom
7:48 PM
@NickCraver well then I am confused. Because I am not passing a jquery object in my code.
 
Hey guys, need a little bit of help with regex and I don't really want to post such a specific question on the site. How can I match temp_timestamp (where timestamp is actually a UNIX timestamp) ?
 
Tom
When I trace it it is not an array but just a div
@NickCraver it was a jquery object, this works: this.windowNode[0]
 
@NickCraver oh, I guess I was supposed to read the WHOLE thing ... /facepalm ... I need sleep
 
Tom
Really strange though because when I console.log it it does not show it as an array.
 
@FreekOne you mean timestamp looks like this: 1288990376
 
7:53 PM
@drachenstern Yup !
 
can you match numbers of other ranges? does it have to be exactly 10 digits long?
meaning, could you have 0934201234
but without the leading 0
trying to illustrate a point / extract more requirements
cos you could just match [0-9]{10}
 
Yup, that'll do
 
@FreekOne so you're saying that you only want to match where there are 10 trailing digits, right?
in the future, this might help you out regular-expressions.info/numericranges.html
 
@drachenstern "temp_" followed by 10 trailing digits
without the quotes, of course
 
of course
k, have fun coding
 
8:00 PM
thanks, I'll definitely look into it because right now my regex is not even NULL, it's undefined, lol
 
Tom
8:20 PM
Is there any documentation for firefox's console.log function, I'm talking about the parameters, it seems like it matters what letter you use after the percentage sign?
 
Tom
@drachenstern ty
 
8:35 PM
well that earlier question sure filled up my tweetdeck with spam:
Why is it that //site.com/path scheme-relative URLS aren't more widely known/used? It comes up on #stackoverflow often: http://goo.gl/NaipC
 
lol, ouch
reckon it was scheme or relative that got you? :p
 
trying to get the word out, they're handy!
 
oh, well yeah, I got that, I meant the spam part :p
 
I don't know programming but I'm good to use jquery plugins and basic editing. But i want to get good understanding of programming to use jquery at expert level. What should i Do?
can any one suggest any good book or article to first to understand the programming basics to understand the all things of jquery
Should i start from this developer.mozilla.org/en/JavaScript/… or can directly start from this api.jquery.com
Is anyone there?
 
8:56 PM
here, but not sure what to give guidance as a good resource
have you written any javascript?
what language do you normally write in?
 
I've very command over XHTML/CSS
 
Do you know how to write any other programs? Have you ever written anything in Java or C or C++?
 
I can use prebuilt javascript/jquery/dojo/php scripts in my project. and doing it from many years
but want to get good command over jquery
no i'm zero in programming
 
Ok, then the best place for you to start learning programming for jquery would be ...
one moment while I look up a resource for you
but I should advise you that you will probably find javascript to be fairly difficult. Probably fairly more difficult than XHTML/CSS
 
I'm zero in programming but good in xhtml and CSS, so can i start directly from api.jquery.com . my purpose is to get expertize in one library and that is jquery
ok so i should learn javascript first , than jQuery
 
9:06 PM
Yes, that would be a fair assesment
 
my one programmer friend suggested i should learn C programming first
and one jquery friend suggested if'm good at XHTML/CSS than i should go to api.jquery.com directly
 
Being good at XHTML/CSS is not an equivalent thing.
Learning C is an equivalent thing.
However, you don't want to learn C, you want to learn javascript, so learn javascript
I would also encourage you to read this book
however, that book may be advanced. Perhaps only the first few chapters would be good?
the first 9 chapters definitely
 
@metalgearsolid Not good for linking, but for personal use api.jquery.com/browser is pretty handy
 
god
that's a big ad
 
lol@big ad ... I figure it's gotta have room to show the scope :p
@NickCraver reckon he can learn from the samples directly with no programming background?
 
9:17 PM
trial/error is a good way to learn javascript
 
comments here:
4
A: Why doesn't indexOf work on an array IE8?

Nick CraverIE<9 doesn't have an .indexOf() function for Array, to define the exact spec version, run this before trying to use it: if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0;...

 
@NickCraver are you asking for feedback?
 
I'm not sure what point that commenter is trying to make....for...in is wrong for an array, for a half dozen different reasons, why would you try to say "...well it's ok in these cases?
why not use the appropriate method that always works?
 
misunderstanding is the only one I know of
 
@NickCraver Please tell me this isn't the same person as before? :P
 
9:27 PM
@TimStone - I don't remember the name, new user afaik
 
Yeah, new user, same inexplicable, invalid argument, heh.
 
It just scares me some developers would rather use 15 caveats, some checks then their code....when they could just use the right method in the first place
 
@NickCraver see if this makes sense:
 
I mean, if for no other reason than taking the easy route....?
 
And that illustrates the difference between enumerating the elements and using an index to iterate. Which is why we have both concepts. You can enumerate the values in a linked list, or you can crawl the linked list and return the values from one to the next. One is a mathematical concept, one is a procedural instruction
 
9:32 PM
Inexcusable over-complication of the code is Enterprise Qualityâ„¢, making it OK. ;)
 
Tom
Is it possible to set the css with javascript equivalent to css style: * { ... } ?
with jQuery
$(document).css({}) maybe?
 
@Tom why would you do that?
 
Tom
@drachenstern I'm developing an app in javascript and want to avoid using html/css as much as possible
 
bad idea then in my book, but I'm just one guy
is this for yourself or for a company?
pretty much either way, it doesn't matter:
 
9:34 PM
you're going to have to at some point
 
then test it in IE.
 
Tom
@drachenstern so you don't know the answer to my question?
 
not really, no, but I don't think it smells right
@NickCraver confirmed behavior in IE8, the target behavior that is
 
Tom
alright thanks
 
@Tom I'd use $('*').css({ ... })
 
Tom
9:36 PM
@Pointy, doesn't that set the css of each element? Seems like a lot of overhead compared to css * { }
Maybe I'm wrong
 
@Tom Well it's what * { ... } means in CSS, so that's the only way to get exactly the same effect. I would not advocate doing that, personally.
 
Tom
Alright thanks @Pointy
Damn, they should really block the return button on this chat
If you loose focus by accident and press the return button you'll leave the chat
 
Using the "class" attribute to drive appearance changes is, in my personal opinion, a much more flexible way to keep an app clean. You keep the "why/when/how" logic in your Javascript, but the CSS dictates the "what it looks like". Plus you can take advantage of efficiencies of the built-in DOM engine for performance.
 
Tom
Anyway, @Pointy, I believe what you said will not work for elements created after setting the css like that
 
@Tom That is correct - personally I would only code that in some weird dire emergency. I'd much rather do things with CSS.
 
9:40 PM
@tom that is correct, it won't
 
Tom
@Pointy $("html").css("margin", "100px"); seems to work
Not sure if it's exactly the same though
 
agree with pointy we should leave styling for CSS. to keep content , style and Behavior in separate layer
should only for jquery is needed thing is not possible with CSS
 
@Tom Well * {margin: 100px} in CSS means that every element on the page (barring other styles) should have a 100px margin.
 
Tom
@Pointy, I realize that - actually I said something that doesn't make sense, nevermind
@metalgearsolid content is never going to be separated anyway because you insert elements in their respective positions with javascript
 
my point was ,content should be accessible without javascript.
 
Tom
9:54 PM
@metalgearsolid for a simple website, yeah
nowadays you can create apps you'd otherwise have written for a normal client side language
 
Is anyone familiar with the workings of document.activeElement?
 
the focused element?
 
@NickCraver Yes. Is it possible to use it in the blur event to see what the newly focused element is? Does it reliably work cross-browser?
 
no to the first, yes to the second, unless you're using it in some strange way
the problem is that it doesn't change until after the blur event, so you can't get it in the new handler, for example if you click elsewhere, you get blur then click, the activeElement isn't changed until that click event changes the focus
 
I was gonna say, you don't really get a duringBlur event ... just "hey it did blur already!"
 
10:09 PM
@NickCraver Yes, that was my assumption. The best work around that I thought of was using event delegation on focus and caching the newly focused element. Ugly and unreliable, though, if you have more than one focus handler...
 
ummm
if you knew what was being focused, store it was like lastElement somewhere, compare that in the next focus handler?
 
@NickCraver where are you from?
 
@Johnson - Dagobah
 
@NickCraver that's the only way I know to do it. and if it's important enough, you will
 
I was going to guess "the future"
 
10:12 PM
@NickCraver I would prefer to be from Bespin
 
@NickCraver Yes, that's pretty much what I thought. (This is theoretical, thank goodness.)
 
@NickCraver what timezone is that?
 
if you're using jQuery it'll bubble focus for you, so just a focus listener on document with e.target would work wonders
 
@Johnson seriously?
 
@Johnson - heh, EST
 
10:13 PM
@Johnson Z+13
 
@drachenstern I dont know any country called dagobah
 
@Johnson you don't enjoy much western culture do you?
or google?
 
I just googled, i got some women pictures wtf
 
{| class="toccolours" border="1" cellspacing="0" cellpadding="2" style="margin: 0 0 1em 1em; float: right; width: 3px; border-collapse: collapse;" |+ Dagobah | colspan="2" | |- ! Distance from Core | 50,250 light years |- ! Region | Outer Rim Territories |- ! Selectors | Sluis sector |- ! Systematics | Dagobah system |- ! Number of suns | 1 |- ! Number of moons | 1 |- ! Major species | Swamp slug, Dragonsnake, Knobbly white spider. |- ! Population | One known sentient: Yoda |- ! Official language | None, but Yoda uses Basic. |- ! Terrain | Swamp, forest |- ! Surface water | 88% |- ! P...
 
pretty please can I link him to google.com/search?q=dagobah ...
 
10:14 PM
wow that's quite an article summary, not
 
Dagobah is a fictional planet in the Star Wars films, The Empire Strikes Back and Return of the Jedi.
@NickCraver I concur
 
omg..
you fool me
 
nice one
 
@drachenstern tinyurl.com/22omf2z ;-)
 
10:15 PM
Why i wonder is because never seen you offline, do you ever sleep
 
why am I worried?
 
@drachenstern tinyurl.com/
 
i sleep on tuesdays, usually
 
that was yesterday..
 
10:17 PM
the day where i was confused in server requests
 
what time zone are you in? GMT-72?
2
 
haha
gmt+1
 
does Zulu+13 exist?
 
yep
 
dang
 
10:18 PM
-14 as well iirc
 
I see this
 
this came up once doing geometric searches on sql 2008
 
so I should start saying Z+24 ... that would be better
 
well it's debatable right?
 
Im having a normal $.ajax, I would like to inform the $.ajax if there's any error response from the url. So example if $_POST["planet"] is empty, and i check it in PHP if(empty.. how can i message back to the $.ajax and tell it to show it as a alert?
 
10:20 PM
I mean "tomorrow" has some repetition in there...but more letters, while "Z+24" involves a shift+=, but is shorter
could go either way on that one
 
@NickCraver only when the time doesn't hinge on an orthogonal plane ;)
@Johnson I believe that method exposes an event for that, no?
 
geolocation based area searches in sql with spherical coordinates, fun times
@Johnson - what does it normally return, if there's no error?
 
error(XMLHttpRequest, textStatus, errorThrown)
 
a <div..
 
@NickCraver I was thinking more about firing a rocket at right angles to reality, to attack the next dimension up ... Ahhh H2G2
 
10:22 PM
are you setting the content type in your $.ajax() parameters, or is it determining it off the headers coming back?
 
@Johnson there is also api.jquery.com/ajaxError
 
I am setting the content type in $.ajax parameters
 
in that case I'd set an error and use on of the methods @drachenstern linked above
if you weren't setting it, you could return JSON for messages, html for normal content
 
nonono
it should determine of the headers coming back
headers=response coming back from the url
 
brb gotta help with carrying a few things
 
10:25 PM
@Johnson why are you punishing yourself? You've already got the code on the server to handle the error right?
 
Okay json
@drachenstern I have no error handler, thats what im trying to do
 
I admire that you WANT to learn to manipulate headers and the like, but obviously you're having issues grasping the concepts.
if you're going to parse the headers of the return object, you're going to have to read the documentation
otherwise, handle the error on the server and just send XML back to the client
let one of the XHTML attributes indicate an error
before you display the received data, check for the existance of that attribute
tada! I just determined if I got an error and I didn't have to do any more work than a single check
surely you can handle a javascript attribute check in jquery
does nobody listen to me? You have to be lazy to do this stuff. The laziest programmers appear to be the most brilliant, because we don't do all this work reinventing stuff handling header values. We check for an extra attribute in the return and remove it if necessary.
if the server can catch the error, the server can surely return the error
if the server can return the error, the server can process it to be encapsulated beforehand
 
I am reading over and over trying to understand
 
ok, take your time.
I'll give you a 123 bullet point
1) server returns data normally. Ok.
2) server gets error. how to handle?
a) catch error
b) create a response that you can put the error information in that is also XHTML
c) put in the specific error information
d) put an extra attribute in the XHTML that says "this is an error" error=true
e) return the error to the client like it was a regular AJAX response
f) in jquery on ajax success do if ( $(response).attr('error') == 'true' ) { handle error here separately }
3) go have a beer and don't make more work for yourself
 
can i jump to 3) ? :-D
that was much better than how you explained above this..
 
10:32 PM
lol
 
Ok my turn
 
@Johnson because I didn't think you needed a 1,2,3 like a freshman. Do you?
 
Often, when english isnt my primary language
 
but to modify headers to indicate error status, I mean, that's not difficult stuff but it requires planning and you obviously have issues with handling the headers (because you cocked an eye at it in the first place instead of going "ok I'll handle the headers")
@Johnson don't give me the ESL argument, I know too many guys that English is their second language. You communicate better than most of the world in English.
just slow down and don't look for a complex solution mate
 
Im not giving you any arguments, i dont even know what ESL is..
 
10:34 PM
keep it easy, keep it simple
English Second Language
normally "as a"
but it gets the point across
 
Yes ok i get you, and i will get this if i got you to support me
Ok so my turn:
 
You got my support
go ahead, I'm listening
 
1) I have my ajax call, sends parameters to sendPM.php
2) in sendPM.php i have and if statement. The if happen to be false, and therefore outputs "Error: this is not right"
3) How can I set this output right, so ajax detect it as a error
4) How can i work with the error in ajax
4) you already told me above though..
 
I'm still listening
 
Oh, that's it.
What i don't understand about this
 
10:39 PM
so you can go and give it a shot now?
you can try and see how you do?
 
But im stuck at 2)
no 3), how can i make ajax detect it as a error.. Should i use JSON?
 
NO
Are you receiving the data as JSON now?
How do you get the data when it is successful?
 
the data is just normal
 
not what I asked
how does it come to the browser on success?
 
I havnt set a datatype for it
 
10:42 PM
will you get back JSON?
 
if i do success: function(msg){ alert(msg) }
 
or will you get back XHTML?
 
HTML
I get normal html
 
ok, then you should return HTML for the error case as well
if you will just follow exactly my 123 above you will be fine
I even gave you the code to use
 
ok minute
if ( $(response).attr('error') == 'true' ) { handle error here separately }
how can i set that attribute in the PHP?
Just confused me more...
Ok:
I have: echo "This is an error"; on my URL in the ajaxcall
How can i say to the ajaxcall, look for ... and if there is anything, display the error
example if i wrapped the output in to a div
echo "<div id='error'>This is an error</div>";
then i could do if $('#error') alert('#error')
 
10:49 PM
If you're returning an error: header('Content-type: application/json');
then in your success handler:
success: function(data) {
  if(typeof data == "object") { alert(data.error); }
  else { /* do stuff, data is an html string */ }
}
in PHP to set the result just generate JSON:
 
So.........I should have:
header('Content-type: application/json');
echo "This is an error";
 
echo json_encode(array('error' => 'error message'))
 
And that was what i was looking for!
 
@NickCraver I admire the simplicity of that, and I would do that (well, no I wouldn't, I would do something different entirely) but he doesn't know what I mean when I say "add an attribute to the XHTML"
 
ahh, yeah that works too, though more verbose when there is an error only
 
10:53 PM
I got confused when you said that @drachenstern , as I only know JSON to pass back stuff and work with it on success
 
@Johnson but you said you are passing XHTML!?!?!?
 
That's why i asked you above how to set attribute
I am
@NickCraver so can i use this json only for errors, then output the rest as normal?
@nickcraver html
 
yup
 

« first day (20 days earlier)      last day (4922 days later) »