« first day (874 days earlier)      last day (4090 days later) » 

12:15 AM
@NathanJones Hi
 
@NathanJones I added some stuff. 'tg.O' or maybe tg[someVarContainingO] is probably in the minimized GoogleMaps API file. My money is that something in your ajax is failing to acquire an element or the right element and it doesn't have the method needed.
 
@NathanJones does the code in your edit work?
 
I'm guessing he just went and spammed any other chat room that seemed vaguely relevant.
 
lol
his problem is crystal clear :P
I'm quite confident that I can solve it
Oh well, his loss :-)
 
Ruby is short for rubbish
 
12:27 AM
I'm here. @Benjamin no my code does not work after my edit.
Got an answer for me?
@ErikReppen I'm not trying to spam. This is the only chat room I've posted in.
 
12:47 AM
@NathanJones It says it does work. What are you saying?
 
I'm back :)
I hate vampires :(
0
A: Mustache Conditions and Loops

Benjamin GruenbaumThere are two solutions to your problem. Using selections and inverted selections Here is an example from the mustache documentation: { "repos": [] } Template: {{#repos}}<b>{{name}}</b>{{/repos}} {{^repos}}No repos :({{/repos}} Output: No repos :( As you see the inverted ...

If you take the time to ask a question at least bother to look at it afterwards :/
 
@ErikReppen I have two versions of my code: one where the AJAX call is in its own function (the first code snippet), and another version where the AJAX call is not in its own function. I'm trying to move the AJAX call into its own function because I have other markers that will get their content strings through a similar AJAX call.
The reason I said the edited code didn't work was due to the fact that I initially took out some of the code and I made an edit that included more of my code, and the edited version of the first version code still didn't work after the edit.
Hopefully that makes sense.
 
1
Q: Why Have People Started Deeming it Necessary to Separate JS hooks from CSS hooks in HTML?

Erik  ReppenThis is one I've started running into more and more in recent years. People wanting to only use IDs for JS and classes for CSS. Or they don't want JS to touch classes and IDs at all and rely on things like HTML5 data-attributes hooks. In 5+ years of occasionally heavy-duty/insane-environment cli...

 
can someone just say that my opinion is correct nor not with this example:
http://pokit.org/get/?b930703ad8a93b9fd22e816e17d5176c.jpg

so bar will be: var bar = function(y) { alert(x+y+(++tmp)); }
and because returning function from another, closure will be all local variables from foo (parameter x, in that case x=2 and tmp=3) ?
 
Why did the boy drop his ice-cream? He was hit by a bus
 
1:07 AM
^ @rlemon you should make the bot spit out these jokes with the anti-joke chicken picture :P
 
@NathanJones I added some more. Your first version is a bit confused on how the whole event thing works I think.
Wow, does the feed put posts from people in the room on purpose or is that just a coinkey?
 
1:25 AM
It takes posts tagged as JS from non-stackoverflow sites
 
@ErikReppen I can answer that programmers question, but it would just be agreeing with you
CSS classes are often used in codebases in JavaScript, especially to match things that there is not 'one' of
People who rely on data-attributes often get it wrong
 
Yeah, I'm trying to find more links to people saying that. At one point this whole room was ganging up on that one though. There was this weird thing about separating the hooks that never made sense to me.
 
There, I said it :P
 
@ErikReppen I can somewhat understand the thinking to an extent with CSS
Since using classes allows you to reuse code where IDs don't
 
@twiz I've never understood. I think even knockout and angular might bind via data-attribute for the misperception. btw I'm talking about separating CSS form JS by not using the same attributes for hooks but if you're talking about the CSS thing I'd disagree with you there too.
 
1:32 AM
Of course, that doesn't make ids useless in CSS or anything
 
Right, but people have said that.
It's not like you'll never have unique elements that repeat on pages and being able to override select properties per ID'd container leads to a hell of a lot less cruft than class-only.
 
yea, I agree.
 
0
A: Why Have People Started Deeming it Necessary to Separate JS hooks from CSS hooks in HTML?

Benjamin GruenbaumUsing classes for JS makes perfect sense. Classes, like their name suggests classify DOM elements. For example, if I had a list of items <div class='item'>Item1</div> <div class='item'>Item2</div> <div class='item'>Item3</div> <div class='item'>Item4&l...

 
1
Q: Reduce JavaScript code. Double event, selector into one

AURIGADLAny idea how to write this code better. Two selectors and two similar events, in a function would be better or a pattern to reduce lines. $(function() { var $items = $('#vtab>ul>li'), $items2 = $('#vtab2>ul>li'); $items.mouseover(function() { var index = $items.index(...

 
I think people hear about the concept of reusing CSS as much as possible and end up just using all classes instead of actually thinking about what makes sense
 
1:35 AM
its a better practice to use classes instead of inheritance
 
@MrRioku Hello
Was that a question?
 
hello!
no, i was rresponding to twiz
 
classes and inheritance are not conflicting concepts
 
Well its in the same category as what I was talking about. Inheritance can restrict your ability to reuse code.
 
@twiz they actually advocate anti-ID approaches on that CSS lint site. IMO, it's total kool-aid.
 
1:38 AM
Inheritance is a technique to share functionality, and 'being a type of' when using object
@ErikReppen I don't even know where you got the idea that was bad practice :/
 
i agree w/ twiz, check this out that i put together yesterday jsfiddle.net/GV2QX/2
 
I have decent rantish answer about the CSS one on Stack.
 
@ErikReppen ?
 
9
A: Why selecting by ID is not recommended in CSS?

Erik  ReppenFirst of all: CSS Lint, like JS lint is an opinion disguised as validation, not an authority. I've been at this for five years. I've worked on very large retail sites, at interactive agencies, as a solo contractor, and am currently at a SaaS firm. The idea that IDs are unequivocally bad, IMO i...

 
@MrRioku You can't understand OOP classes and inhertiance using CSS
 
1:40 AM
@Be
@BenjaminGruenbaum, i kno there not alike, i was trying to compare what i knew to what i dont know
 
@ErikReppen That's CSS though, not JavaScript. +1 on that answer, it sums up a lot of things I agree with :)
 
its funny i walked into this conversation because yesterday i was trying to figure out the difference between the concept of inheritance vs. interface (OOP)
 
@BenjaminGruenbaum Yeah, I was having two conversations at once. It's the recent question I asked where I'm trying to get to the bottom of who is responsible so I can find them and make fun of them.
 
lol
Sometimes I feel like pleasing the OP is more important than being correct in SO
1
Q: javascript and node.js: oop

KiPSOFTI have a problem node.js structure with javascript oop. I created a class using another class. var base = function (name) { this.Rows = new Array(); }; var top = function (name) { this.name = name; }; top.prototype = new base(); var myClass = new top(""); myClass.Rows.push(...

lol
 
They're often confused but not the same. Nor does interface enable multiple inheritance. Complete balderdash.
 
1:47 AM
@MrRioku An interface is a contract .
 
I'm seriously starting to think overreliance on IDEs makes devs weak.
 
I couldn't agree more
 
@ErikReppen haha why?
 
I use a powerful IDE to make my life easier, but I would never let it do anything I don't understand myself
 
I've never used an IDE that does much except make code more readable
/easier to get around
 
1:48 AM
I've been watching lynda.com tutorials on programming fundamentals and oop design, coming from a strict design background trying to make the shift into programming
 
@ErikReppen I recently had to code on paper (for an interview), and WOW! It's hard to do without a keyboard, let alone an IDE (I use Vim)
 
IDEs can help you a lot
 
but i was trying to compare inheritance vs interface like this stackoverflow.com/questions/15266286/…
 
@JessTelford If I was asked to write code on paper, I would ask if I would be expected to do that for the job
 
Refactoring, in-app debugging, finding errors for you, making everything easier for me so I can think less. I would never use anything that I don't understand
@twiz It's quite common to ask people to write code on paper in interviews
 
1:50 AM
as though you're going to be in a position where you''l have to code not on a computer... haha
 
@twiz Previously, I've been to an interview where they had a dev environment setup and some coding problems to solve. I spent most of the interview trying to get familiar with the environment instead of coding.
@twiz The "Code on paper" was more of a way to show I could write code and understood concepts - they were happy with crappy psuedocode and "..." everywhere when it was trivial
 
ohh well that would make sense.
 
You don't check for ; in interviews :P
 
@JessTelford People who make you code on paper at interviews should be shot. No, drawn and quartered and then shot. And then taken to be tortured.
 
But like if I was asked to write out a PHP script I would be hopeless...
 
1:52 AM
@BenjaminGruenbaum If they do, run screaming! :P
 
@twiz If I was asked to write PHP in an interview I'd just leave :)
 
I can never remember any of the 1000000000 native functions it has
@BenjaminGruenbaum Haha good point.
 
Whiteboards too. WTF is with the whiteboards? It's 20 freaking 13.
 
whiteboards....?
 
@ErikReppen How else would you check for someone knowing to code?
 
1:53 AM
@ErikReppen I've yet to find a better way to map out my thoughts in a semi-permanent manner.
 
@ErikReppen I actually use whiteboards a lot, have a big one
 
Hand them a freaking laptop they can type on.
 
ohhh you literally mean whiteboards haha
 
@ErikReppen When they ask a question such as "design an algorithm to calculate the Nth number of the fibonachi sequence", then you have to write it down somehow, you can't speak it out loud, and getting a dev environment setup is too hard. They also look for you to talk out loud so they konw your thought processes are good, rather than rote memorization.
 
@ErikReppen That means code completion, internet etc, it's really not a big deal to write some code on paper
 
1:54 AM
That's fine, but I don't. Don't make me hand-write on a whiteboard at an interview. I've been typing since I was 12 because I wrote like an 8 year old back then and I haven't improved since.
 
My hand writing is bad, but I still use whiteboards a lot, even over my tablet pc
 
Yeah, actually "coding" on a whiteboard is annoying
 
Not for coding lol :)
 
@ErikReppen Unfortunately, you might cost yourself an interview with that attitude :(
 
For mapping out architecture, thinking up ideas, etc
 
1:55 AM
you can't really get a simpler interface than a whiteboard
 
Also, if someone would tell me to dance around in a skirt or do 50 push ups in an interview and I wanted the job, I probably would.
 
@twiz Exactly! Really one two issues: Pen running out, and running out of space.
 
@JessTelford I'll always bring a laptop and ask if I can use it and tell them exactly why. If they have a problem with that well, I haven't been without a job for more than 3 weeks in the last 4 years.
 
Yeah, JS guys are really in demand now (or at least I keep telling myself that)
 
yeaa but a whiteboard in front of 5 people questioning you... i had an inerview at dell and that was the situation... never racking!
nerve*
 
1:56 AM
@SomeKittens It's true :)
 
@ErikReppen Like MrRioku says: You can't easily display that to more than one person
 
@MrRioku You can edit a message here
@BenjaminGruenbaum Oh good. Now I have a fallback plan.
 
thanks, still learning ;)
 
That's just not cool too. It's complete fail to treat dev interviews as a filtering process where false negatives are acceptable and probably the reason nobody at Google can write JS to save their freaking lives.
 
@ErikReppen Yeah, google are all noobs
 
1:58 AM
@ErikReppen A sad fact of interviewing - some people freak out, others take it like a boss...
 
0
Q: Load JavaScript from a post that's loading into Fancybox via ajax

RedI'm hoping this makes sense. When a user clicks on a post title I'm launching a modal overlay via fancybox, and feeding the associated post content via ajax. However I have a javascript call function that I need to run that is from the post that isn't running when the content is pulled. I have a ...

 
Nobody at google can write JavaScript code
You tell em -_-
 
yeaa it was like i got stage fright or somthing.. put me in front of a computer,,, different story
 
@JessTelford That's what I meant by false negatives. I've never interviewed and recommended a JS dev that disappointed. My approach is simple. Ask questions. Have them show some of their code and why they do what they do. Have them look at our code and have them tell us what they might do differently and what they like. No stress. Just get at the knowledge level quickly and enjoyably while swapping trade skills that you don't pick up from googling "javascript code tests" before an interview.
 
Hey Lars Bak, you're a newwwb. You can't code to save your life
Hey Addy Osmani, you're stuuuupid, you can't code, no one at google can
 
1:59 AM
:)
 
I'm not gonna lie.. im a straight noob at js.. even though I've been working/editing with it for years now im trying to get out of my shell aand really program
 
@ErikReppen Sounds like you'd be a good interviewer :) Not everyone is so lucky to have that. I agree about the false negatives.
 
@MrRioku Do you live near a city and can you commute to work via a train/bus?
 
@ErikReppen Robert Bowdidge, you can't code, you're a JS neeewb
 
i got the tools/ fundamentals down but its the real world concepts and patterns i need to get
 
2:02 AM
@MrRioku Do you understand what a "Prototype based language" is?
 
uhh.. when i lived in austin i did! but now im back in my hometown.. no worries cuz i gotta car haha
 
@MrRioku Still doesn't hurt to have built-in reading time. But the best thing you can do I think is study other people's code under the hood. I learned a lot from learning exactly how jQuery worked and what it was generally doing for instance.
 
i know javascript is but im not exactly sure why, i listend to crockford say that if i didn't kno what it meant it was going to be a pain in the ass until i did
 
@ErikReppen You should check Zepto or jQuery 2, they're both considerably better written than jQuery
 
@MrRioku He'd be referring to things like the Prototype, Closures, Lexical Scoping, etc - I highly recommend you research those topics!
 
2:04 AM
@MrRioku You mean why the language is designed the way it is?
 
@ErikReppen In that case, look to Self to get a historical understanding
 
I was asking about a riding commute because that's my built-in reading time or was when I was starting out. I used to just leaf through JS reference books and stuff on the train.
@JessTelford I look at this
 
he had mentioned that javascript is a protoype language unlike some of the other ones and it will greatly help once you understand that difference.
 
^nerd-humor
 
@ErikReppen har har har
 
2:06 AM
lol
 
@MrRioku Do you know any other languages? Having something to compare JS too did help me a lot when I started learning Python and then Java and then C# better.
 
thanks at @JessTelford, ill research those terms
 
No, but I have the concepts down... Ive watched this video from lynda.com lynda.com/Programming-tutorials/… along w/ the javascript essential training and the oop programming, i have a good understanding of what "programming" is in general
 
look at last comments of the accepted answer, so many lols
http://stackoverflow.com/questions/15285270/is-it-possible-to-return-more-than-one-value-from-a-method-in-java?noredirect=1#comment21568338_15285270
 
2:10 AM
Alright, well the critical thing to JS IMO is the functions being both verbs and nouns that you can pass around. That's something that freaks a lot of people out from more traditional backgrounds even though languages have been doing it for decades.
 
@ErikReppen In MrRioku's case, he may be free of those historical biases... A Fresh start!
@MrRioku Just keep coding, you'll get there eventually :)
 
@sissonb Not really funny :P
 
Why am I getting undefined in console: console.log(setMarker(lati, longi, title));?

I have

unction setMarker(lati, longi, title) {
	var latLongMarker = new google.maps.LatLng(lati,longi);
	marker = new google.maps.Marker({
		position: latLongMarker,
		map: map,
		draggable: false,
		title: title
	});
	arrMarkers.push(marker);
}
 
@ErikReppen I'm not sure I agree, JS functions are verbs, but both verbs and nouns are 'things' (then again, things are nouns lol, not sure how to phrase that ocrrectly)
 
it says function, typo
but the question remains
 
2:12 AM
" I learned about something extra which is always nice; because I'd never heard of "ValueHolder""
 
I'm great at html5/CSS and can use jquery freely and pretty good now, i feel like i've skipped a lot though and i needed to get a better understanding on programming because theres still so much stuff i wana make! but im finding myself looking for answers still
 
Prototypes are something I actually don't use a lot day-to-day although they can be really handy when you want something to work exactly like something else but with a couple slightly different features. They tend to be more for architectural type stuff like object factories in my code.
 
@XCritic: I'm not positive, but I think because your function doesn't return anything, console.log() doesn't have anything to print.
 
@MrRioku So have you worked more design-centric jobs like at interactive and ad agencies?
 
I have an odd question if anyone is willing to take a look....
0
Q: Callback to a class instantiating another class making AJAX request

twizThis is a somewhat difficult question to word. Here is the basic process: A class is instantiated. This class's constructor method then instantiates another class This new class's constructor method uses a global object's method to make an AJAX request. Once an ajax request has completed, I w...

 
2:19 AM
definitely more design centered, i currently work for application factory, inc., a group of about 5 programmers, my role is UI/UX design.. I work very closely w/ another programmer. I can usually throw some jquery together to get a certain effect that i want but its not "smart" to say.. i like working w/ the other programmer so we come up w/ better solutions that do the same thing (thats the level i'd like to be at)
 
<?php while($stmt -> fetch()) { ?>
var longi = "<?php echo $gLongitude; ?>";
var lati = "<?php echo $gLatitude; ?>";
var title = "<?php echo $gTitle; ?>";
setMarker(lati, longi, title);
<?php } $stmt -> close(); $mysqli -> close();?>

function setMarker(lati, longi, title) {
var latLongMarker = new google.maps.LatLng(lati,longi);
marker = new google.maps.Marker({
position: latLongMarker,
map: map,
draggable: false,
title: "Your Location"
});
arrMarkers.push(marker);
}

Isn't work but I know that it's getting the right variables, anybody have any idea?
 
@twiz Constructors should be straightforward, take the AJAX logic away from there
What are you trying to accomplish?
 
Me?
Pull coordinates and a title of each marker stored in a database and show them on the map using the setMarker function
 
@BenjaminGruenbaum Well, I just used that as an example, since I need to make a callback from an asynchronous task
But the point is to end up with a class that contains an array of classes
this is difficult to explain... ha
 
@XCritics where is map defined
 
2:23 AM
@sissonb I got it figured out, I had map = right above the function
so i put it under map = and it works now
Javascript is extremely order sensitive it seems
 
it's single threaded
 
What does that mean/
 
means that things are done in order
 
@twiz done
1
A: Callback to a class instantiating another class making AJAX request

Benjamin GruenbaumIt seems to me this is a broader problem with your architecture, however this is doable. $.get returns an XHR object, you can use the return value and hook on its 'success'. You can change globalAction to globalAction: function(theUrl){ return globallyDoStuff.somethingWithACallback(theUrl...

 
Thanks.
lemme check it
I get the feeling I've been looking at a computer screen too long and probably just became a bit stupid.
 
2:29 AM
I know that feeling XD
 
when you answer your own question and upvote another answer does that count toward the sportsmanship badge?
 
49
Q: Voting for competing answers (Sportsmanship badge)

user27414If I answer a question and vote for a competing answer, I am on my way to the Sportsmanship badge. What about if I: a) delete my answer after voting for a competing answer -- or -- b) delete my answer before voting for a competing answer -- or -- c) delete my answer, vote for a competing a...

 
@BenjaminGruenbaum Hahaha yea, I definitely have lost my mind...
I need to get away from this stupid glowing box.... either way, thanks for the response.
 
Don't forget to accept my answer :)
 
@BenjaminGruenbaum thanks very much
 
2:35 AM
YW
 
distance = new google.maps.geometry.spherical.computeDistanceBetween(latlng, locationlatlng); How might one use this in an if statement to find out if the distance between them is more or less than a certain distance?
 
@MrRioku Alright well I would say one place it's hard to grow in more design-centric is getting into the more OOP-centered stuff because you honestly don't need a ton of architectural concerns for 2-5 page sites that often aren't even meant to stick around for more than a single event. And then when you do get something big it's usually 8,000 tons of CSS and pretty light JS work that they're expecting to be done way too soon for maintainability to be worth considering.
@MrRioku Back when I was still mostly working design firms I was usually just doing CSS and jQuery spray and pray style code where I was good at the UI stuff but just throwing event handlers at the page and walking away from it.
Where things got a lot more interesting IMO is when I started working for smaller companies doing B2B stuff with fairly complex web apps they wanted to maintain for the long haul. Or at least they had that concern a little bit too late which is my current job in a nutshell.
Anyway, that's where you start thinking about things like "what's the easiest way for somebody, maybe even a server-side dev to be able to rapidly see what behavior is on a given page and modify it?" My general solution is to bury the jQuery in objects with interfaces that make it really easy to add stuff and tweak the features of UI widgets on a given page.
 
Or not use jQuery altogether
 
2:51 AM
Hi all, I have a question: I wanted to edit an extensive answer where the clearly intended code-output (in comment) was forgotten. Using codepad.org I figured out the output of that example, but it is less then 6 characters. Thus (as suggested) I searched something I thought was worth while to add (being the explenation for the ~+ operator that might be unknown (coming from other languages, where this answer was specifically tailored to).
 
Is there a better way to discern the type of an object than typeof?
 
My edit was rejected, but now the output is still missing from that answer. What to do? I'd hate starting to think "F it" on stackoverflow.. The Idea was we all help and improve.
 
For instance, how can I tell if what I've got is an instance of Date?
@GitaarLAB Wrong place to ask that. Most of us have already stopped going to main for reasons like that
 
SomeKittens: I searched for a place where to ask about this, and finally figured.. let's ask here with my ES friends. What is 'main' ?
 
2:55 AM
@GitaarLAB where is your edit?
What answer?
 
example in question:
abc = function(x, y, z)
return x+y*z, 22
end
q, w = abc(1, 2, 3)
print(q, w) -- prints '
 
@SomeKittens I think I agree with that
 
Should be:
abc = function(x, y, z)
return x+y*z, 22
end
q, w = abc(1, 2, 3)
print(q, w) -- prints '7 22'
 
Why was it rejected?
 

« first day (874 days earlier)      last day (4090 days later) »