« first day (965 days earlier)      last day (3998 days later) » 

2:06 PM
jsfiddle.net/rlemon/kLp4K/7 (add gravity_x to see it pool)
how does this look?
little laggy, but I can work on that.
 
@rlemon it looks blank with a blue line at the top
ah, better now
 
yea they fall there
 
@rlemon very nice! jsfiddle.net/G62MX
Good job
 
Did someone already remake the codegolf room?
 
Mhmmm, Bacon-Cheese Croissant.
 
2:11 PM
@OctavianDamiean What type of croissant ? A real one ?
 
Well, I suppose.
'cept with bacon and cheese.
 
@ShannonStrutz Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@BenjaminGruenbaum haha, scroll to the bottom to get the properties.
 
@rlemon pretty cool
 
2:13 PM
bacon and cheese are irrelevant details if you have a real croissant (that is a French one, even the biggest hotels in the world aren't able to make real croissants if they're not in France, that's one of the nature's laws).
 
@Loktar did you change anything? or was that one just smoother by coincidence. ?
 
yeah
I changed the force or whatever
press *= 0.85;
 
the "water" should settle
 
Crazy guy.
 
2:14 PM
@dystroy Let me rephrase. Mhmmm, Bacon-Cheese Croissant¹. 1: As good as possible outside of France.
 
It might be me being stupid but if I have a click handler like this:
$('#a').find('.b, tr').live('click', function (e) {
console.debug($(e.target).is('#a *'))
});

How can that event be triggered but with that expression evaluating to false?
 
@Loktar That's impossible, you'd simply need more points, water never settles, the changes just become so minor and the number of water particles in real life is so big that it looks like it settles
 
@BenjaminGruenbaum lol you could simulate it easy enough
 
@AdamLynch live is deprecated, and a broken approach, consider .on
 
I'm effectively seeing an event being thrown when I click something which is not under #a
 
2:15 PM
Croissants.
2
There are some at my company once a week.
 
Codegolf is up
 
croissants !
 
@BenjaminGruenbaum yeah I know it's deprecated but I doubt it's really down to that surely?
 
croissants and pain au chocolat
 
Kwasaunt
 
2:16 PM
^ still my fav liquid sim in js
 
@AdamLynch live was taken off in jquery 1.9
 
but way over my head.
 
@AdamLynch Create a fiddle.
 
@FlorianMargaine I know
 
@FlorianMargaine Really?
 
2:17 PM
@BenjaminGruenbaum yeah iirc
 
I think what it is is that .live is being attached to the last query
 
it's deprecated since 1.3
 
so ".b, tr"
 
@Loktar doesn't work here
 
@FlorianMargaine yep, removed in 1.9
 
2:17 PM
@dievardump click
 
so any tr click will trigger it
 
you have to click it to "pour" water
 
oh yes, gorgot about that
 
Damn, now I want a chocolate croissant ...
 
Yes this one is great
 
2:18 PM
since "this" inside the event handler is a TR
 
Tim Holman did that one
 
Gonna try prove that with $('#a .b, #a tr').live
 
@OctavianDamiean you mean a pain au chocolat ?
 
@AdamLynch Anything stopping you from using .on ?
 
@BenjaminGruenbaum it's different. We've existing code that relies on .live
 
2:19 PM
@AdamLynch that's weird
 
like if we want to use .on, we'd have to attach it each time the elements are added to the dom
right now we just call this .live in the doc ready and that's it
we're moving over to .on for everything
but the priority today is just to fix this
 
@AdamLynch no, on supports delegation too
but yes, your issue is weird
 
please take look at this jsfiddle jsfiddle.net/ALSFd/4 I am trying to access a variable inside an object, which I am finding it difficult. Also could someone recommend me js debugger ?
 
@CallMeDummy chrome dev tools or firebug
 
@FlorianMargaine thank you
 
2:22 PM
I hate waiting in lines
 
@AdamLynch The target of the event would be #a
That's how delegated events work, unless jQuery does some voodoo in the middle
@Shmiddty Really, because everyone else loves to wait in lines
 
That's weird, I would have assumed the opposite is true.
 
@BenjaminGruenbaum no, it's either .b or tr
@AdamLynch use $(this) to get the clicked element instead of e.target, event delegation allows you to do that (that's its main feature)
and use delegate
 
@BenjaminGruenbaum e.target was not #a
but "this" was a TR
not inside #a
so yeah I was right
yeah I could use event delegation sure
but it's really unexpected that using $elem.find(...).live does that
gonna check that it exists already
oh, didn't say... changing it to $('#a .b, #a tr').live prevented the bug
 
jsfiddle.net/rlemon/kLp4K/9 looks pretty cool if you just let them all group together.
 
2:27 PM
@Oli Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Welcome, @Oli
 
@WillPiers Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Welcome, @WillPiers
 
My well of hate has run dry
 
@Shmiddty You could always hate me.
It's really easy, actually.
I'm kind of an idiot.
 
2:29 PM
Do you rape children?
 
I'm on fire today:
0
Q: Bug when clicking "Save and Copy Profile..." fast

Benjamin GruenbaumAt the moment, you get an error message when you try to update your profile fast. Steps to reproduce Go to your profile page in StackOverflow (or another SE site) Press "edit" to edit the profile Immediately press "Save and Copy Profile To All Stack Exchange Accounts" How this happened to...

@AdamLynch What is e.target?
 
@BenjaminGruenbaum an anchor inside a TR not inside #a
 
@BenjaminGruenbaum You shouldn't answer meta.stackoverflow questions while on fire
 
2:31 PM
"this" is the TR
 
@AdamLynch Oh, that makes perfect sense then :)
@Neil lol
 
Stop, drop, and roll, man
 
@BenjaminGruenbaum No
 
@BenjaminGruenbaum is it opposite day today? hahaa
 
2:34 PM
First of all, you are rolling your own crypto (protocol)
 
@AdamLynch e.target is the actual event target , this is the target the listener was attached to
 
posted on June 07, 2013

Okay, now click forward and buy the book.

 
@AdamLynch did you try using delegate?
live might be doing capture and not bubbling iirc, which is why it's slow (and buggy)
 
@copy I wouldn't go as far as to say I'm rolling my own crypto. That solution still does the same thing (send the password to the server) just at a different point. That's a good link though I'll read it.
 
that's just a wild guess though.
 
2:36 PM
@BenjaminGruenbaum yes, but how does it make perfect sense if neither the target nor "this" is actually under #a
$('#a').find('.b, tr').live is triggered for a TR which isn't a descendant of #a
sensical alright
 
@AdamLynch That's just how the API works.
 
@FlorianMargaine No I didn't. I know that would work though. Using $('#a .b, #a tr').live works fine for now. We're migrating everything over to .on anyway.
@BenjaminGruenbaum are you talking specifically about .live?
 
@AdamLynch Yes.
 
@BenjaminGruenbaum I had no idea
 
@AdamLynch Stupid, isn't it? (.live)
 
2:39 PM
@BenjaminGruenbaum Yep. "Chaining methods is not supported. For example, $("a").find(".offsite, .external").live( ... ); is not valid and does not work as expected."
:/
 
How does everyone feel about graffiti?
 
@Shmiddty It's stupid 99% of the time, but can be pretty the other 1%
 
@Shmiddty wouldn't surprise me if that's a new library or tool haha
 
Hah
It'd be a good name for a canvas library, actually
 
@copy I get the sense that you don't like it, but are not telling me the whole story. If you think it's a really stupid idea, or that there is something completely wrong with it, or there is something you'd dramatically change I want to know.
@Shmiddty How do you feel about it? (also yeah, awesome name)
 
2:42 PM
What do you guys use for canvas libraries?
 
About the same as you. Maybe less on the crap %
@shannon I like kinetic
 
@Shmiddty Here (Israel) we get a lot of "X is a king" and very little actually nice graffiti
 
Haven't played with anything else yet
 
Okay, I'm just curious b/c I ahven't found a library that answers my question very well. stackoverflow.com/questions/16431140/…
 
Also, to my defense
> Take this advice as is, before you roll this sort of authentication in a real world business-critical application consult a security expert. This is a serious issue that is both painful and easy to get wrong. You want a security engineer who wants designing the specifics in your application.
Anyway, I'm off, ping me
 
2:45 PM
@shannon don't know what your question is, but libraries aren't always the answer
 
Here's my take on graffiti: coutoart.com
 
@Shmiddty Question: "What interesting libraries are there with rare books in the bay area"
 
yeaa good point. I don't want to load a bunch of libraries and slow the loading of the website
 
I kid of course, it's jQuery garbage ^_^
 
2:46 PM
jsfiddle.net/rlemon/kLp4K/12 click and drag around :D
/me is a happy rlemon now
 
@BenjaminGruenbaum Well, some of the problems mentioned in the article are huge. 1. You don't have a RNG. 2. How would you know if String.fromCharCode works. There are many places it could be changed. Also, you did invent a security protocol, that might or not be safe. Nobody knows. It could be unsafe, many protocols are unsafe
 
What exactly are prototypes and binds in javascript? I've never dealt with either in higher level languages and i've only ever done a PROTO in assemlby
 
LEMON PARTY!
 
:D
 
2:49 PM
is this method discouraged as well ?

Cat = {
    createNew: function() {
        var cat = {}; //create an empty object

        cat.makeSound = function(){ //add logic
            alert('meow');
        }

        cat.makeSoundIndirectly = function() {
        	cat.makeSound(); //use cat instead of this
        }

        return cat; //return the fabricate
    }
}

var cat = Cat.createNew();
cat.makeSoundIndirectly(); //prints meow
 
Yes, you create the functions again for each object instead of storing them on the prototype
 
@rlemon you're welcome by the way haha
 
for?
I opened your fiddle, didn't notice anything new and closed it
 
@CallMeDummy

function Cat(arg1, arg2) {
    this.arg1 = arg1;
    this.arg2 = arg2;
}
Cat.prototype = {
    doSomething: function() {},
    doSomething2: function() {}
}
 
@rlemon hmmm
your newest version has the code I added
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
 
2:50 PM
actually I added that myself
 
@rlemon weird
 
when I added the drag
 
exact same
 
yea
because we both c&p'd it from the same site likely.
 
yeah
 
2:51 PM
There's some graffiti on a train I pass daily that says "I'm tired of waiting for your revolution" that I like. It's not particularly artistic or well executed, but the message seems like a jab at the casual revolutionaries (re wallstreet), and not following through with things
 
it's there in my fork jsfiddle.net/9evv5/1
 
notice mines on all three elements
 
yeah
but strange
anyway, I'm off
 
@Gacnt I was following this tutorial gabordemooij.com/articles/jsoop.html. I think i need a new one could you link me to a proper js tutorial ?
 
gluck
 
2:51 PM
@AdamLynch The amount of repetition here makes me so fucking depressed.. Fix your shit CS
 
@Shmiddty And yet a rather passive one.
It's sadly ironic that you're tired of waiting for a revolution, when you could be creating one.
 
@CallMeDummy You don't need to declare the constructor like that anymore,

function Cat(arg1, arg2) {
    this.arg1 = arg1;
    this.arg2 = arg2;
} <---------------------- Is the constructor
 
@ryan layers upon layers in a handful of words
 
Cat = {
    createNew: function(){
        var cat = { 'name':'Sylvester' };
        return cat;
    }
}  < ------ Bad constructor
 
@Shmiddty Indeed
 
2:54 PM
@CallMeDummy Can you read CoffeeScript?
 
@Gacnt sadly no
 
@Gacnt lol, wtf. Why does the author feel the need to complicate it like that
 
@Esailija :/ I dunno :/
 
@gacnt s/read/understand/
Dummy can most likely read
 
LOL
 
2:56 PM
@CallMeDummy bonsaiden.github.io/JavaScript-Garden It's a good guide for Do's and Don'ts
 
$('#user_send_message .close').trigger('click').done(function() { }); says done is not a function
 
I can read assembly better than coffeescript
 
As well as how javascript is quirky sometimes
 
coffeescript is like reading natural language without punctuation, casing etc
:(
 
@Gacnt can you have a look at my fiddle please , I just need help with the accessing object properties, its been bugging me for the past 3 days.
 
2:58 PM
Where is your fiddle
 
Specially when playing with proto
 
@eazimmerman thank you
 
you must only use coffeescript when you drinking a lot of coffee
Can somebody help me with the done problem?
 
@CallMeDummy What's wrong with it anyways, sorry was afk
 
3:02 PM
damn, this turned out well. (pats self on back and goes for a smoke)
 
@JasonBK Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@Gacnt My typing speed is slow sorry for making you wait. I am not able to access the properties of an object like for example

var c = new setupCanvas(400,500);
var ball = new Ball(c);


function Ball(c)
{
this.x = Math.random() * (c.canvasWidth - 60) + 30; // c.canvasWidth is not working, why ?
this.y = Math.random() * (c.canvasHeight - 60) + 30;
this.r = 15;
}
 
How come you pass the c argument to your constructor
But don't declare anything with it
Should just leave it out
 
That dead zone is too damn long
 
setupCanvas doesn't look like an object constructor
 
3:05 PM
@Gacnt but I need the values of canvasWidth and canvasHeight
 
function Ball() {
  this.x = 0;
  this.y = 0;
  this.r = 0;
}

var ball  = Object.extend(new Ball(), { x: Math.random() * width, y: Math.random() * height });
 
You're also not calling init
nvm i see it
But if you put a console.log inside init, you'll see it's not getting called
 
@Gacnt but why is it not getting called ?
 
nobody?
 
@rlemon thanks, I see thats the proper way to call a constructor
 
3:08 PM
@IanWalter Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@rlemon why is it offset from the center of the mouse point?
 
idk, my offsets are always fucked
 
@rlemon but how will I get the width and height from the setupCanvas ?
 
What's setupCanvas?
 
	function setupCanvas(width, height)
	{
		this.canvas = document.getElementById("myCanvas");
		this.context = canvas.getContext("2d");
		this.canvasWidth = width;
		this.canvasHeight = height;

		canvas.width = this.canvasWidth; //why it is not accpeting the defined width and height?
		canvas.height = this.canvasHeight;
	}
its from my fiddle jsfiddle.net/ALSFd/4
 
3:12 PM
Because you declared this.canvas, and then try to access it as canvas
 
@zirak I tried that as well
 
anyone here familiar with the flowplayer api?
 
but did not work
 
Also, format your code: chat.stackoverflow.com/faq#formatting (for multiline, hit ctrl+k)
Define "did not work"
Because this definitely won't work
this.context = canvas.getContext("2d");
Missed that.
Why do you even need that as a constructor? Why not return the canvas element?
 
just to adjust height and width of canvas
 
3:14 PM
function setupCanvas (width, height) {
    var canvas = ...
    //do other stuff
    return canvas;
}
No need for constructor functions or other fancy things. Just a regular function.
 
but then how will I access the context , to use todraw on the other things on the clickof a button perhaps
wait i could create context from the returned canvas
 
The function returns the canvas, so do it as you normally would.
 
yeah, let me try it out
 
var canvas = setupCanvas(...),
    ctx = canvas.getContext('2d');
canvas.onclick = function () { ... };
 
First must this run:

$('#user_send_message .close').trigger('click'); and when that's fishished this: $('#upload_profile_image_error').overlay().load();
 
3:17 PM
Hello..I have what is probably for most of you a basic question...
 
0
Q: rel="nofollow" be removed with javascript, why?

samI was looking through the blog comments of a Alexa top 20000 site, and i noticed something odd, when a comment is view in the source (or in firebug with js the browsers js turned off) the authors name is written like this : <cite class="fn"><a href='http://example.co.uk' rel='external nofollow' ...

 
I need to add two floating menus to an app that uses Jquery and Jquery Mobile..one would contain buttons that when clicked would populate the other...any suggestions as to the best way? Dialogs or popups I believe won't work, b/c the main page and the menu need to be clickable at all times...
 
!!/summon 31408
!!are you alive?
 
@Shmiddty Nope
 
@Matt Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@FlorianMargaine ? :P
 
@Esailija you had an "image not found" because your link wasn't an image
 
should be
 
nope, it's an html page with a png extension and an image in it :P
 
3:32 PM
 
@FlorianMargaine God I hate it when they do that
 
@Zirak damn.
 
They couldn't just leave html pages as html pages and pngs as pngs
 
As a tangent, why are there naked females at the bottom?
Great, another nudity site to remember...
 
It's completely unsuitable to post that sort of thing here.. What was the site for those pics again?
 
3:39 PM
Ping me with stores to order an s4 from in the US
 
@CallMeDummy jsfiddle.net/ALSFd/6 I had to fix A LOT of shit, but learn from it jsfiddle.net/ALSFd/4 << Is the one you sent me
 
@Loktar what is the sane way to delete particles?
 
@rlemon Throw your computer at the floor
 
I've been loking for this word:
!!/tell AmaanCheval define filicide
 
@AmaanCheval filicide A person who kills his or her own child.
 
3:42 PM
I have a render loop, and a delete loop after the fact.. I wish I could group the two
 
I knew of matricide and particide, didn't know there was this big class of 'em: en.wikipedia.org/wiki/Template:Homicide
...it never happened
 
@CallMeDummy Also, jsfiddle already calls window.onload on everything you type in the javascript box, so you don't need to add load listeners for your init function (I wrapped it like that though in case you copy paste it)
 
Whoa
 
The codegolf room is so lonely
 
3:44 PM
@rlemon why
 
@Gacnt Thank you very much, sorry for wasting your time
 
That's why my Q:A ratio is so bad, cause I just answer questions in here :P And not on SO :P
np, seriously though, learn from it
Or I'll cut you up, you dummy :P
 
@Esailija so I don't have to loop the arrays twice.
 
!!/get answer 2128168
 
@Zirak Invalid range specifier Gacnt
0
A: Javascript: copy a directory, excluding internal folders/files

GacntIt is possible using Node.js (and maybe other JS Frameworks, but I only use Node so I don't know about the others) var fs = require('fs'); fs.createReadStream('test.log').pipe(fs.createWriteStream('newLog.log'));

 
3:48 PM
depending on many things, it can be faster to loop twice
 
Nobody uses /get
 
In computer science, loop fission (or loop distribution) is a compiler optimization in which a loop is broken into multiple loops over the same index range with each taking only a part of the original loop's body. The goal is to break down a large loop body into smaller ones to achieve better utilization of locality of reference. This optimization is most efficient in multi-core processors that can split a task into multiple tasks for each processor. It is the opposite to loop fusion, which can also improve performance in other situations. Example in C int i, a[100], b[100]; for (i = 0...
 
Is it even useful?
 
@Esailija game loop, particle array
 
@Zirak I put so much effort into that answer :/
 
3:49 PM
so I need it to be performant for large scale arrays
 
I meant the command, and you probably meant your answer, and this is probably not a large tuna sandwich.
 
@Esailija anywhere between 1000 and 40000 indices, needing to be looped twice each, looping 60 times a second. .
 
Also, @Gacnt, he didn't mention using node, but with an ActiveX object
 
hahaha
Well, he's getting a Node answer, everybody should know Node :P
 
@Gacnt I will make sure to learn as much as possible from it even if my eyes pop out. I have one question though what does this actually do (function () { in your fiddle ?
 
3:52 PM
I wrapped it so that it would call its self as soon as it was done processing
 
But that's an incorrect answer for this scenario
 
 (function() { // Code Here })();
 
@rlemon yes but you are assuming that looping once is faster than twice
 
oh, @Esailija, you're going to get a 100 bounty in the next hour or so, courtesy of @BenjaminGruenbaum
 
you should first make sure that your code is optimized by the optimizing compiler
because many js patterns disable it
after that you can benchmark
 
3:53 PM
@Gacnt by 'it' do u mean as soon as browser is finished processing that part of the function
 
@Zirak nice
 
@CallMeDummy Whenever the browser gets done processing it :P
It also keeps your variables from being in the global space
So they're confined to that scope of the function and not floating around space
 
@Gacnt understood ^_^. Thank you
 
np
 
@Gacnt it doesn't "call itself" that would be recursion. The commonly accepted term is Immediately Invoked Function Expression (IIFE)
 
3:58 PM
@CallMeDummy ^ Haterade, but correct
 

« first day (965 days earlier)      last day (3998 days later) »