« first day (237 days earlier)      last day (4709 days later) » 

5:02 PM
@ThomasShields see my qunit tests
just clone my git
Once im done testing ill put a live link
 
Might look at pavlov for different project (github.com/mmonteleone/pavlov)
 
I saw a presentation last month where the presenter was using Coffeescript to write Jasmine tests. Very RSpec-ish, if you've ever done BDD in Ruby.
 
That's what I get to do!
coffeescript for everything :o
have you guys seen the .net -> javascript compiler?
 
@david script# ?
Or JScript.NET :D
 
class keyword: yes. There's More Than One Way To Do It.
 
@Nathan it better be good
 
abstract classes would feel cleaner for encapsulating modules that don't have instance variables. Making an Object that just contains functions seems... dirty.
 
user1385191
JS at the moment is too abstract for those new to OOP
 
And I've been reading Crockford's book about different kinds of inheritence, which is fine, but classical classes seem like a useful thing to add.
 
5:23 PM
hi
I have a form where, as long as javascript is enabled, I do not need a submit button; in terms of good practice, should I hide the button (with css); or...? im asking as I read that google does not like hidden element, Im not sure if there is a "good" way
 
user1385191
it's coming around with stuff like get/set operators
 
@MattMcDonald actually JS seems far too concrete - it's all Objects, no classes. Not abstract enough.
 
@Nathan whats wrong with objects?
That's the thing. Js only has objects
thats it
 
user1385191
I like to think of it as you're given the tools, but not the toolbox
 
@aurel who cares if Google doesn't like hidden elements; if the search indexer sees a "Submit" button that's hidden, it's not really gonna matter.
 
5:24 PM
@Nathan I dont want classical classes :(
 
user1385191
whereas more mature OOP languages give you both options
 
@Raynos nothing wrong with objects; it's just that newcomers are confused because most other languages start with the abstract "platonic" class definitions.
 
I dont want js to become hybrid.
I want it to stay pure prototypical OO
 
@ThomasShields thanks
 
user1385191
@aurel quite simply, you prevent default for the form submitting in JS
 
user1385191
5:25 PM
then submit it on your own
 
@aurel, most forms will autosubmit when you hit "enter". A submit button has never really been always required.
 
@aurel chances are the Submit button wouldn't show up in the actual search result anyways.
 
0
Q: javascript closure advantages?

JayWhats the main purpose of Closures in JS. Is it just used for public and private variables? or is there something else that I missed. I am trying to understand closure and really want to know what are the main advantages of using it.

figured some of you would enjoy answering it
 
user1385191
when JS is off, the form will submit on its own
 
user1385191
yes, someone linked to the closure guide!
 
5:26 PM
@Raynos purity... bah. English is far from pure but it's expressive.
 
ok thanks all
 
user1385191
I can't believe it was written in 2004 given how awesome it is
 
@Nathan psh. prototypic OO ftw
just Object.create thats all you need
objects and a clone method (Object.create clones an object and returns a new one)
Every JS dev should read the book about self :P (me included)
 
@Raynos actually just if, !, && and || are all you need.
 
Man elitism is bad :D
@Nathan lets just do brainfuck
 
5:31 PM
@Raynos assembly, man.
 
Psh
I write binary
for x86
I need to learn ARM binary soon
For all 48 processors. Its a pain
 
you guys are so old school. I generate the electrical signals and impulses to send the CPU myself, with a 9 volt battery and a few old wires
 
@ThomasShields Oh yeah there's an emacs macro for that.
 
@Nathan oh yeah forgot about that... LOL
 
Neo
5:53 PM
is there anything wrong serving my static files with ip address instead of domain?
 
I'm kind of iffy about class as a keyword
I fear it will steer people towards using JavaScript with the classical inheritance model versus the prototype inheritance model
assuming it gets used as such
 
@Neo nothing wrong with that, unless you need name-based vhosts, or you want clients to cache them when your dynamic IP address changes.
 
Neo
I have a static ip address
@Nathan tnx, plus the good thing about that is there is no dns lookup and it's cookieless
 
@onteria_ I'm assuming adding class would mean actually implementing classical inheritance (well).
 
Neo
I think it's the best thing, I just don't know why I never seen it done anywhere
 
5:56 PM
@Neo really no cookies?
 
Neo
@Nathan yeah,of course. what do you mean? there is no cookies that the client has to send to the server, the cookies are written with the host domain
 
@Neo I just assumed that cookies would work with an ip-based URL too.
 
Neo
it would if you wrote it when the user was browsing the site with ip but I'm just using ip for static files
 
oh yeah just like static.domain.com
 
Neo
it has the same origin policy as javascript pretty much
@Nathan exactly
 
5:59 PM
but actualily you'd work around their "*.example.com" counterexample that way, nice.
 
Neo
yeah I was using static.mydomain but then I started masking my domain so I don't wanna write server side logic to change the domain in everycase and then create VirtualHost for every chat.*
 
so your main site at "domain.com" could give out "*.domain.com" cookies without clogging traffic to the IP-based URL.
 
Neo
exactly
that's why I'm kinda thinking that I'm missing something and I asked here? doesn't that seem like the best solution ever?
 
the only objection I can think of is that DNS is "normal" for a reason.
 
Neo
plus there is no DNS lookup it's even a milisecond faster
what do you mean?
 
6:03 PM
I must say that for me the best part about university is the library portal access
So many sites with content you normally have to pay for suddenly have easy access
(well, you still have to pay for the student loan but that's a different story)
 
I just mean that DNS is ubiquitous because it's good practice. I guess its main advantages are human-friendliness and persistence (like permalinks for ip addresses).
 
So much fun abusing uni APM and IEEE access
 
For example, it's frustrating at my job when devices or people want to hardcode IP addresses instead of pointing to more abstract service-type names like "ntp.mydomain.com" because then it's a hassle to change everywhere.
 
aint no party like a javascript party.
 
Neo
yeah but this is only being parsed by browser, humans who look at view source are like me and you anyways, or they better be lol
 
6:07 PM
@Neo yes I think you don't need what DNS gives in this case so it's safe to un-use it.
 
Neo
well I'm very OOP, I can change it at anytime from onelline of code in my php
 
@onteria I agree completely.
@Nathan no actually class is a utility to make prototypical inheritance easier
 
Neo
for a second I thought Raynos was agreeing with us, I was like that's the green light right there!
 
Since you can't use name-based vhosts, for futureproofness you might want to have directories like http://[::1]/foo/js/rawr.js instead of just dumping everything in http://[::1]/
 
@Nathan wiat never mind. I read it properly. It is implementing classical OO
 
6:10 PM
@Raynos and you wouldn't have to use it.
 
Neo
well what I have a social network then I installed an ajax chat that works with browsers that can use Cross Origin Resource Sharing
so my social network is masked with lets say foo.com and bar.com being the same sites
 
@Nathan lies. I'm not a solo coder.
 
Neo
each connects to chat.[another-servers-ip] so like ht7p://chat.109.0.0.1
 
@Raynos Syntactic sugar around Object.create() or something?
 
@onteria no. class is classical OOP
 
Neo
6:12 PM
then chat server give back the users display photos to use in chat based by ip of the content delivery network
 
Neo
sorry there is no subdomain chat on the ip though
 
@Neo okay I was wondering how that could possibly work.
 
@Neo the chat server is nodejs right?
 
Neo
@Nathan but I agree with you I feel like I need to create more directories to organize all this lol
@Raynos idealy I would like that but I am still a noob with nodejs
 
6:15 PM
Anyone a jQuery pro?
I want to bind an event under a namespace
then access the internals to check the namespace was implied
 
Neo
@Raynos you missed part of our conversation if I put node I still need apache so it has to be on a different port, @Nathan then I would have to serve files at 208.109.0.0:1337
 
aka. How do I read the internals?
@Neo psh use a nginx load balancer infront of your node & php
 
Neo
I know nothing about load balancing
 
nginx 1 port. Route to node / php based on sub domains
Or if your a real boss write a nodejs load balancer and a mod_php in node
 
Neo
@Raynos but they are on the same server or different machines, or I can do either?
 
6:17 PM
@Neo port 1337 is sweet; however corporate firewalls will hate you.
 
Neo
@Nathan it's adult dating social network, I think corporate firewalls will filter it just for the domain name
 
If you only have one IP address you can make either Node or Apache proxy the other's port. E.g. an Apache vhost at "node.domain.com" would mod_proxy "208.109.0.0:1337"
@Neo Ewww. Gross.
You're like a pimp.
 
Neo
@Nathan well my job is exactly like yours. The code has nothing promiscuous in it
 
oh... what I just said Raynos already said better and more nodeishly. Too busy typing, not reading enough...
 
"Subject: Nokia-Berlin Opportunity

Hi Ivo,

I have seen your profile on linkedin and I am very interested to talk to you about opportunities with us here in Berlin. We are looking for talented people with backgrounds similar to yours, based on your LinkedIn profile.
"
ahaha
 
6:21 PM
@IvoWetzel 2000 and Late
 
Neo
@Nathan I have no moral issues with working on it
yeah I marked Raynos's solution as interesting/helpful I'm looking into nginx as we speak
 
@IvoWetzel is that good or bad?
I needa linkedin
I guess its bad becuase its clearly auto generated
 
@Raynos Well.. considering the fact that even the once most biggest Nokia supporters now say that the company is doomed
 
Neo
does anyone know if safari and opera support CORS?
 
I dunno...
 
6:23 PM
@Neo ehm? interesting/helpful? Oh the stars.
 
@Neo I suppose it's arguably better than working for the mafia or a kitten killing factory or something.
 
Neo
@Raynos yeah the little star that puts you on the RSS
 
Ok I have a linkedin. I'll fill it in later
 
Neo
@Nathan yeah to me, I see the traffic, the concept of functionality. they might have naughty names in the GUI but in the code it's the same as anywebsite, plus I think it's fun to work around a page with naked chicks on it
 
@Raynos What the... It's like putting the Java in JavaScript
 
Neo
6:28 PM
@they put the Java in javascript for marketing it with the word "Java" which had all the heat and buzz back then, Raynos is creating a linkedin to market himself, great analogy.
 
wait javascript isnt java?!
 
Neo
its not funny :D
 
@Loktar yeah, and car isn't carpet, mar isn't market, sin isn't sincere, goodbye isn't good, along with a plethora of other half-baked word analogies...
:)
 
lol mar
 
Neo
@Loktar you thought you were a java expert all this time?
 
6:37 PM
yeah, I was about to make my own OS :(
 
:D lol
 
Girl at an interview once thought they were the same thing
im sure it happens alot
it was hard to ask any more questions after that, like I was embarrassed for her
 
Neo
yeah I have a business partner who still tells people I can make a lot of cool shit on their website with jaava
 
Entrenched Java developers here don't think there's any difference, and it shows in the JavaScript they write.
 
bugs make me sad
I have too many
 
Neo
6:40 PM
but I'm not too worried about that, I'm trying to teach him the difference between server-side code and client so he stops asking me to create a web-server with js... oh no @raynos is gonna say use nodejs now! :((
 
@codelahoma fire them :3
 
@codelahoma , do you think that google made GWT just for kicks ?
 
@Neo node. use it. Seriously. It's better then J2EE. I mean node is the best "mainstream" web server stack. You could go with haskell and erlang but thats too hardcore for me.
@teresko I think they made it for the lulz.
 
@Raynos , does it play well with postgresql ?
 
@Raynos Be careful with that "mainstream", you might scare the hipsters away
 
6:41 PM
@teresko define well
@onteria by "mainstream" I mean "not obscure"
 
@Raynos If only I were in a position to. I'd settle for decoupling the front end and leaving it to people that care about HTML, JavaScript, and CSS.
 
Neo
no I love the concept, I just haven't got the time. I'm playing with it here and there. But I even have issues in writing javascript
 
@onteria wait what, arent hipsters those guys in skinny jeans with macbooks? I want to scare them away
 
My boss and my boss's boss thinks Java and JavaScript are the same.
 
@Raynos , last time i looked for ways to use pgsql from node.js , it was some horrible perversion ( half a year ago )
 
6:42 PM
@Nathan Here, you can have this: java based javascript vm
 
@MattMcDonald does the second result here make you sad? data.stackexchange.com/stackoverflow/s/1445/…
 
From the man himself. Your very own ry
@teresko from creatonix github.com/creationix/postgres-js
 
user1385191
@ThomasShields no, this makes me sad
 
Neo
@codelahom I'm right there with you, only if I were in the position too. you know what. I would actually make myself project manager and just sit on a chair and tell people what to code
 
user1385191
user image
2
 
6:44 PM
@teresko github.com/brianc/node-postgres most popular
@Neo dont micro manage.
 
Neo
@Raynos if that's what hipsters are me and that guy who called me one are gonna get in a big fight
 
Employ people who are better then you
 
@MattMcDonald ah yes that draws a tear here as well.
:(
 
@Neo yes. those skinny mac fags is what I tend to call them
 
@Neo Meh. Project management is all the responsibility with none of the fun.
/me is a mac fag, but far from skinny.
 
user1385191
6:45 PM
hahahaha
 
Neo
fat mac fag! fat mac fag! just kidding :D
 
@ThomasShields , i think th 9th and 10th result should make you feel even worse
 
and I switched to mac because it's Unix.
 
Neo
use Ubuntu
it's free and has a good GUI
 
@Neo use brains
 
Neo
6:47 PM
@tresko is that a new linux distro
 
@teresko lol
 
Neo
@Thomas sh..ish! dont say anything, nobody saw it
 
@Neo lol
 
Neo
it's funny how your programming language of choice tells so much about you
 
@Neo no , it is not .. i meant that you are recommending the worst distro out there .. and you are using "free" and "has gui" as arguments
 
Neo
6:48 PM
you ever been in the C room and tried to make a joke
 
LOL
 
Neo
@tresko the guy is a mac user!
fat mac fag, fat mac fag
why else would you use mac? cause it looks nice and flashy
@tresko
I don't even have a gui on half of my computers
 
@Neo no , i am and guy , and i found you recommendation offensive
 
Neo
plus ubuntu has a mac OS theme for mac fags
@teresko I wasn't recommending to you
 
learn to spell
... or use [tab]
 
6:52 PM
Blah blah, enough OS partisanship. Can we talk about editors instead?
 
Neo
freebsd is for freebastards
I like Vim and Dreamweaver CS5, the only reason I have windows on one system
 
Hmmm... maybe we should make a chat room named "Subjective and Argumentative". Then owners can move stuff there.
 
Neo
can we make teresko the admin of it?
lets talk js, what is the best javascript coding practises you've seen in products out there
I mean what applications do you know that are written very well
I hate it when they have php code in the middle of javascript
 
@teresko I use ubuntu
I'm a noob, it's easy to use
and I dont spend hours debugging the command line because "I didn't get it right when I installed something"
 
All you linux/bsd people
whatever hugs minix
 
6:58 PM
@Neo underscore/backbone
 
user1385191
 
minix has a very specific domain
 
or you could go all weird with haiku os
 
@MattMcDonald try to pushing that thing through JSl Lint
 
Ok, this is the first time I'm writing proper js unit tests.
And I'm finding so many bugs
I have no confidence in any code I have written anymore
 
7:00 PM
I use mac os x personally. It feels like I'm cheating on the free BSD distros or something.
 
I mean I wrote this code 2 days ago. It's pretty solid but buggy as hell
 
I do have a server with sendmail running openbsd though
 
st
 
@onteria , if you want weird , try Plan9
 
I find pf to be pretty damn sweet
 
7:01 PM
because it is
 
I also like having fun with spammers using spamd
make their bots waste like 5 minutes
 
user1385191
@teresko I like it because it's the most comprehensive and well-researched browser script I've ever seen
 
Neo
what is the homepage of jslint javascriptlint.com? or jslint.com?
 
user1385191
latter
 
user1385191
it's insanely picky now
 
Neo
7:09 PM
yeah I don't even use it,
it makes me give up on programming
 
user1385191
lol, jshint throws errors on !(condition)
 
Neo
gonna get some work done, see yall later
 
I use globals when I write javascript code, help me!
I've read things about using closures but I'm not exactly sure how to apply it
I don't see it as such a bad thing since I've never been stung by it but at the same time I feel like I should be ashamed when I scroll up my script and see
var gCanvasElement;
var gContext;
var gCanvasWidth = 0;
 
Bugs >_< y u no die
 
@Raynos try the missile launcher.
 
7:24 PM
I only have bug missile
> Me: I've been doing some unit testing at home and just realised how shitload full of bugs my code is. I think it might be good if I spend some time to retro-spective unit testing on code I've written for you
> Boss: FIRED!
 
srsly?
 
No. But I dont know how to bring up the fact that unit testing is important
I mean I always thought I was good at JavaScript.
 
My unit tests are as buggy as my code :(
 
Oh once the unit tests pass there no longer buggy :P
I'm almost finished
 
I haven't written any in JS, only Perl and PHP.
 
7:39 PM
Tests completed in 145 milliseconds.
90 tests of 90 passed, 0 failed.
I'm done for this unit :)
Oh wait >_> Firefox passed too \o/
 
IE?
 
@Nathan fuck IE
 
<blink>hater's gonna hate</blink>
2
 
someone else can debug it in IE
I test chrome (dev) & FF4
Everybody needs more $.fn.placeKitten()
 
@Incognito I think you mean <marquee>hater's gonna hate</marquee>
 
7:56 PM
@codelahoma, nah: <marquee style="text-decoration:blink">hater's gonna hate</marquee>
 
PERFECT!
color: magenta;background: yellow
It doesn't seem right that I should be so capable of deliberately making a page ugly when I'm totally incapable of making one attractive.
 
@codelahoma uses GWT. I hurd u canhaz Javaz Swing librarurs in your brwozerz.
Teh B3st GUI EVarz (Swing) Rite in ur br0wzerz
 
Slander! (until you drop that 's' off of 'uses')
 
As funny as this is, I bet someone has ported the swing GUI library to JavaScript :(
 
i always thought unit testing was for small bits of code, and not larger blocks of logical stuff? Is that a safe assumption?
 
8:10 PM
That's what it should be, but it's not a safe assumption that an unknown person means that when they use the term.
I've worked (work) with a lot of people that use various terms, especially testing terms, in ways that are wildly incorrect.
e.g. Saying they're doing regression testing when they're actually doing a smoke test.
 
8:22 PM
@kevinmansel no. unit testing is for units. all your code is made up of units
all your code should be tested
@codelahoma whats a smoke test
 
8:38 PM
StackOverflow after I downvote an answer "You haven't voted on questions in a while; questions need votes too!" ...Well alright then! downvotes question
 
user1385191
it does the same for me upon upvoting
 
user1385191
questions rarely deserve upvotes
 
@MattMcDonald true. Rarely do questions show "research effort"
Many questions are simply "want make [insert generic feature here] how do this"
 
Anyone here savvy with the jQuery the special events api?
 
@AndyE vaguely
I remember reading about it once :D
 
8:45 PM
lol
 
frameworks have ruined me.
 
I'm trying to update my plugin for normalizing the input event across all browsers. I'd like to override binding to input in browsers that support it, but bind to it later in my code.
 
How do I bind an event handler to a form submit, just without any framework?
 
@Incognito why
 
that's why
 
8:47 PM
@Incognito form.onsubmit :D
 
it's like, document.forms["myform"].submit() does the submission, but I forget how to deal with the event.
document.forms["myform"].onsubmit = function(){} ?
 
or form.addEventListener("submit", function() { }, false);
but that breaks in IE8
so use form.OOGLYGOOGLY("FOOBAZ", function() { }, false); for IE8
Hell knows what they were smoking when they defined that API
 
Rofl.
 
You dont want to know what the API is in IE6
you have to guess the secret event key >_>
I forgot what it is
@Incognito we use jQuery for a reason :D
 
Yeah, but the only reason I need JS in here is to disable the button after it's clicked.
People hammering on a submit button that runs a bunch of batch reports "to make it go faster" is wonderful.
 
8:53 PM
@Raynos , we stay away from jQuery for a reason
 
@teresko nah. It's the best. Best library ever.
 
Icecream is so good.
 
I include jQuery 1.4, 1.5 and 1.6 in my pages for triple jQuery-ness. It's just that good.
 
@Raynos wanna tear apart some (short) dummy OO JS?
 
All un-minified of course. In their glorious full form.
@ThomasShields sure. Want to do my documentation for me?
 
8:55 PM
@Raynos jsfiddle.net/wrf6H/6 ...and sure i love writing docs.
:P
 
I'm loosing my JS powers. This took me 5 minutes to figure out:

            window.onload = function(){
                document.getElementById('runForm').onsubmit = function() {
                    document.getElementById('runSubmit').disabled = true;
                };
            };

I need to go on a pilgramiage back to the temple of vanilla JS, where voodoo and arcane rituals seal your fate.
 
user1385191
capitalize your constructors
 
@Raynos i have to understand what it does first. That's where your code-smashing of my OO comes in. :)
 
@ThomasShields should also have var infront of your log function. var log = blar
 
8:59 PM
@david ah of course. @MattMcDonald were you saying that to me?
 

« first day (237 days earlier)      last day (4709 days later) »