« first day (1439 days earlier)      last day (3514 days later) » 

9:01 AM
Obviously
I mean, "Rabble rabble rabble! If it's not helping me, it's bad!"
Also, wow:
-11
Q: we can make a page like http://codepen.io/pen Please help me

Navid BehrangiWho knows how do we can make a page like this? http://codepen.io/pen not code

 
very nice
one of my favs is
http://stackoverflow.com/q/25968891/1449710
 
The google api ------ SUCKS!
fucking crap it is
even bad documentation
worst api I have ever worked with
 
i am batman.
 
shit yourself google.
 
What is the record in - votes on a question?
 
9:07 AM
hmm, looks like they fixed the hack to see deleted messages
 
-1
A: sort json object on multiple items

Ashraf BashirYou may use the following code: DATA_TABLE.sort(function(a, b) { return new Date(a.Dob) - new Date(b.Dob) || a.Surname - b.Surname || a.Firstname - b.Firstname ; });

Yea, subtract strings, why don't you?
 
lol
If + works why not -!
 
@Marek have you tried?
 
@JanDvorak nope its c#, concat is JS, right?
 
...
 
9:11 AM
So, if anyone cares what I was working on yesterday and today for 2-3 hours: github.com/benjamingr/Angular-Auto-Translate
4
@SecondRikudo you might care (doing Angular and all)
 
So I open Visual Studio, try to change the combo-box values separated by semicolon (;Product characterstic;Parameter process;Pressed), and Visual Studio doesn't take any value I enter
It likes its original value
Come to find out, the fact that the first value is empty, Visual Studio doesn't like that very much, but oh.. keeping the original invalid version is perfectly reasonable
I don't think I would have found out if I hadn't simply tried replacing the string in its entirety
 
-1
A: Using search method from string

elclanrsHere's a more straightforward solution. First you count all the words, then you can access them with dot syntax (or bracket syntax if you have a dynamic string): var words = ["NAME","MAJOR","CLASS STANDING","ENROLLMENT STATUS"...] var count = function(xs) { return xs.reduce(function(acc, x) {...

"a more straightforward solution" to counting the occurence of a string in a array
If you call that straightforward... xD
 
9:27 AM
@Cerbrus y u no filter?
 
@Cerbrus "Straightforward" means something different in my book
 
!!> var arr = [" M "," das "," asd M","wrya3r M 123"]; arr.filter(x=>x.contains("M")).length
 
@BenjaminGruenbaum 3
 
@Cerbrus ^ this is what I'd do
 
@BenjaminGruenbaum well, if it's a newbie... I'd rather go with a simple for
 
9:33 AM
@BenjaminGruenbaum That's not easy to read to someone not used to lambdas
 
@Neil take the array, filter it to elements that contain the string, and tell me how many of those there are.
The assumption you're making is that this guy is good with for loops (you can see he's not) and that they're simpler (they're not). I upvoted @Cerbrus but I don't think it's the simplest solution.
 
My problem with that answer is that the asker is obviously new to programming / JS
You don't just dump a bunch of semi-advanced code in an answer, and tell someone like that to use it
 
Right, and you assume that a for loop is simpler because you've learned it before you've learned stuff like functions.
 
A for loop is handled in every single JS tut
[/generalisation]
reduce, || as default, .filter, etc on the other hand
 
@BenjaminGruenbaum It is simpler, because if you always call a function that does the loop on your behalf, you're missing a fundamental concept that you're doing something n times
 
9:38 AM
^ that
 
In order to understand this, you have to start with loops and move up frmo there
 
@Neil that's so wrong in so many levels.
 
Also, elclanrs edited his answer. It's just so much better now
 
First of all, you are iterating the collection, you don't know that you have a function that calls the loop on your behalf.
You're thinking about this backwards.
By doing an explicit for loop you are describing how you're iterating a collection, which is irrelevant, you just want to iterate it.
(A .forEach is better, stuff like map filter and reduce are yet better since they do stuff to a collection as a collection)
 
@BenjaminGruenbaum Using a for loop is usually verbose because you don't need a counter i, for instance
 
9:40 AM
@Neil exactly, with the counter (i) you're explicitly instructing the code how to iterate the collection, which is bad.
 
However, that is besides the point. New programmers need to understand code by following through each step like they themselves were running the program
 
Right, and they can do it much simpler with filter.
You're thinking of filter as a for loop with a backing array you push into if you match the predicate and then return the new array. I think of filter as "give me all the elements that match this condition"
 
I think you could still teach it that way, but you risk that they don't "get it"
@BenjaminGruenbaum It is fine to think of it that way, because conceptually, it does the same thing, however you also know that there is a loop happening here
 
That's much easier to follow than "create a new variable i, increase it by one on each iteration, check it's smaller than the collection's length on each iteration, then check if the collection element at index i contains the word, if it is, increment a counter which you start at 0 initially, finally look at the result of the counter"
 
Concepts are fine when they lend themselves to ideas that are easier to understand, but not when you're forgetting how it is actually done
 
9:42 AM
They may forget that "give me all elements" includes checking every single element
 
@Neil no, practically it does the same thing but conceptually it does something very different.
@Cerbrus so what?
 
@BenjaminGruenbaum The risk is not that you wouldn't be able to understand it. The risk is not "getting it"
 
@Neil I have no idea what you mean by that.
 
Getting it === understanding it
We're just so used to for loops from C/C++ languages that we think they're the easiest thing to reason about.
 
9:45 AM
It is the difference between knowing that the little hand on your watch will increase 30 degrees in an hour's time and being able to tell you how the mechanism works that makes it turn
If you just need to know the time, you only have to know what the hands represent
If you might have to build one, well you're going to also have to know why they turn as well
 
@Neil the for loop counter is exactly rationalizing about a watch by increases of 30 degrees.
Oh wait, you're implying less abstraction is better. I see.
@Neil can you tell me how your for loop is actually run?
What assembly it translates to in let's say, Chrome on X86?
 
@BenjaminGruenbaum No, abstraction is very useful, but before you use the calculator to divide, you must first know how to do long division
 
You really really don't, I don't really remember long division very well.
 
Anyone here know anything about String LCM's?
 
@BenjaminGruenbaum liar
I'm sure you can even prove why long division work
 
9:47 AM
LCM of 2 Strings
 
I really don't, I remember how to long-divide polynomials, but numbers? I'd have to ponder about it for a bit.
 
@Neil This is kinda something what I was looking for: threejs.org/examples/#webgl_morphtargets_human
 
@VedantTerkar what's a String LCM?
 
I really dont know
My friend told me that
You have to write a program which will accept two strings on a line separated by a space and will output LCM of these two strings. Two strings will only contain alphabetic characters.
Sample Inputs/Outputs
1. Input: vyom iware
Output: vyomiware or iwarevyom
Explanation:
Both strings vyomiware and iwarevyom are of equal length and hence both are acceptable.

2. Input: common onion
Output: commonion
Explanation:
String commononion or onioncommon are strings which contain common and onion completely but not of shortest length and hence in this case only acceptable answer is commonion.
 
@Marek That information is still contained in the model
Of course, you could always say knowing how to do long division is irrelevant and give elementary kids calculators
They'd always be able to do division anyway, why would it matter either way?
 
9:51 AM
@Neil where do you stop though?
 
@BenjaminGruenbaum Where do these concepts usually stop? Usually right before you start talking about assembly
 
@Neil Do you know how to divide or multiply polynomials?
Your computer can do that for you, and it does billions of times every day. Shouldn't you be able to multiply polynomials?
 
@BenjaminGruenbaum I think I remember how to do that still
 
What about matrix multiplication, another extremely common task for computers, very useful in real life too no joke. Should we teach kids that?
 
Not really relevant though
@BenjaminGruenbaum I was taught that growing up
 
9:53 AM
I'm not saying JS developers shouldn't know for loops, I'm saying the "go to" solution for doing something to a collection should rarely be a for loop.
 
I don't have a problem teaching them to do it that way, though I think you should teach them the way that involves explaining what is going on step-by-step first
The abstracted version can come later
 
So start by teaching them assembler
Because, it's a lot easier to reason about step-by-step than about abstractions.
Show them what your computer actually does.
Don't stop there, show them how instructions are translated, teach them about cache fetches, about the TLB, about how Chrome runs as a process in unix first.
Don't teach them about how to count their elements, teach them everything around it first.
That way, when they need to just filter elements that match a criterion in an array they really know what's happening.
 
Appeal to extremes, I can do that. What would you do then? Show them how to launch a program that you made to do what you want to accomplish?
 
You wouldn't want them wondering what happens if Chrome gets a SIGUSR1 while it runs their for loop would you?
They have to know how the scheduler works.
 
The point is to teach them conceptually what is going on. You're not helping them by removing details that they're going to need later
 
9:57 AM
@Neil show them the simplest solution given the language tools. There is a big difference between giving them all the code and giving them code in the language they're coding in and explaining how it works.
 
I'd make sure the student knows how to build a microchip, first. Can't count words without that knowledge.
 
@Neil they are not going to need these details later.
@Cerbrus exactly. Also, where to mine the minerals for that microchip. You wouldn't want them not to understand the abstractions involved in his microchip making process.
 
@BenjaminGruenbaum Knowing how a for loop works is not "details they're not going to need later"
 
Don't forget about "how to mine"
 
One day they're going to stumble across someone else's code, or they're going to have to use a language that doesn't have reduce on a collection
 
9:58 AM
@Neil right, but their question wasn't "how do I use a for loop in JavaScript", the question was "how do I count sentences that contain a word in an array"
 
Assuming of course they get a job, since the interviewer might ask them to do a fizzbuzz test
 
dude, you should make them build a microchip first... there's no way they're going to understand anything about software unless they can construct the hardware with their bare hands
 
!!google fizzbuzz test
 
@Neil or you know, they'll find a language that doesn't have these for loops, like Python or Haskell
 
10:00 AM
Maybe they shouldn't learn how databases work either, 'cause you know, maybe they'll only have to deal with nosql
 
Oh, that :P
 
@Neil do you know how databases work?
As in, actually work, not as in "SELECT name from USERS where uid = 1132"
 
@BenjaminGruenbaum More than you'd have me know
 
My point isn't calling you dumb, we both know you're a competent developer...
The point I'm trying to make here is that as long as we can get away with a higher abstraction without paying the price we should.
 
I don't see the relevance, honestly. Why would one argue that learning less is better?
I fail to see what you gain from this, other than a better understanding of computer science
 
10:03 AM
I'm not arguing that learning less is better. I'm arguing that when solving a problem we should strive for the cleanest simplest solution.
 
@BenjaminGruenbaum Can you not teach both?
Don't misunderstand me. You don't teach a programmer that the messy solution is better, but you do familiarize them with it
How can you demonstrate what is a clean solution without first showing them what is messy?
And I suppose not even messy, just verbose
 
@Neil you don't have to show them a messy solution first. Just like you don't make them write code with goto for a while before you show them loops.
 
@BenjaminGruenbaum The difference that you still see for loops being used
Until that is gone the way of the dodo, I'd be frankly embarassed to teach a beginners computer science course without explaining how for loops work
 
We'll have to agree to disagree on this point then
 
10:08 AM
We'll have to agree to disagree. There are many way to teach fundamentals.
 
Jinx
Now you can't speak until I use your name, @BenjaminGruenbaum.
Oops
 
I deal with Java and C++ on a daily basis. If you don't use for, you use while or do while. There's not a lot of choice to the contrary
It is slightly better with Java now, but not by much
It is still very much what we do, as much as I think removing details that are not necessary helps us conceptualize what we're trying to do better
 
10:25 AM
Hi guys...
see this fiddle...
when I am giving date in Y-m-d format for both start and end date, it is returning correct values..
If I am give Y-m-d for start date and Y/m/d for end date, it is not returning all dates...
May I know why it happened?
anyone know the reason why it happened?
 
2
Q: Javascript Date.parse bug when dash-delimited and starts with year

George JemptyAm seeking confirmation if this is a bona fide documentation and/or implementation bug with Javascript's Date.parse method. The docs I'm referring to are at https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse and they say 'If you do not specify a time zone, the local ...

@CJRamki ^ That's why, I think
 
@Timespace thanks for the link..
let me check...
 
10:42 AM
@CJRamki When I try it out in Chrome, Y-m-d is assumed to be UTC, and Y/m/d is assumed to be my local timezone (currently GMT+1)
 
ah... so all about timezone detecting by browser?
@Timespace
 
@BenjaminGruenbaum I'm looking at my brother's CS handbook that the teacher handed out to them, I'm crying blood
 
But I'm getting same timezone for both slashes and dashes date (GMT+0530 (IST)) @Timespace
 
@SecondRikudo look at my angular code (pinned to right) and cry blood instead :D
 
@CJRamki Something like that - different browsers decide whether a string passed to Date() should be UTC or your local timezone differently
 
10:49 AM
:P
 
@CJRamki A table I found - dygraphs.com/date-formats.html
@CJRamki Are you getting the same exact time though?
@CJRamki For slashes, I get Wed Sep 24 2014 00:00:00 GMT+0100 (GMT Daylight Time) , and for dashes, I get Wed Sep 24 2014 01:00:00 GMT+0100 (GMT Daylight Time) . One hour difference
 
mmm... It is showing different in 5.30 hours...
I missed to note the hours... :D
@Timespace you are right...
 
Ban timezones - problem solved!
 
@BenjaminGruenbaum check out Hangouts :P
 
@Timespace I should use same delimiter...
Just I tested it...
:D
thanks....
 
10:56 AM
No problem
 
0
Q: Jquery : Exposing a function from module

Kamran AhmedI'm writing a jquery plugin and here is what I've written so far. if ( typeof Object.create !== 'function' ) { Object.create = function( obj ) { function F() {} F.prototype = obj; return new F(); }; } (function( $, window, document, undefined ) { "use strict";...

 
hybridauth.sourceforge.net is using it recommended?
 
11:18 AM
LOOK, who's here !!
 
@BenjaminGruenbaum I think a question about how to create a promise structure for a value or an array of values can be beneficial.
For example, for an array of 3 values, how do you generate the following promise structure? sketchtoy.com/63120452
 
Nice title for the rgoup
group
Need some help
I am using this to get a param from url
this.injected.$location.search().page
 
11:33 AM
Hi there!
 
But it doesn't updates.. until refreshed
Any idea ?
 
As jsfiddle.net is 100% and has no ad, nor premium accounts, who pays for the (huge) hosting ?
 
@SecondRikudo .map and .all?
 
@BenjaminGruenbaum Right, but I think the site could benefit from a canonical
 
11:38 AM
How to sequence promises, how to have several promises "threads" working parallelly, how to split one item into several promise "thread"
 
@Basj huge?
it only hosts small chunks of text
 
@BenjaminGruenbaum hundreds of thousands of users I can imagine?
 
A single nodejs box can easily host all of jsfiddle
 
@Basj Storage is cheap.
Computation power is expensive.
 
@SecondRikudo true... So they need huge computation power, no ?
 
11:40 AM
I think the small "hosted by DigitalOcean" link in the about should cover it
@Basj no, it just runs JS on the client
 
@Basj No, the server does little to no work.
 
all it does is serve you code
 
@BenjaminGruenbaum yes but it's at least several 100$ per month, don't you think so ?
 
@Basj ~200$ should do it
The referrals can easily cover that
 
@BenjaminGruenbaum even if it's 200$ / month, this is more than 2000$ per year.... (the authors are two web developpers, it's not a big company, right ?)
@BenjaminGruenbaum what do you mean by referrals ?
Would you agree to spend more than 2000$ per year for a, of course famous, tool that doesn't make any income for you ?
 
11:48 AM
@Basj I think you'd be silly to do so, then it is arguable about whether or not jsfiddle makes you income
Perhaps not directly, but indirectly. The question is if it makes you more than you're paying for it (in general, I'd say no)
 
How would you do in JS : a list / array of all span elements that cointains a single word ?
 

« first day (1439 days earlier)      last day (3514 days later) »