« first day (66 days earlier)      last day (4877 days later) » 

12:00 AM
take a look. (:
Oh, you mention that. I didn't read up far enough. Why is it hacky?
 
12:46 AM
Do borwsers autmatically use the jquery-1.4.1.min.js file, or do I need to delete the original jquery-1.4.1.js file and replace it with the .min one? Is the non .min one simply the default for me to use when debugging?
 
Hm? The browser will use whatever script you reference.
 
So if I change src="scripts/jquery-1.4.1.js" to src="scripts/jquery-1.4.1.min.js" everything should theoretically work the same but be faster?
I guess my confusion is why most of the examples of "getting started using jquery" reference the non-min one, if the min is better.
 
well you can try to read the minified version and make sense of it
 
The only difference is that the .min.js file will be smaller for your webserver to serve. So it is a smaller file that the client is downloading.
 
1:34 AM
take that gnome-terminal! stupid scrollbar finally went away
 
 
3 hours later…
4:52 AM
hi all
 
5:38 AM
> Tonight, our local satellite, the moon, will experience a full lunar eclipse. It begins at 1:33 a.m. Eastern, followed by the onset of totality at 2:41 a.m., and the good folks at NASA say the best moment for viewing is 3:17 a.m. The eclipse will be visible across all North America.
 
 
3 hours later…
9:06 AM
kind of a dumb question...anyone know how you rate plugins on jquery?
 
Hi!
 
@jon3laze When you are logged in, the stars are clickable
 
aaahhh
 
@DanGrossman Hi! Do you know how to include Google's JS API in an userscript?
> BC Script Handler encountered an error in "My Script": TypeError: Object #<an Object> has no method 'load'
 
Sorry, I don't know
I don't use any userscripts or know how to write or install them in my browser
 
9:11 AM
I'd only need a function which waits until scripts added with x = document.createElement('script'); x.src = 'http://path/to.js'; document.head.appendChild(x); are loaded.
 
@Nyuszika7H when you say userscripts...are you talking about for greasemonkey?
 
@jon3laze Yep, I use something like Greasemonkey, but for Chrome.
@jon3laze It's called Blank Canvas Script handler.
The following is a list of currently known bugs.

There is little support for the unsafeWindow object because Chrome blocks access to page JavaScript for security
Does not support @resource yet
Does not process GM_getResourceURL yet
Does not process GM_getResourceText yet
Does not process GM_registerMenuCommand yet
 
I know greasemonkey has the @require github.com/Martii/greasemonkey/wiki/…
 
@jon3laze Yep, but it does not work, unfortunately. :/
The following is a list of things that need to be done and features that are currently planned.

Improve performance, especially when dealing with lots of saved scripts
Allow disabling of individual domains for each script by clicking on the script's site icons to gray them out
Display the names of disabled scripts in gray on the script list
Add support for @match syntax used instead of @include by chrome scripts
Add support for missing commands listed in known bugs
Add ability to edit scripts included through @require
This extension lets you customize web sites by running bits of JavaScript on pages. It's kind of an unofficial Greasemonkey for Chrome, and supports many of the GM_* functions used in most scripts. It is still in the early stages of development, basically in alpha (notice the 0.0.* version.)

Chrome supports installing scripts as extensions, but it does not support most of the syntax script writers have been using for years. This extension and attempts to address this by supporting most Greasemonkey functions.
 
@Nyuszika7H ah, i'm not familiar with it at all. GM works in Chrome by default now tho doesn't it?
 
9:23 AM
@jon3laze Yep, but @require does not seem to work with it. :/
I'm afraid that's Chrome's fault… :( But I'd really need jQuery for my userscript, because of the CSS (and Sizzle) selectors.
Wait a minute! Maybe I could do that with CSS? Since it does simple things as hiding elements.
 
@Nyuszika7H It looks like a jquery.js doc is included in the includes file...can you not use jquery?
 
@jon3laze What?
 
I just got an answer to a similar problem I was having and the solution used the $.getScript() jquery method. stackoverflow.com/questions/4497507/…
I'm not 100% on whether that document is actually including jQuery into the Blank Canvas plugin or if it's looking to see if it exists on the page...
 
Nice! I'll try that. :)
Yep, nice! :)
Since variables in userscripts doesn't affect variables in pages (unless I use unsafeWindow), it works fine! :)
 
Awesome! I may have to start playing around with that then :P
 
10:22 AM
@jon3laze Only one real problem: I need to declare jQuery on the first line, if I use jQuery UI or other plugins.
is leaving for a hour
 
10:50 AM
Hi Everyone
 
Tek
hi
 
11:06 AM
high tech
 
Tek
11:23 AM
lol
hi q:
Why did you change your name @ClemDesm?
 
11:41 AM
I'm writing a plugin, I want to be able to have default settings that users can change if they wish. I was using the $.extend() with a function to hold all the defaults $.extend({}, $.fn.settings, options); I would like to be able to separate different categories of settings tho... Would you recommend creating a new function for each category and doing a series of extends...or would it be better to use arrays for each category and keep it in a single function?
 
@jon3laze if it fits neatly into one function, I'd suggest sticking to the single function
 
@Greg Is there a limit to how far you can nest? For instance, can I do something like this? $.fn.settings.css.containerCss{'background-color': '#fff', 'border': '1px solid #888' }
 
@Tek Chouchen is an alcohol. Not really profesionnal :p
 
@jon3laze that seems totally fine ... well, I'd write it :P (not saying much ...)
 
@Greg Good enough for me :)
 
11:47 AM
I think with things like that, as long as it's readable, it's fine.
 
Thanks
 
Tek
@ClemDesm Alcohol can be classy, you know. :)
 
@Tek I TIOTALLY AGRAEE !1 hic
 
Tek
lol
very cute greg
how can I write in jquery a highlight effect? kind of how like windows 7 makes an app glow when it needs your attention
I need to do it for an image
I tried looking in SO but there's a lot of messy code and answers =/
 
11:57 AM
@Tek you could simply apply some CSS with .animate() ?
 
But yeah, making your own highlight effect will be more efficient than tweaking the existent.
 
Tek
@ClemDesm that's what I was thinking
@Greg To be honest, I'm not sure how to change the color of an image with css. is that even possible?
 
Blah, I don't like my new nickname either... and now I must wait 'till 19th of January...
@Tek You could highlight its border
 
@Tek easiest way would be dynamically create an overlay div, apply it when you want to draw attention
 
@ClemDesm Actually, you don't
10
Q: Name Change Limiting can be Broken

TreeSteps to reproduce: Change your name on Stack Overflow. After some time it won't allow to change your name again for one month Create user account in Super User or change your name on Super User with the same OpenID Go to Stack Overflow and associate your account with Super User Now the n...

 
Tek
12:04 PM
@ClemDesm That is a great idea!!!
 
0
A: Adding text scale to jQuery UI Slider

Yi JiangTry using Filament Group's jQuery UI selectToUISlider plugin

Read the comments. What can I say? ><
 
@YiJiang I... can't understand...
 
Tek
@YiJiang In those type of situations I just erm, not reply at all.
@YiJiang That or you could just say no.
 
well I guess I'll wait
 
(typeof val == 'object') ? '\n Node ' + iterateAll (val):i + ':' + val + '/'; is the ? in this shorthand for an if?
is it like saying if(typeof val == 'object') { '\n Node ' + iterateAll(val):i + ':' + val + '/'; } ?
 
12:39 PM
Hi!
How do I iterate through a function's arguments with jQuery's .each() loop?
 
@ClemDesm LOL
 
Tek
that picture is sad
 
@ClemDesm Those sausages are very filling aren't they?
 
Ahhhh
I need to roll my own complete websocket server for node
 
Tek
12:55 PM
How can I fade something in an out every x seconds?
 
@Tek With jQuery?
 
Tek
I know, but I don't get what logic I should use
Oh, I misunderstood the question. yes, with jquery
 
@Tek Use jQuery v1.4.4, it includes the .fadeToggle() method.
setInterval(function() {
  $('.obj').fadeToggle();
}, interval-in-ms);
 
Tek
:O
man, that's rockin'! thanks
 
@Tek I was in the same problem, until jQuery v1.4.4 came.
 
12:57 PM
@Tek I think I answered a question like that a few days ago
 
Tek
@Nyuszika7H sweet :D
 
1
A: Animate image opacity from 0 to 100 and back to 0

Yi JiangWe can create a simple recursive function that calls jQuery's fade function, and when complete, call itself again using the callback supplied by the fade function. With jQuery 1.4.4's fadeToggle function, it can be done as simply as: var b = $('#block'); function fade(){ b.fadeToggle(1000, ...

 
Tek
Actually, what I originally wanted to do
 
@Tek If you'd need to stick with an older version, you could make it for yourself:
 
Tek
is fade in a border back and forth
basically change the border opacity of an ID
the ID is an image btw
with some kind of manual interrupt on click
 
12:58 PM
@Tek Well, to do that you can get the color plugin and either animate the border color or use rgba
 
Tek
I saw something like this on Stack Overflow:

$('#id').animate({ borderLeftColor: "#eee", borderTopColor: "#eee", borderRightColor: "#eee", borderBottomColor:"#eee" }, 800);
 
@Tek You'll need the color plugin to animate color. But I'm pretty sure borderColor alone would do
 
jQuery.fn.fadeToggle = function(delay) {
  if (!delay) delay = jQuery.fx.interval;

  if ( $(this).is(':visible') === true) {
    $(this).fadeOut(delay);
  } else {
    $(this).fadeIn(delay);
  }
};
 
Tek
I don't think it works with images, it's not being very nice
@YiJiang I read somewhere on stack overflow borderColor wouldn't work...
 
@Nyuszika7H Really no need to include === true there - .is won't return anything else I'm sure.
 
Tek
1:02 PM
3
Q: jQuery animate border color on hover?

MikeUsing a color plugin to animate background color on hover. $(function(){ $('.listing-2 li a').mouseover(function() { $(this).animate({ backgroundColor: "#0e7796" }, 'fast'); }); $('.listing-2 li a').mouseout(function() { $(this).animate({ backgroundColor: "#d6f2c5" }, 'fast'); }); }); Ho...

Is he correct when he says to use left/top/etc instead of "borderColor"?
 
@YiJiang It returns false for me if it isn't visible. :/
 
@Tek Testing with jsfiddle
@Nyuszika7H I mean, you can just use if($(this).is(':visible'))
 
6 votes to go!
 
Tek
@YiJiang Makes sense, since .is() returns a boolean, does it not?
 
@AndyE Oy, enough with the self-promotion here
 
1:05 PM
@YiJiang nice :) I didn't know about that.
 
duuuuuuuuude
OK, who did break my syntax highlighting in VIM?
 
@YiJiang it's only self promotion if I give you the link :-p
is() is very wasteful, IMO. It has to do a lot of checks to see if an element matches a selector, much quicker to do this.style.display != "none". It infuriates me when I see $(this).is(":checked").
 
@AndyE usually you can't use this.style.display != "none" to replace $(this).is(":visible") though :)
though $(this).is(":checked") is legal grounds to slap someone
9
 
@NickCraver But you could use $(this).css('display') != 'none'.
 
@Nyuszika7H nope, still not - that's the same check anyway
example: hidden parent
 
1:15 PM
@NickCraver I thought you meant you can't use style.display.none != on jQuery object, without an each loop.
 
@NickCraver: yeah, but I see it used a lot for checking if elements have been hidden by a previous handler (e.g. for toggling).
 
@AndyE that could be, all depends on the situation, .is() itself isn't tremendously wasteful, not in newer browsers anyway, Sizzle.matchesSelector is pretty optimized, and will use a native function if available
document.matchesSelector, document.mozMatchesSelector, etc
 
@NickCraver: mostly I was commenting on @Nyuszika7H's code:
jQuery.fn.fadeToggle = function(delay) {
  if (!delay) delay = jQuery.fx.interval;

  if ( $(this).is(':visible') === true) {
    $(this).fadeOut(delay);
  } else {
    $(this).fadeIn(delay);
  }
};
@NickCraver IE 9 has something like that
 
document.msMatchesSelector :)
there's html.webkitMatchesSelector as well, flavors everywhere!
@AndyE I would comment one up, why make your own fadeToggle() at all? :)
@Nyuszika7H - use proper variable names!, that's not a delay, it's a duration :)
 
What about document.getElementsBySelector()? Chrome does not seem to support it, but I've checked that on a test page, and it worked. Huh?
@NickCraver oh yeah sorry :P
 
1:21 PM
@Nyuszika7H: document.querySelectorAll is the correct name of the method you're looking for
 
yup, querySelector() has other uses as well
jQuery.fn.fadeToggle = function( speed, easing, callback ) {
  return this.animate({ opacity: "toggle" }, speed, easing, callback );
};
 
@AndyE Nice!! Now I can get elements with CSS selectors with vanilla JS! :)
 
much easier, and queues correctly too, it'll fade the toggle off what the visibility is at that time, rather than when it's queued
 
@Nyuszika7H: just don't get too giddy and try using selectors that were made-up for jQuery :-p
 
@Nyuszika7H be careful if supporting older browsers, that won't work in IE<8
 
1:23 PM
@AndyE I know Sizzle selectors won't work with it :P
 
just wasted 2 hours this morning changing a video card...and changing it back :'(
 
Is there any difference between $('.obj').hover(function() { ... code when mouse enters ... }, function() { ... code when mouse leaves ... }); and $('.obj').mouseenter(function() { ... code when mouse enters ... }).mouseleave(function() { ... code when mouse leaves ... });
 
nope, it's just a shortcut that does exactly that
 
@NickCraver I was aware of that :P
 
...then why did you ask?
 
1:31 PM
@NickCraver You've got a new avatar? Nice :)
 
Good Day...
 
gday @ircmaxell
did I already mention my big-unts regexp today? guess not...
4
A: jQuery or CSS: replacing the ® mark with <sup>&reg;</sup>

jAndyA normal Javascript String .replace() should do it: $(function() { $('h1').each(function(i, elem) { $(elem).html(function(i, html) { return html.replace(/(®)/, "<sup>$1</sup>"); }); }); }); Example: http://www.jsfiddle.net/4yUqL/24/ // off-topic...

 
Very nice...
I'm not sure why you would replace the unicode code point, since it's not valid in either UTF-8 or ISO-8859-1...
(Unless JS does charset mangling for you, which I would be really surprised - happily surprised- if it does)...
Yay! Only 34 more upvotes until a gold PHP badge
 
well I didn't follow the suggestion. That character is ascii so he just needs to make sure his encoding is correct
 
@jAndy: Yeah, yours makes perfect sense... Don't overcomplicate unless you need to...
 
1:39 PM
if you would use the unicode character for that you would need to translate actually ANY character into unicode
@ircmaxell: yay, gold badges are nice
 
yeah...
25 from a bronze in Regex, 129 from a silver in MySQL...
 
boobs
I just got it
oh wait, it could be eyeballs
 
yaaaaaa :p I laughed so hard when I looked back at the original regex
 
lol
really hates IE...
Really, setting text-align=left; in a table element doesn't cascade to the child rows? You need to do it in the tr elements as well... FUBAR...
 
1:59 PM
headache at work is the worst.
 
yeah it is
 
1
A: content expand on overflow

ClemDesmYou seriously need to refactor all your CSS. It seems to me that you're using Photoshop or a design tool like this to design/cut and automatically generate html/css. If those did a correct code, a lot of people would lose their job... That said, I may be wrong, you did this yourself. And then,...

 
@ircmaxell that actually is pretty lame
 
Was I too mean ?
 
@Chouchenos: No, you were to the point.
You didn't sugar coat, but you also didn't "attack"... +1
 
2:08 PM
Ok, thought the guy could take it personnaly though
 
@ClemDesm +1 frome me
 
Well, if he does, then reiterate that you're not trying to hurt his feelings or anything, that you just were trying to make the point clear...
 
yeah, you're right
 
Sometimes it's better to be blunt and get their attention... Otherwise they just gloss over the good parts
 
@ a moment, I hesitated to refactor his CSS. It was my job like... 1.5 ~ 2 y. ago...
 
2:14 PM
Is there anyone who has idea about that: stackoverflow.com/questions/4499645/…
1
Q: Two version of the same code returns different result

maveraThe two code below look same but they give me different result in IE8. Do you have any idea about that? $('#frameMain').load(function(){ var bodyHeight = $(this.contentDocument).find('body').attr('scrollHeight'); var bodyHeight2 = document...

 
@mavera: are you sure that this.contentDocument and frameMain are referring to exactly the same document?
 
I checked before and i thinked it's. But I'll check again. I'll be here soon for result, thanks
 
Tom
What do you folks think of me using ii in a second level nested for loop and iii in a third level nested for loop as index variables?
I wonder if there's a more generally accepted way
 
@Tom you should use descriptive names
"inner-loop-counter" is much more readable than "ii"
 
Tom
@drachenstern i stands for index
 
2:26 PM
@Tom If you use i for the first, I like ii ... but I usually use j..k..l
but if you're in more than one nested loop, your usually doing something wrong
 
Tom
@Greg I do use i for the first yes, I was wondering about j k l but k and l do not stand for anything, unlike i which stands for index
 
@Tom oh, I see, you don't understand the notation
You do realize you're wrong right?
 
Tom
@Greg I doubt that to be honest, I'm working on a rather sophisticated algorithm where I need nested loops
 
@Tom: the generally accepted method is to not have more than 2 nested loops ever. And if you need more, change the scope (and make an inner loop into a function)
 
Summation is the operation of combining a sequence of numbers using addition; the result is their sum or total. An interim or present total of a summation process is termed the running total. The numbers to be summed may be integers, rational numbers, real numbers, or complex numbers, and other types of values than numbers can be added as well: vectors, matrices, polynomials, and in general elements of any additive group (or even monoid). For finite sequences of such elements, summation always produces a well-defined sum (possibly by virtue of the convention for empty sums). Summation of...
 
2:28 PM
@Tom what does your rather sophisticated algorithm do?
 
because the traditional math model for summation uses i as the iterated variable, programmers adopted it when translating the sigma notation to for loops
111
A: Why are we using i as a counter in loops

tvanfossoni = integer Comes from Fortran where integer variables had to start with the letters I through N and real variables started with the other letters. Thus I was the first and shortest integer variable name. Fortran was one of the earliest programming languages in widespread use and the habits de...

 
Tom
@drachenstern hmm, so it's pure coincidence that it has the same letter as index's first letter?
 
@Tom it is generally assumed to be coincidence
 
Hey everyone, what should I do in order to call a method of a class recursively, but with a delay of x seconds ? I use this.method().delay(x), but it keeps calling without waiting x seconds #prototype
 
Tom
@drachenstern alright, did not know that -- thanks
 
2:30 PM
sadly, we can not ask Babbage
@misterjinx because you're calling the delay AFTER the method
for (int i=0;i<100;i++){for(int ii=i;ii<100;i++){for(int iii=ii;iii<i;iii++){array[i][ii][iii] = i*ii*iii;}}} <-- find the typo.
 
@drachenstern yes, i want to call the method, wait x seconds and then call it again
 
very contrived example, but it illustrates the difficulty in reading this.
so you want to do .method().delay(x).method()?
 
ii++
iii<ii
 
@DanGrossman ARE YOU SURE? It may LOOK like that's what I wanted.
but if they had DESCRIPTIVE names then I would know for sure
technically that code should run.
not throw an error
 
And iii < i since ii will always be >= i
 
Tom
2:34 PM
@Greg it's rather difficult to explain, but it compares multiple tree structures with lots of properties to an individual tree structure and calculates what entries of each tree element match in all other structures
 
So the loop should never execute...
 
@ircmaxell yay for deductive logic, but if that's all you gained then my example was a failure
@ircmaxell one would think
@drachenstern but it's great code if you get paid by the line ;)
 
But since you're not incrementing ii, the middle loop will run forever
 
no, you're assigning it to i on each loop iter
eventually i reaches 100
oh shit you're right
damnit
 
No you're not...
hehehe
 
2:36 PM
I should've used a comma with a preceding empty ;
 
@drachenstern yes, something like that. to call the same method, but to wait some seconds before
 
for (int i=0;i<100;i++){for(int ii;ii=i,ii<100;i++){for(int iii=ii;iii<i;iii++){array[i][ii][iii] = i*ii*iii;}}}
 
@Tom here's your loop-buster: linqjs.codeplex.com
 
damnit
@Tom sounds like a mapreduce or something would work better here
@ircmaxell anyways, once again, declarative names would've made that much easier to figure out ;)
 
Tom
Hmm, I've got the whole thing in my head.. guess I will look for other methods if I get stuck
 
2:38 PM
@Tom from node in tree1 where tree1.nodes.contains(node.value) select node; that wipes out the need to loop over your trees, but returns an array of nodes that match in multiple trees
 
@drachenstern: Well since i == ii for the inner loop, and since iii >= ii by definition, iii < i will never be true. So you'll have the first and only execution for each iteration of the middle loop...
so the whole thing boils down to for (i = 0; i < 100; i++) array[i][i][i] = i * i * i; (unless I'm mistaken)
 
@ircmaxell yes, I agree.
@ircmaxell that was my intent
 
Tom
@Greg the matching is not that simple. Each node has properties which each have their own properties etc. That explains why I need custom matching logic with nested loops, because an node does not have to match completely, only the properties that match will be added -- or the properties of a property that match, etc.
Each property has its own data structure
 
@Tom so it's XML then?
 
@drachenstern Yay! What do I win?!?
 
Tom
2:41 PM
@drachenstern no, it's just a tree structure with rows where rows have properties like attributes etc.
 
@ircmaxell the ability to use descriptive loop counters ;)
@Tom a dynamic textual set of objects which may have 0..M properties, each of which may have 0..N properties ???
 
Tom
@drachenstern something like that yes
I can do it just fine with nested loops
 
@Tom use an XML parser ... javascript can do that with no plugins
 
Tom
@Greg there is no XML
 
@Tom the way you described it sounds like xml
 
Tom
2:43 PM
I don't have a question anyway :) just that you told me not to have more than two nested loops
 
lol
 
@Tom that's funny, that's XML
 
Tom
@drachenstern what is?
 
1
A: PHP cli session warnings

ircmaxellQuite simple, don't try to open the session in CLI mode. It won't work for multiple reasons. So, you could do 2 things (depending on how "dirty" of a hack you wanted): if (!isset($argc)) { //Not from CLI session_start(); } Or, set the session path to something writable (like /tmp) if...

Read the first comment, then the question...?
 
a dynamic textual set of objects which may have 0..M properties, each of which may have 0..N properties -> XML
 
Tom
2:44 PM
@drachenstern well, then it's not that. They're not all textual.
 
..
 
@ircmaxell You can't suggest .htaccess settings for running PHP cli
 
Tom
Doesn't matter anyway, I can traverse through objects just fine
 
.htaccess is read by apache, apache isn't involved in invoking php directly
 
shit... Good point
Thanks @Dan...
 
2:45 PM
I was your answer upvote... a few minutes ago :p
 
Session.auto_start is just freaking evil...
 
9:46AM tuesday... haven't slept since sunday night... :)
my schedule is all wrong
 
Dam... You need to sleep...
 
@Tom how's that? I can put binary data in an XML node, doesn't mean it won't be processed as text. Javascript pretty much everything can become text on the fly. I'm confused. Also, you're processing it wrong if you have a triple-or-deeper nested loop, and that's just good plain coding.
I would like to suggest Code Complete as your first recommended reading
2
 
+1 to Code Complete... It's pricey and big, but worth every penny and second reading it...
 
Tom
2:50 PM
@drachenstern sure I could stringify it, don't see the point though. XML is text, I have a class with objects. I don't see how you can say that my class with objects is XML :)
 
anytime you find yourself doing "complex loop{ complex loop { complex loop } } " say to yourself "there has to be a more readable, more maintainable way.
@Tom XML is in fact a modeling language for an object.
 
Tom
@drachenstern you are probably right, I will have to think about the logic - but it'd probably just be the creation of more functions which in the end are going to function like another loop
 
1
Q: nodejs: your favorite test framework

guilin 桂林I'd like to know your favorite test framework for nodejs.

 
@Tom no that's fine
it's called readability
there's no reason not to have:
 
Someone wants to throw in their close?
 
2:52 PM
"function loopouter(){ for (arglist) { loopinner() } }"
 
Tom
@IvoWetzel to be honest I think that's a very interesting question, even though you could reason it should be closed ;)
 
@Tom it's not really answerable. It'll make a great flamewar tho
 
Tom
@drachenstern it is on an individual base
 
@Tom yes, and individual close basis too
 
My favorite testing framework: End-Users
 
Tom
2:54 PM
@drachenstern yeah, still I'd have loved to hear about everyone's favourite nodejs testing framework
 
so go to P.SE and ask there ;)
 
Tom
@drachenstern P.SE? :)
 
ok, work
later
@Tom programmers.stackexchange
 
Tom
@drachenstern enjoy, and thanks
 

« first day (66 days earlier)      last day (4877 days later) »