« first day (313 days earlier)      last day (4649 days later) » 

7:00 PM
@Tom browserify them \o/
 
With their "forums" that were broken for over a year or so as I recal ?
 
Tom
@Raynos well that proves my point of it not being trivial
 
user1385191
who knew centering programatically drawn triangles was so difficult
 
@Tom only because jquery sucks
and doesnt work out of the box with commonJS
browserify works with commonJS modules. Write commonJS modules
 
7:04 PM
@MattMcDonald Finding the center of, centering inside the center of another object, or something else?
Triangles are strange.
Do you remember your geometry classes? :P
 
hmm, how can you unit-test a shuffling algorithm?
 
user1385191
well, the general center code in as3 for a top-left aligned object is:
 
Assert the distribution
 
user1385191
x = container.width/2 - this.width/2;
y = container.height/2 - this.height/2;
 
What do you know about a shuffled deck?
 
7:09 PM
@Zirak Run a million loops over it, graph the results out, check for distributions.
 
It should have a distribution of random ness
So state heuristics for order
 
Huh, that makes sense
 
var val = 0;
for (var i = 0; i < cards.length; i++) {
  val += i * cards[i].value;
}
 
user1385191
but I had to do this.width/3 for the y
 
Then that val will have a distribution for 10000 shuffled decks
Assert your actual distribution is within an error margin of a perfectly shuffled distribution
 
7:11 PM
@MattMcDonald Paddings/margins/etc
@Raynos Sounds good in theory
 
@Zirak Can't find the Q, but it talks about random stuff. For instance, is random+random "more random?", it ends up being less random.
Do tables not have a background colour css attribute?
 
It's the basic fisher-yates algorithm, so I know it works, but to feel good about myself...
hmm, I can store the results in an object, and run through to see they're close
 
user1385191
ha, looks like I nailed it via a guess
 
user1385191
the formulaic center of the triangle was 5/3
 
user1385191
//center of triangle given points A, B, and C: x = (A.x + B.x + C.x) / 3, y = (A.y + B.y + C.y) / 3
 
7:15 PM
Does anyone know how to make a answer wiki
 
7:27 PM
In geometry, the centroid, geometric center, or barycenter of a plane figure or two-dimensional shape X is the intersection of all straight lines that divide X into two parts of equal moment about the line. Informally, it is the "average" (arithmetic mean) of all points of X. The definition extends to any object X in n-dimensional space: its centroid is the intersection of all hyperplanes that divide X into two parts of equal moment. In physics, the word centroid means the geometric center of the object's shape, as above, but barycenter may also mean its physical center of mass or the cen...
There's other centers too. It's not that cut+run.
Perpendicular center is another option.
Here, this covers the different ones nicely.... jimloy.com/geometry/centers.htm
 
user1385191
 
user1385191
:)
 
There's no quadrants there!
 
user1385191
it's the heading for a dropdown
 
What're you building?
 
user1385191
7:37 PM
ha, vim's syntax highlighting thinks I'm writing scheme when I do ((something) something else)
 
user1385191
it's essentially an application that organizes data visually and links to various pdfs
 
user1385191
standard government work
 
guys, I need help centering an image inside a container with overflow:auto after enlarging the image width and height. http://jsfiddle.net/RCw4T/1/
the underlying idea is that when the user centers a section of the image inside the container and clicks zoom, the image enlarges but still remains centered on that section. that way you can continue zooming on a section without having to hunt for the section after every click
 
so now we have both the choice of linux and emacs on iPhone
(if you jailbreak)
 
Tom
Meh, never had any problems with android
 
7:50 PM
I don't use my phone for work.
SMS, email, pictures of cats.
occasional phone call.
 
0
Q: jquery center image after zooming in overflow:auto container

sadmicrowaveI need help centering an image inside a container with overflow:auto after enlarging the image width and height. live demo: http://jsfiddle.net/RCw4T/1 The underlying idea is that when the user centers a section of the image inside the container and clicks zoom, the image enlarges but still re...

 
@sadmicrowave few mins
 
thanks @Neal
 
Tom
@Raynos ping
 
@sadmicrowave almost got it
 
7:59 PM
@Tom PONG
You want more feed back right
im on it
 
Tom
@Raynos any idea on how to implement same stuff on the client side without browserify?
no pressure ;)
 
@sadmicrowave got it: jsfiddle.net/maniator/jhDhM
 
Oh no.
Use browserify.
 
@sadmicrowave it might need some tweaking
 
@Neal what broswer? doesn't work in FF3.6
 
8:05 PM
@sadmicrowave try again. i removed the logs
im using chrome 13
 
nope
 
its a bit glitchy and u have to play with the numbers
@sadmicrowave what doesnt work abt it?
 
Any tricks to flatten an array?
 
If I zoom in untill I see x and y scrollbars come up, then position some section of the image in the center of the container and zoom, I should still see that section of the image in the center after the zooming has ocurred
that functionality is not happening in my original example, and in yours
 
@sadmicrowave the one i gave u actually changes the top and left of the image
yours did not
as I said. play with the numbers
it should work
 
8:09 PM
@Neal also, you got rid of the zoom link, I need this as, on my real page there are zoom in and zoom out links rather than clicking the image for zooming
 
@sadmicrowave then how do u know where to zoom to? lol
 
the center of the frame
 
good luck
 
thanks
 
Tom
@Raynos alright. You convinced me. I will try to incorporate browserify. Although I am not convinced about whether it works properly with normal js libraries
 
8:11 PM
@sadmicrowave I FIXXED YOURS
 
It wont realy
 
you have to make them commonjs compliant
 
@sadmicrowave you had the less than/greater than messed up
 
Tom
@Raynos I am not sure if that is possible with every library
 
8:13 PM
@sadmicrowave yay!
 
@Neal your cutting off the top and left of the image the more you zoom in
that is the right track though
 
@sadmicrowave huh?
what do u mean...
@sadmicrowave isnt that what u wanted?
 
zoom in acouple times, then scroll to the very top and very left, notice how the picture is missing portions
 
to keep it centerd?
@sadmicrowave lol woops
that just the way u made it
that wasnt my prob. one sec
 
Who's the jQuery expert here?
 
8:14 PM
well, the way I made it is defunked, thats why I need help...lol
 
@sadmicrowave haha yes u did
 
btw, with my original post parts of the image never got cut off - so, something you changed did that..
 
... Well anyhow... Any thoughts on why this won't work? Seems that IE returns a different readyState / status code than FF & Chrome:

`
error : function(jqXHR, textStatus, errorThrown) {
var serverNotReached = jqXHR.readyState == 0 || jqXHR.status == 0;
if(serverNotReached){
// do something
} else{
// do something else
}
});
}
`
 
@sadmicrowave try this: jsfiddle.net/maniator/RCw4T/11 (if thats what u want ill clean it a bit) you can now drag the image
 
that, plus the centering of the image
 
8:19 PM
@sadmicrowave well the dragging aleviates that somewhat
 
well, hold on
I'd like the scrollbars to still be visible. I created a plugin called dragScroll which moves the scrollLeft and scrollTop values with mousedrag
 
@sadmicrowave why do u still want the scrollbars?
 
mostly because scrollbars for overflow content is standard and my computer illiterate internal users will most likely freak out if they do not see scrollbars
 
@sadmicrowave ehhh i dont know abt that
one sec lemme do centering
 
yea, 1 thing a time
 
8:23 PM
@Tom it is
may require refactoring though
depends how shit the library is
 
Tom
@Raynos what about jquery plugins?
 
@Tom wow :\
@Tom lol jQuery plugins
You bind routes after you start the server?
What the heck
 
Tom
@Raynos answer the question : )
@Raynos you're right they should be bound before the server starts
need to fix that
 
Fixing that for you
I mean jQuery plugins generally tend to be shit
dont use them
 
@Raynos For me ?
 
Tom
8:28 PM
@Raynos I was merely giving you an example ;)
 
Tom
And you did not answer the question ;)
 
@BrianL no not you.
You can use jQuery plugins.
They make live easier
@Tom shouldn't.
Yes you can make jQuery plugins commonJS compliant
 
Tom
@Raynos you're right about the use there. Although what is the error really for?
 
@Raynos , ah, got it
 
8:29 PM
@Tom its merely deprecated.
Will be removed in 3.0
 
Tom
@Raynos ah right, thanks
 
Sigh, this life is so depressing
 
@Tom I'm done.
It's actually done quite nicely
I actaully think the fork and commit is quite a nice way to do code feedback
@Tom Opinion on this method of code feedback?
 
Tom
@Raynos I agree, great. Are you sure you should not also send 404s for posts etc.?
I am fairly sure you should return 404s when applications try to post to a non-existent location
 
8:34 PM
I dont know
request will 404 for you btw
@IvoWetzel no it is not mr wetzel :(
 
Tom
@Raynos ah, in that case this is enough
 
@IvoWetzel happy thoughts. Happy thoughts.
 
@Neal any luck?
 
@sadmicrowave naah im done, sorry, go off what i had
back to real work for me ^_^
 
@IvoWetzel >God is dead, we're drifting in an endless nether. ~Nietzsche
 
8:35 PM
k thanks
 
@Tom your missing the flag to turn debug on/off from the command line
 
@Raynos Not even the weather is with me... this heat... it's exhausting
 
Tom
@Raynos true did you implement that?
 
28 degrees in my room right now
 
@Tom no
 
8:36 PM
@Zirak I'm atheist so that doesn't change it in any way
 
@IvoWetzel It goes deeper than God. Think about it, but stop when your brain is about to explode.
 
Tom
@Raynos "named anonymous functions make call stacks manageable." what do you mean with this exactly?
 
Look at a stacktrace
You will find anonymous functions in it
Give me a second
 
Tom
ah right I see
I do not think it looks pretty though
 
@Tom no it's not pretty
However it is free documentation in forEach and map
 
8:42 PM
Trying to figure out why console.log(response) returns an object that has responseText defined but console.log(response.responseText) is undefined
 
arr.forEach(function _addThemUp(val) {
  total += val;
});
@anilv your mad
 
@Raynos ?
 
@Tom trust me, you want the names in the callstacks.
 
@anilv show ur code plz
 
Tom
@Raynos there is one commit that I do not argee with, those before this one are good though:
https://github.com/Raynos/ExpressArchTest/commit/d0b5191f3bd49900861bdfa5e3d4fc696d39b4ac

The reason is portability and also your "standards" rule. cb should expect (err, result) and this also allows me to copy paste those functions somewhere else
 
8:46 PM
@Tom yes thats iffy
 
@Neal
Check = {
validUsername: function(username) {
return check = $.ajax({
type: "GET",
url: "/check_username.json",
data: "username=" + username
}).responseText;
}
};
 
I dont know whether errors should be piped upto callbacks
 
@anilv format that plz...
 
or piped out of mediator as errors
you probably do want to pipe it up the callback
@anilv ajax is asynchronous otherwise it would be called sjax
 
@anilv ok stop editing
read what @Raynos just said...
 
Tom
8:49 PM
@Raynos what is after?
 
After does reference counting
 
@Raynos Doesn't underscore have that?
 
its not the same
underscore doesnt pipe data through
 
Tom
@Raynos https://github.com/Raynos/ExpressArchTest/commit/d268942ee517e50a443f507b2d9e43911750cf67

wow?
 
@Tom you didnt have a git ignore -.-
 
Tom
8:55 PM
@Raynos heh so you just comitted them all :D
 
Tom
@Raynos alright, read them all now
so you actually agreed with the event naming?
 
For anyone that was paying attention to my Ajax error handling question earlier - it seems IE was giving me an HTTP 12029 error code. Which is apparently a standard for IE ajax errors
 
@Tom it was good enough
 
& thus I was having trouble handling that error
 
8:58 PM
I didnt quite like the getX convention
But it was good enough
 
Tom
@Raynos do you know of a better convention? been thinking about that one for a long time
 
I think something like emit("request#namespace:resource")
and rather then emitting a resource
you can emit("deliver#namespace:resource", resource)
Or add helper methods
.request("namespace.resource") & deliver("namespace.resource")
I prefer those helper methods
 
Tom
@Raynos the helper methods are worth considering
not sure though
it might be worthwhile to keep the event syntax
rather than crafting something so custom
@Raynos what do you think about this way to add libraries to browserify?
gist: 1171963, 2011-08-25 21:08:34Z
var mediator = require('mediator');

/* setup browserify as soon as http server is created */
mediator.once('server.created', function(server) {
    server.use(require('browserify')({
        require: __dirname + '/../../client/js/bootstrap.js'
      , entry: [
            __dirname + '/../../client/js/lib/eventemitter2.js'
        ]
    }));
    
    mediator.emit('browserify.ready');
});
 
seems ok
 
Tom
@Raynos do you not think they should be required?
 
9:14 PM
Ehm I would need to look over the browserify docs
I disagree with the entry
Or do I
 
Tom
@Raynos which docs? There isn't much
 
Theres the github page, thats it
 
Tom
@Raynos yeah, so what do you think?
 
server.use(require('browserify')({
    require: __dirname + '/../../client/js/bootstrap.js'
}));
That should work
 
Tom
@Raynos what do you mean? I need to include custom libraries
 
9:17 PM
Although honestly I have to think harder about this
bootstrap includes custom libraries
bootstrap does everything
 
Tom
@Raynos that would be awesome, but how should I make bootstrap do that?
 
use the mediator
every call to require inside bootstrap will be packaged by browserify
 
Tom
@Raynos huh? something needs to load that library in the browser
 
Because browserify is black magic and it just works
as long as you keep blockingly calling require browserify will make it work
 
Tom
@Raynos yes but it is a normal js library, not a module
 
9:19 PM
Oh no you have to take "normal js libraries" and turn them into commonJS modules
Go talk to SubStack
 
Tom
@Raynos meh, some of my libraries are incredibly complex. Example: github.com/scottschiller/SoundManager2/blob/master/script/…
 
If libaries glue themself to global state then thats their own fault
Thats what you get for using shit design
That one is easy
 
Tom
@Raynos now I'm using shit design?
 
Turn it into a common JS module
by adding
var window = module.exports = {};
To the top.
Oh wait, then its going to break. Great
Add it to the end instead
exports.SoundManager = exports.soundManager = window.SoundManager
Tada. commonjs \o/
 
Tom
@Raynos also, soundManager2 requires me to set a global SM2_DEFER = true; before SM2 is loaded.
 
9:24 PM
@Tom ugh
Hmm
figure it out :P
fucking global state.
 
user1385191
ugh, I remember SoundManager
 
user1385191
giant pain
 
Tom
@MattMcDonald that is not because of the library though, it's because of all the browser and codec vendors
 
user1385191
surprise surprise, it uses Flash
 
user1385191
where it's stupidly easy to handle sound
 
Tom
9:28 PM
@MattMcDonald that's because it has no choice.
 
user1385191
(this is me noting the usefulness of Flash)
 
Tom
well agreed
@Raynos what about this?
exports.soundManager = (function(window, document, undefined) {
    window.SM2_defer = true;
    /* SM2 CODE */
    return soundManager;
})(window, document);
 
Seems good enough
 
Tom
@Raynos so this would actually work?
 
in thoery
 
Tom
9:35 PM
now why do I not like that answer..
 
you have to remove the (function (window) { }(window)) closure soundmanagerhas
 
Tom
@Raynos why?
 
because soundManager is in the closure
You have to return window.soundManager otherwise
Oh wait. globals -.-
fffffffffffffffffffffffffffff
 
Tom
@Raynos you realize just chaining fs enough times does not make it something meaningful? =)
 
hmmmm why was i suspended?
 
9:56 PM
So it looks like the 'datatable' tag is used sometimes for a C# (class?) and sometimes for the jquery package datatables.. should I just propse a tag split on meta, or what is the proper procedure?
 
12 already?
 
@Neal you were flagged
 
damn... spend almost an hour re-organizing my room
 
and then suspended
 
considers calling Kate Upton to remake her website
 
Tom
10:10 PM
@Raynos hmm, not having much luck trying to get EventEmitter2 requirable
 
hmm
go complain to substack :)
Its out my depth / league
 
uff
time for some cold delicious milk :)
and then off to bed
room actually looks.. like a room! and not a dump
 
Tom
I'm trying to make EventEmitter2 browserify requirable: gist.github.com/1172147 any idea what I am doing wrong?
good night @IvoWetzel
 
10:46 PM
@Tom ask SubStack :(
 
Tom
@Raynos the following does not seem to run bootstrap.js when I add /browserify.js to my head, any idea why?
server.use(require('browserify')({
        require: __dirname + '/../../client/js/bootstrap.js'
 
see the compiled source code in the browser
see what its doing
 
Tom
@Raynos it did create the module but I dont think it actually requires it
maybe I have to do that manually
 
Try a manual entry
that calls bootstrap and tells it to start
 
Tom
Yea that works
 
10:52 PM
This is just awesome: while (i --> 0)
 

« first day (313 days earlier)      last day (4649 days later) »