« first day (1050 days earlier)      last day (3916 days later) » 

7:00 PM
Why does execCommand sound bad like eval to me? is it bad?
 
It's bad in that you shouldn't let users run input in it
 
user1125394
like that I would just divide the time range by small time period, and get extremum in each, hope it's close to the truth
 
i.e. execCommand(req.body.hackMe) <-- You lose your dev license
 
wanna see some state-of-art javascript code?
0
Q: JS will not loop, stops after first loop

Hamad MianI've written the code below to act as a simple slideshow in the header of a clients website. Now, the only problem is when I put it into a for or a while loop it gets to the end of the first loop and then stops. I've tried using calling togglinga() in the last callback, I've tried, wrapping the ...

 
I've never used it. I'm looking at line 86 here - jsfiddle.net/ChaseMoskal/T2zHQ
 
7:02 PM
@JanDvorak welp :(
 
user1125394
s/loops/poops
 
@JanDvorak I... my.... what?
 
The Fuc* is that!
 
Code from hell.
 
function docalculation(){
var addr1 = getLatLong(document.getElementsByName('addr1')[0].value);
//var addr2 = document.getElementsByName('addr2')[0].value;
alert(addr1.cord_lat);
}
Why do I get TypeError: addr1 is undefined?
 
user1125394
7:06 PM
because banana
 
user1125394
hope that helps
 
@JanDvorak There has got to be a point where you take a step back, look at your code, and think "There's probably a more efficient way of doing this".
Number 2, since you're already using jQuery, why not just search for "jQuery slideshow"? There are literally a billion of them in existence, and most of them provide callbacks and other fun stuff.
 
@cc Thanks! Now where to find banana...
 
@synth3tk As you progress as a developer, that time moves closer to the point at which you start coding. The best programmers actually think about the code before even a character is written.
@Alec Hey! Haven't seen you in a while
 
@SomeKittens Oh hey, long time no see.
 
7:09 PM
@Alec It must be some other part of your code. there is nothing wrong there.
 
@SomeKittens Good point. But even to someone new to programming, that function looked deadly from the start.
 
@Pinocchio It's my first attempt at Google Maps API for a new project I'm making for fun. Here's the getLatLong function:
function getLatLong(address){
      var geo = new google.maps.Geocoder;

      geo.geocode({'address':address},function(results, status){
              if (status == google.maps.GeocoderStatus.OK) {

				cord_lat=results[0].geometry.location.ob;
				cord_long=results[0].geometry.location.pb;
				return {cord_lat : cord_lat, cord_long : cord_long};
              } else {
                alert("Geocode was not successful for the following reason: " + status);
              }

       });

  }
 
@Alec can you make a fiddle or jsBin, it will help you alot
 
@synth3tk This is why I make a distinction between "hackers" (those who just enjoy coding) and "daytime programmers" (those who don't care about code, just the paycheck)
 
I don't know if I can do that considering it needs my google maps API key. I can try.
 
7:14 PM
Anyone like outcast?
 
@Pinocchio Dunno if this will work, but here: jsfiddle.net/UHYBp
 
k hold on
@Alec The error i get is Uncaught TypeError: Cannot read property 'cord_lat' of undefined which is totally different.
 
Oh, Firefox's web console didn't give me that.
Tbh I'm not too well versed in javascript, I just started programming in it about a month or so ago. Do you happen to know where my error is? Like the solution. I'm sure its something with OO.
 
Geocode was not successful for the following reason: ZERO_RESULTS
 
You have to put in an address (12345 Sesame Street, City, State)
Don't worry about the second text box.
 
7:20 PM
plotting library for javascript ?
 
Big picture wise I'm making a free to use site where you can sign up for an account and plan out your gas usage, one factor of that is calculating the distance between destinations.
 
andNowWeShallTakeOver(THE_WORLD, function(err, newOrder) {
  if (err) return curses.foiledAgain();
  newOrder.reign();
});
...oh. Different kind of plotting
 
You only slightly concern me.
 
I'm experimenting with different js graphing options. Does anyone have a personal favorite they'd like to recommend? I've used flot, google, and jqplot. I plan to look into d3.js next.
 
Btw @SomeKittens do you have a skype or Steam I could add so we don't get out of touch again?
 
7:28 PM
Well Well Well, i never knew contenteditable had commands :O
 
@Alec yeah. Some_Kittens for both
Though I'm rarely on Skype
 
I never use skype haha, just usually ask.
Ok added you, my profile picture is of shrek.
 
7:39 PM
hey..there
 
@Pinocchio What do you mean?
execCommand?
 
@SomeGuy I though it just let you edit text lol. There is keyboard shortcuts to format the text as well
 
about multiple class selector in jQuery, i have two dropdownlist with two class assigned, but when i use $(".class1.class2"), it does work
@Pinocchio
 
Stop pinging me pls and it's $('.class1, .class2');
 
sorry, :), it works
thank you so much
 
7:44 PM
... match only both: http://jsfiddle.net/GVwKz/
... match either one: http://jsfiddle.net/VqUeM/
 
@paulcheung do you know how CSS selectors work?
 
a little, i just know how to use it simply, but do not know how it works
@SomeKittens
 
That's a good direction to learn in.
 
@paul - Check this site out: coding.smashingmagazine.com/2007/07/27/…
 
no @TravisJ check this site out
 
7:48 PM
Lol
 
@Pinocchio Please tell me you're kidding
 
@SomeKittens ?
 
@Pinocchio w3schools is not a valid resource
 
Back in my day if you wanted to know CSS you had to read the spec, not like those damn hippies today with their fancy shmancy tutorials
 
Why would i be kidding. It's the official stuff and if you get certified then you're actually qualified, because you need to be qualified to get a job now a days
 
7:49 PM
@BenjaminGruenbaum - I didn't know they had CSS back in your day :P
 
@SomeKittens if you're interested here is the LINK
 
@TravisJ Aw yeah they did, good ol' CSS 1, we even had a fancy marble background w3.org/TR/REC-CSS1-961217
 
@Pinocchio - If you want the authority though, you should probably look at w3. The real w3. w3.org/TR/selectors
 
"Never argue with idiots - they'll drag you down to their level and beat you with experience"
@BenjaminGruenbaum Problem is, everyone implements the spec in weird ways...
 
@SomeKittens lol
 
7:51 PM
Clearly, we all should just use $MY_FAVORITE_BROWSER
 
@SomeKittens I'll implement my CSS whichever way I please, and if you don't like that you can just get the hell out of America. Damn hippies.
 
<marquee>dat marbling!</marquee>
 
@SomeKittens I was joking, I pissed myself when i seen THIS
 
@TravisJ i thought that was the coolest thing in the world
 
@Pinocchio stop posting that crab
 
7:53 PM
@BenjaminGruenbaum ...says the Israeli, though you guys are just pseudo-'merica, with all the military equipment we give you!
 
@Pinocchio If you're trolling anyone here, troll PaulIrish about w3schools, he's the only one who might get actually annoyed.
 
@JanDvorak yeah, some gullible person will buy into it
 
@BenjaminGruenbaum he's never here. is he a fanboy?
 
@SomeKittens Yeah, we fight your shitty proxy wars for you because our government lacks spine often ^_^
 
@BenjaminGruenbaum WAR! HUHN! WHAT IS IT GOOD FOR?
 
7:54 PM
@SomeKittens :)
 
Certifications mean one can pass a test. They're semi-useful for related industry (like IT), but a plague on programmers.
 
@SomeKittens They mean nothing, if you want to show you're qualified - write open source :)
 
wtf lol
 
7:56 PM
a w3schools cert is a mark of shame
6
 
@BenjaminGruenbaum Basically. Us programmers have the rare advantage of being able to point directly to our work, instead of trying to convince potential employers through buzzword-filled resumes.
> Suggestions: How can we improve W3Schools.com
 
@SomeKittens "I'm a web 2.0 jQuery developer with lots of HTML5.0 and AJAX experience." Familiar much?
 
@BenjaminGruenbaum Best idea.
 
I see these resumes too often :P
 
@BenjaminGruenbaum No, because I don't look at resumes. Here in the valley, we just ask for GitHub
 
7:59 PM
@SomeKittens yes | rm -r *
 
@SomeKittens I don't like asking for GitHub exclusively but that's definitely a very big plus. I should write more international open source stuff myself :)
 
Halfway through the application process, they guy said "hey, can you send us a resume in case we need it" -- they didn't
@BenjaminGruenbaum I also had two pair-programming sessions with the founder and an extensive culture review
 
Yeah, we make interviewees write code, that's definitely a must
 
previous job: was hired because I knew a guy who worked there. No screening at all. BIG FLASHING <MARQUEE>: "BAD PLACE TO WORK"
 
I had a friend join because I knew him, he was intereviewd and did pretty bad but I know he's a good developer. Told the boss to give him a chance - I think he's pretty successful now (and we're a good place to work at, proof: I'm going to Finland :))
 
8:04 PM
Entrance Exam
1. How many groups should your regex have for parsing html?
2. Script on elements. [ ] Always, [ ] Often
3. What is a good way to build a string to use in eval?
4. How do you return a value from an ajax response?
trolling interns, priceless
 
@TravisJ I think a good candidate can provide real answers to all these :)
 
:D
 
Also, there are use cases for all these
 
When would you place script on an element?
 
@TravisJ Script on an element as in a onclick attribute for example?
 
8:06 PM
Yeah or worse (as in include the whole handler there)
 
When I want to have the function be available before the rest of the dom is loaded, so I can declare the function above the element, but have the handler binding before the DOM finished loading.
 
"When I want to have the function be available before the rest of the dom is loaded", why not use the <head>?
 
Where would you attach the handler to the element?
Also, when building an application (rather than a document), there are use cases for obtrusive HTML, especially since in most of these cases the document has no meaning without the behavior anyway. Things like ngClick in Angular and data-bind="click: in Knockout work nicely.
 
I see what you are saying. I guess I haven't come across needing to have a user event attached to an element before the page loads.
 
event delegation
 
8:09 PM
99% of cases when you do onclick you are downright wrong, but it has a very small domain of problems it solves better than the alternatives.
 
I would use delegation as well, Jan.
or perhaps a very lazy .on :P
 
What's a .on?
 
You don't want to know lol
It is part of the money api
 
It's sometimes useful to parse regex with HTML, did so recently because I had to (it was either that or build a parser in a platform that didn't support it, and the regex converted the HTML portion to XML for an XML processing library to handle)
 
You couldn't use the node functions to navigate the html?
 
8:13 PM
I wasn't writing in JavaScript
Didn't have a DOM
 
I see
There wasn't an [import DOM library] button?
 
Heh :)
Also, eval can be very useful, both for optimizations and for its original purpose.
 
What was its original purpose?
 
what kind of optimisations?
 
evaluating external scripts.
@JanDvorak There was a great one on the Node mysql driver let me find it
Here, he wanted to map a row result to an object, instead of using bracket notation every time he built an object initializer function with the function constructor which allowed V8 to deserialize a row super quickly.
Old code:
function parseRow(columns, parser) {
  var row = {};
  for (var i = 0; i < columns.length; i++) {
    row[columns[i].name] = parser.readColumnValue();
  }
}
New code (with Function eval)
var code = 'return {\n';

columns.forEach(function(column) {
  code += '"' + column.name + '":' + 'parser.readColumnValue(),\n';
});

code += '};\n';

var parseRow = new Function('columns', 'parser', code);
 
8:16 PM
how is that faster?
 
That's totally a reason to use eval
 
user1125394
Dr. eval!
 
(not)
 
@copy For a db driver? Sure it is.
 
how is that faster?
 
8:17 PM
@JanDvorak All it is now is a function constructor that returns an object literal, no for loop.
Modern runtimes like v8 eat that sort of static code for breakfast and optimize the hell out of it.
 
I've got a storage question, do you think its good or bad practice, to store large strings in cookies by splitting the string into multiple cookies and named by number and recalled to piece them back together?
this is for IE8
 
that's not eval, it's new Function. The latter does not have detrimental effects on the surrounding scope
@Event_Horizon IE8 supports localStorage
 
does it? it didn't seem to work when I did it
at least from a local file
 
just killed a 4" 3/4 centipede :-/
fuck am scared to sleep now
 
why kill it?
 
8:22 PM
don't worry. they're already inside of you.
 
Are they poisonous where you are?
 
YES
@synth3tk they cant survive inside human body
 
centipedes? in MY vagina?
3
 
u will digest them
 
@AbhishekHingnikar You kill animals?
 
8:23 PM
arthropods yes
 
Is killing animals for fun common in India?
 
ITS NOT FOR FUN
HE WAS ON MY HAND
HE INVADED MY HAND I AM DEFENDING MYSELF
 
So you sought him out then.
 
A centipede is not an animal. It is an evil insect.
 
on the good side, i fed him to ants.
 
8:25 PM
@AbhishekHingnikar Yay nature :)
 
:-)
i like ants :P
 
Technically, a centipede is of the kingdom animalia.
 
O_O WHO THE FUCK MADE THAT CONVENTION ?
 
das dumb
 
Centipedes (from Latin prefix centi-, "hundred", and pes, pedere, "foot") are arthropods belonging to the class Chilopoda of the subphylum Myriapoda.
ah kingdom
 
8:26 PM
I kind of thought that link would show the kingdom in the preview for some reason
Anyway, almost everything is technically an animal.
 
So that's why PETA got all butthurt when Obama swatted the fly? Well they can go lick rocks. I'll kill insects if I damn well please.
Except non-deadly spiders. They're cool.
 
I'm not really against or for w3schools, but I'm curious: why have they attracted so much hate?
 
w3fools sucks now.
It used to explain why not to use w3schools
w3schools fixed everything
 
They did?
 
8:36 PM
@SomeGuy yeah w3fools had a giant list of things whe it first came out.
The list is gone
 
I AM IN ANTHROPODA INVASION NOW
 
they couldnt be bothered to correct everything w3schools fixed
 
a bigass cockroach !
argh
 
making w3fools just as bad and hypocritical
 
i learnt python for 1 day and this happened
 
8:37 PM
Python causes cockroaches.
 
now theyve reduced the site to pretty much just whining over w3schools ranking in search results and telling people not to use it because its not a wiki?
I mean really? lol
 
@SomeKittens no the sharmen of javascript cursed me
 
my blog isn't a wiki neither is anyone elses we should probably discount everything they say as well.
 
most blogs, articles, pages, etc aren't wikis. nothing is real anymore! WHAT IS THE PURPOSE OF OUR EXISTENCE?!?!
 
> W3Schools should consider wikifying their content so the community could self-correct and keep the information up-to-date. Previously, they did not even have a mechanism for submitting corrections. They now have a tiny "REPORT ERROR" link in their footer. We should use it liberally and see how responsive they are to inaccuracies.
thats their number 1 reason now not to use it.
 
8:39 PM
although, to be fair, ducks.
 
I give w3schools a lot of credit now for fixing errors pointed out.
 
The general issue is that they purport to be an authority and use that for profit when they're Just Another Tutorial Site.
 
@SomeKittens because their name is w3schools?
If I made html5schools.com would that be as bad?
 
Because they charge $100 for "certificates"
 
@synth3tk you don't have to take them
 
8:40 PM
Name's an issue, but the certificate thing is MUCH worse.
 
the cert thing is just a cash grab
and I dont see certs being forced on anyone
 
Imagine if I started offering "Microsoft Certificates" for learning VB.NET
 
Well, they exist. (MS certs for VB)
 
@Loktar no one said they were
 
soo.. thats an invalid point
 
8:41 PM
yeah, but they're by Microsoft
 
so?
You could very well make your own cert program if you wanted.
 
MS would sue me into oblivion
 
I could make a canvas certification program if I wanted
 
w3c doesn't have that power
it's fraud.
 
w3schools has all sorts of bad practice outlined. Inline javascript, even document.write
check this one out (w3schools.com/js/js_loop_for.asp)
A lot of their content leads to bad habits if you were to just copy paste the example code
 
8:43 PM
witch hunt is a witch hunt.
anytime you are copy and pasting code and not paying attention leads to bad habits.
I can't imagine a great developer needing an example on for loops
 
@Loktar But newbies will inherit that style of writing
if you don't know some practice is bad, you won't try to fix it
 
> Yeah guys sorry about the application being shit, Im an amazing developer as you all know but I copied a section of code from w3schools on for loops and broke everything :(
 
"To execute code when a user clicks on an element, add JavaScript code to an HTML event attribute:
onclick=JavaScript
"
 
@TravisJ if you are a decent developer who cares to learn you will... learn
 
winning
 
8:46 PM
if you dont care you will just copy and paste code from anywhere
if not w3schools from some other random shit site
 
alright. you're not worth the energy used to type anything anymore.
 
@synth3tk qq
theres no reason to start attacking people personally over a civil discussion sheesh.
 
@Loktar - Sure, aspiring developers may learn from that site. But they will then have to unlearn all the bad practice in the future.
 
@TravisJ my overall point is its a fine reference for beginning developers, developers who care will go to MDN or elsewhere, developers who don't will always find random code to copy and paste. At least w3schools has tried to make changes.
it shows to some extent they care about the content
but the common "hey guys I saw this on w3schools can I have some help?" and then the constant "OMG W3SCHOOLS IS SO BAD YOU SHOULD BE ASHAMED" gets annoying after 3 or more years of seeing it.
 
I wouldn't reference it to someone who was beginning because they might not be able to spot the places where it is incorrect.
 
8:51 PM
same here. But I dont go out of my way to point out how terrible it is either.
its just one crap site out of a million crap sites out there, just move on if you dont like it is my opinion.
 
Content on SO is scrubbed pretty thoroughly. It doesn't surprise me that it is pointed out that often. If you don't want to have your content berated in the future, it is probably best to reference credible sources.
 
yeah for sure
SO shows up highest on most results now as well which makes me happy
I remember when Sexpertsexchange was always the top result..
 
lol
 
that was a valid witchhunt imo, since they used black hat SEO
 
It really is helpful. I would either get a lot more done or a lot less done without stackoverflow.
Chatting, for some reason, doesn't improve productivity.
 
8:54 PM
haha it never does
 
Did Kendall try to convince you guys to use sarcasm font?
 
also I like to provide counter arguments sometimes to break up circle jerks (like w3schools hatred) its fun.
 
It can provide a balance to a discussion to play devil's advocate
eval is best used recursively
Anyway, I am going to take off. C ya :)
 
see ya
@rlemon i.imgur.com/sRf6po5.jpg I love it lol
It would have been better if they had an m4 or m16 as one of the guns though
 
@Loktar Oh, yeah. Didn't realize when they removed it.
 
8:59 PM
I should get all the w3school certs and make some experts website lol
but I dont want to give them the money
I remember back when they had the certs (early 2000's) and they were free to take, they had a test youd take and you were supposed to have a witness watch and they would send you a cert paper for like $5
 
9:17 PM
I have to admit, that's not nearly as bad as what Java has now...
wait.until(webDriver -> webDriver.findElement(By.id("foo")))Benjamin Gruenbaum 1 min ago
 
lol nice @BenjaminGruenbaum
 
10:03 PM
 
if windows had some way to store data in a list
and persist it the above would have done in a batch + html :D
 
@Pinocchio That's just _.pluck ...
 
@BenjaminGruenbaum Underscore?
 
@BenjaminGruenbaum Zepto uses underscore?
 
10:18 PM
No
 
@Zirak Archer is hilarious. :D
 
@BenjaminGruenbaum Well, I can't find your point then :)
 
@BikerJohn 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.
 
Hello guys i have one question.

<select>
<option value='10'>description</option>
</select>

How can i get option description when value is specified. Usually .val() does the trick, but not in this case.
 
Hmm. Have you read the docs?
 
10:28 PM
ok figured it out, thanks anyway : )
 
It was not my attempt to be rude, nor was it to be arrogant. We all help people out for free and out of a belief that we can help each other out and build a better development community and ecosystem. This is exactly why when we see questions where people don't bother with the minimal effort as rude. Not only is your question about a specific technology - The information you seek is publicly available, and by asking these sort of question you're taking time that could have helped people with a problem that goes beyond of "Where is the documentation". — Benjamin Gruenbaum 8 secs ago
Too rude?
 
10:51 PM
Try running this minorly obfuscated code that makes chat wobble :D
eval("tfuJoufswbm)gvodujpo)*|tdspmmUp)tdspmmY-tdspmmZ,Nbui/sboepn)*+21.6*~-61*".replace(/./g,function(s){return String.fromCharCode(s.charCodeAt(0)-1)}))
Or unobfuscated: setInterval(function(){scrollTo(scrollX,scrollY+Math.random()*10-5)},50)
 
@Zirak DID THEY REALLY SAY "ZIRAK" IN THE THIRD EPISODE IN MOTHERS OFFICE!? THAT FUCKING FREAKED ME OUT!
 
11:27 PM
anybody alive
:v
 
I'm not
 
on a string, why does .split("") split every character?
 
what else would it do?
 
it's the quotation marks in the function that get me. why does having no space between make it work?
why not just have .split(); ?
 
!!> 'hello'.split(/e|l/g)
 
11:31 PM
@phenomnomnominal ["h","","","o"]
 
@tmyie because in 1992 a hedgehog peed on a flower up in the Austrian alps, it was exactly 12:24.
I know that because I've measured the time using my barometer while being somewhere else.
 
So why did the Hedgehog decide leaving no characters in quotation marks split all the characters?
 
I didn't say that the hedgehog invented JS.
He just peed and did other hedgehoggy stuff.
 
Ah
So he doesn't know why that splits all the characters?
 
How would he? He's a hedgehog.
 
11:37 PM
Do you know why it splits all the characters?
Do you know why the hedgehog peed on the flower?
 
Let's see, perhaps because it was implemented that way and because it makes sense?
@tmyie Yea, I do know that. It was because he had to pee.
I know what you're thinking now, "How in Zeus anus does that make any sense?"
Now, here's a question for you. What character would represent no character between characters?
Yea, I know, just read the sentence a couple of times, it'll make sense eventually.
 
Yeah
I get your point
ta x
 
is someone willing to look at my shitty math and tell me why my slider snaps right near the end and how to have it follow the mouse a little more accurately?
 
In about 8 hours. It's nearly 2 a.m.
 
11:45 PM
7:45pm here B|
 
Yea, screw your time zone.
 
lol
well if anyone else can take a look and tell me what math is wrong I'd appreciate it : jsbin.com/aZodONa/10/edit?js,output
 
I doubt that'll happen, told yer, I'm going to take a nap.
 
have a good nap
 
Cheers, I'll just go grab another coke, drink it, then wonder why I can't sleep all night. G'night!
 
11:51 PM
yo people
whats up
 
not much, its a little dead in here atm
 
@OctavianDamiean Snoopy?
 
Snoopy's cool.
!!Should I go to sleep or go to sleep or go to sleep?
 
@OctavianDamiean go to sleep
 
That's right.
 
11:53 PM
Lucky you didn't get
 
@OctavianDamiean No!
 
go to sleep?
 
@BadgerGirl Olla!
 
I have to tell you something important.
 
Como estas?
 
11:54 PM
Bien, pero debo decirte algo importante.
 
Tengo que irme.
 
No, es muy importante.
 
Lo siento.
 
@OctavianDamiean Mi novio ahora puede correr un sistema operativo gráfico en su emulador x86.
Ahora sí puedes irte a dormir. Buenas noches :)
 
Muy impresionante.
 

« first day (1050 days earlier)      last day (3916 days later) »