« first day (1506 days earlier)      last day (3446 days later) » 

12:15 AM
For 5 minutes I debugged
float: 25%; by changing values :-/, Good night room
 
Why do I have to set an object's prototype outside it's constructor? stackoverflow.com/questions/27208352
 
@Ret
@Retsam: thanks, almost it
Is there a way in underscore to use at the same time _.mixin and _.extend? I want both properties and methods
 
@Misiur In most cases methods are properties, so _.extend will work.
Well, actually I think methods are always properties, but sometimes they're properties of the prototype not the object itself.
 
12:34 AM
Yup, seems I screwed up testing earlier, methods are copied with extend aswell
Awesome, traits completed
Thanks for help!
 
I am so darn happy atm :D, drank red-bull after 5th cup of coffee
 
^ @Loktar ,, is that you ?
 
12:54 AM
wololo
 
1:05 AM
Somebody please give some links to learn Making Graphs using Vanilla JS
@dcodesmith seen 48s ago, talked 311d ago!!
 
!!tell vishnu google javascript graph
Read source codes
 
@SterlingArcher Already give a try. Google will show chart.js and other popular libraries. Yes i can read source but.... i am just started learning javascript. so a simple graph guided tutorial will work for me. But i cant find it on google :(
 
@Vishnu Try learning the HTML5 canvas API. It's probably your best bet for custom drawing of graphs
 
1:25 AM
@KendallFrey (y)
 
@SterlingArcher to me?
 
To anybody who can translate (y) for me yeah lol
 
@SterlingArcher Ask google via this link google.com/…
 
1:33 AM
@SterlingArcher did you see the search results i posted?
 
I did, and I'm confused, (y) is some sort of emoji for you?
 
@SterlingArcher i used it just like facebook. but did not worked :P
 
Sim
does anyone know what menu trick re they using?vine.co
 
@KendallFrey @KendallFrey I don't know why. The question just feels out of place.
@Sim define "menu trick"
 
Sim
1:49 AM
@royhowie when you are on page first it has menu with search and after you scroll down it has moving menu
im just curious what is the menu called
 
@Sim you mean the whole page? The bottom div just has a margin-top
 
Sim
@royhowie header part and one that follows it only shows after you scroll down i know one thing about the second menu it's using position-fixed im curious how is that doneit hides the top menu first and then it has position-fixed menu
 
0
Q: A good app for Web Agency project management

Lucas BI'm looking for a app that I don't know if it exists. It should work like this: I add a client to the system, and check wich steps are present in his project. Let's say I'm doing a website for my client, so I add it like this: Research Wireframes 2.1 Wait for client approval of the Wireframes ...

I feel noob the way I wrote this question, but it's legit...
I'm looking for a dashboard for web agencies, where I can give my client a login and he can track the progress of his website
like, Research, Waiting Content, Wireframes, Design, UX, Programming, Done
 
2:10 AM
Hellow guys
If im adding more content with event actions and i add more via ajax do i include the event actions within the external document or not?
 
2:28 AM
@royhowie can you help
please
 
Sim
@royhowie finally figured it out they are using header and menu after :) thanks for help though
 
@Sim can you help me?
 
OH DEAR LORD THIS WAS FUNNY
 
2:56 AM
@this.Tony please don't ping specific people to help you, if somebody wants/is able to help, they will respond
 
@SterlingArcher can you help me?
 
I didn't understand your question
 
okay so i have two files. file 1 (posts.php) and file 2 (addposts.php) and on file 1 i have a button to add more posts and also have jquery click events for when you click on a like button it on a post and when i add more posts via ajax how would i add click events to the new posts
 
Elements created dynamically would need a delegated event, google "javascript event delegation" (or jquery) to learn more
Lemme see if I can find a good SO question
56
Q: Direct vs. Delegated - jQuery .on()

moeyI am trying to understand this particular difference between the direct and delegated event handlers using the jQuery .on() method. Specifically, the last sentence in this paragraph: When a selector is provided, the event handler is referred to as delegated. The handler is not called when the...

 
im using the .on()
im using jquery but what i want to know is do i add click events to file2
 
3:06 AM
And did you read the question thoroughly? It answers your issue.
 
@SterlingArcher thanks this should solve my problem
 
Well done, come on back if you have issues with your attempt :)
 
whats the closes to
range(11, 21); in js ?
 
i will thanks thoo @SterlingArcher
 
function range(start, end, incr){
   var range = [];
   for( var i = start; i < end; i += incr){
       range.push(i);
   }
   return range;
}
?
 
3:21 AM
function range (start, end, incr) {
    for (var i  start; i < end; i += incr) {
        yield i;
    }
}
 
Oh yeah i keep forgetting generators
@ircmaxell thanks :-)
it should be function *range() though
 
xrange, ya
or do you mean literal *?
 
3:49 AM
I am console logging an array, i see it says, 'undefined' at the end of it.
any clues?
 
3:59 AM
as in console.log(array) gives undefined, or console.log(array) give [undefined] or console.log(something.array) give undefined new line undefined?
 
console.log(array)
last line is 'undefined'
 
 
2 hours later…
5:38 AM
@Wehelie Oh; that's just the result of calling "console.log". It outputs whatever you log, but the actual return value of calling console.log is 'undefined'
 
6:24 AM
would anyone here find a library that makes object declaration, complete with private, protected, and public scopes, as well as a "this" that almost always refers to the same class instance, useful?
 
6:52 AM
Hi!
Does anyone know a graph plotter that accepts JS?
 
Downvote for this?? ARE YOU FUC*ING SERIOUS??? stackoverflow.com/a/27210857/586051
 
Why no explanation (or very little?)
 
7:07 AM
sorry.
stepped away for a few minutes
I wanted to be able to define classes in javascript the way one would in more rigid object oriented languages. A little for myself, but more-so to make it easier for my juniors to get into the language.
so far, I've gotten this to work:
http://pastebin.com/JMLyWr41
So, for now, I'm trying to find out if such a library would be useful to anyone other than myself and my dev team.
 
Downvote again?? Are you kidding me???? stackoverflow.com/a/27210978/586051
This community is going crazy mann.
 
7:23 AM
@RahulDesai It sucks, but it's not worth freaking out over a couple of downvotes.
@Arkain Eh; basically sounds like you're trying to reimplement Typescript? (Sorry for the triple ping; screwed up on the link... muliple times)
 
not so much. Typescript is (imho) a bad idea.
I wanted something that is pure javascript. Just include and use.
I'm not trying to re-define anything in javascript. Just use the facilities that already exist to provide a paradigm some people are more comfortable with.
Not to mention that with the increasing power of JS, I'm beginning to miss having a "protected" scope.
 
Honestly, if people are using JS, they should work on getting comfortable with JS, and not try to write in the language as if it were a strongly typed language.
 
Agreed. My lib doesn't attempt to make JS strongly typed. That's kind of a "fools errand" to me. No matter what you do, in the end, JS is a prototype language. All I've done is take advantage of how closures work to provide protected inheritance for subclassed objects
That, and package it with an API to make it easy to use.
 
Question from yesterday, but wanted more opinions/feedback --> http://chat.stackoverflow.com/transcript/message/20194132#20194132

Not necessarily .js, but I'm most comfortable in this room.
 
7:38 AM
@Arkain I'm sure there are uses for protected inheritance, but personally I don't think it's worth the cost of 1) all the extra code that it takes to use that pattern; and 2) the memory overhead of using that many closures
You have something like 10-15 lines in order to do a more restricted version of:

function Class() {
    return {
        foo: "foo",
        bar: "bar",
        foobar: "foobar"
    }
}
 
True, but:
6 of those 17 lines reduce typing.
3 of those 17 lines are comments.

That just leaves 8 lines. You've got 7. One of my lines is the require for Class.js. Seems relatively equal to me... except that foo, bar, and foobar are not directly visible on my returned object.
Far be it from me to claim that what I've made is a cure to anything but simplified object declaration with scope protection. The fact that "this" in all of the functions declared on the class declaration is the same is a natural side effect of standard object declarations in Javascript. The fact that it remains true for derived classes is due to a method of late binding that ensures all functions point to the correct object. Is it memory heavy? Probably.
 
@Arkain How do those lines reduce typing? How is this.Foo.set("new value") more reduced than "this.foo = "new value"
 
You wouldn't type this.Foo.set("new value"). You'd type this.Foo = "new value"
Class.Property() causes Class to use Object.defineProperty on the newly declared object definition
 
@Arkain Oh. So it's the same then; still not "reduced".
 
7:53 AM
It's reduced when compared to what you'd have to type in yourself to get equivalent functionality.
Not when compared to JS without protected scopes.
 
@Arkain Except my version is equally functional to yours. That's the key difference; I don't really view encapsulation excessive encapsulation as "functionality".
 
"excessive" is a matter of opinion and subject to the needs of both the developer and the project.
So I can't make a call on that.
 
I think the statement still stands without the word "excessive". Encapsulation isn't "functionality".
 
For my needs. It's not excessive. What I inquired originally was whether or not others here might see some utility in this.
The functionality is the ability to inherit parts of the class definition without making those parts public... i.e. protected scope.
That's something JS doesn't normally do.
So, yes. It IS functionality.
 
@Arkain Protected scope is just another way of saying "encapsulation", which again, I don't think is functionality.
 
8:00 AM
:) I guess we'll just have to agree to disagree on that.
 
And again, it goes back to what I said earlier about using JS as JS, which is a prototypical language, not trying to use JS like it's some other OO language.
@Arkain Fair enough. If you think it's worth the memory cost and the unwieldy syntax, more power to you
 
I'm curious. You think the syntax is unwieldy? In what way?
 
@Arkain 7 lines of imports, the redundancy of foo: Private("foo"), the necessity of defining getters/setters
 
There's only 1 import line. The other 6 lines are just for convenience of typing.
foo: Private("foo") could have easily been foo: Private(3)
The value in the parenthesis is the thing being made private.
Getters and Setters aren't necessary, but if you want to define a calculated value, then Object.defineProperty is needed, therefore Class.Property().
Does that make sense?
If it still doesn't, then I may need to re-think the interface.
 
8:15 AM
@Arkain Ah, yeah, I misunderstood that.
I mean, there are still 7 import lines. Yes, you could remove them, but that would make it worse, not better.
@Arkain I've never used Object.defineProperty in my life, but yet I'm pretty sure I've done "calculated values" before.
 
I just did the math on the closure overhead. It's less than 500KB for a system of 9 Classes with inheritance relationships and multiple instances of each class.
I'd say that's pretty small for having over 10K closures hanging around.
Not all of them are due to my code.
How'd you do a calculated property (like Array.length) without Object.defineProperty? You'd need to call a function.
 
@Arkain Yeah; I suppose I do mean "calling a function".
 
Question
I have two numbers
1 and a "random" decimal
I want to generate a random number, and if it is below the decimal, output true, else, false
Seems simple
however it's for accuracy on game moves
so the decimal may be 0.75
and i want it to return true 3/4 times
is Math.random random enough for that?
 
not really.
in the long run, yes. The statistics will work to give you what you want, but in the short haul, you could easily end up with a run of 1000 values all above or below 0.75
 
8:31 AM
what should i use
 
You still want to use math.random, but you want to wrap it in some kind of biasing logic to ensure a closer adherence to your chosen accuracy rate.
 
How do I do that? Do i give the accuracy a "clearance"? i.e. 0.8 is still "true"?
 
Try thinking about it this way
imagine 2 buckets, one under your limit and one over.
 
ok
 
in the first one (for a limit of 0.8) you'd give it 4 entries, and the other would only have 1
if your first random number was under your limit, now the first bucket has only 3 entries.
in that first go round, your bias was 5
 
8:36 AM
ok
 
on the next go round your bias is 4, but suppose it came in over your limit. Now your second bucket is empty.
 
yeah
 
The next 3 rounds must necessarily be drawn from the lower bucket
once all buckets are empty, reset.
 
oh. got ya.
so players can't get unlucky?
 
something like that.
but that's only if you need to strictly adhere to the accuracy setting.
Using a multiplier for the buckets would decrease the strictness.
 
8:40 AM
ok
 
That would be like having an initial bias of 20 instead of 5 with 16 in the first bucket and 4 in the other
 
If the question is "is Math.random random enough?", if you're not doing something with cryptography/security/UUID, the answer is yes.
 
Alright
 
Retsam, from experience, when developing games, math.random isn't always enough... not when dealing with limiters like deep described.
 
@Arkain It sounds like he wants an attack that hits 75% of the time. Math.random is plenty fine.
 
8:43 AM
> '#!/E/F'.replace(/#!?\/?/);
'undefinedE/F'
 
but if extreme bad luck is ok, then math .random works just fine.
 
Why it displays undefine?
How i remove that?
 
@AvinashRaj ``#!/E/F'.replace(/#!?\/?/, "");`
You need to specify what the match should be replaced with. Since you didn't, it defaults to "undefined"
 
OMG.
forget that.
sorry.
 
9:02 AM
@Retsam isn't math.random implementation-defined?
I wouldn't use such a generator for games, in principle.
It's ironically not about "random enough" - quite the contrary
 
@BartekBanachewicz Let me refine my statement: "assuming you're only intending to support a major browser released in the last decade or so, Math.random is plenty random enough"
 
hello guys i was wondering how can i update loaded more content without refreshing page???
 
@Retsam is the behaviour guaranteed to be identical for all of those browsers?
@this.Tony Google XHR
 
im using jquery ajax @BartekBanachewicz
 
@BartekBanachewicz Identical? Maybe not. Good enough? Yes.
 
9:06 AM
@Retsam It's often not good enough if it's not identical. Why? Imagine a multiplayer game. Or a game that allows you to store replays.
 
the reason why im asking this is because i have a like button and everytime a post is liked i want to update that post so that the like button counter is updated
 
@BartekBanachewicz That wasn't anything resembling the question asked.
Sure, if you want to support random number seeding, you're going to need a consistent random number generation algorithm... but that wasn't the question asked.
 
Not this particular time, no. My point is that random numbers aren't easy and treating them like if they were is hardly a good idea, IMHO.
 
The question was "I want a function that returns true 75% of the time; is Math.random() random enough"
@BartekBanachewicz Great to know, and trust me, I know; but it's a terrible way to answer a simple question.
 
Or is it?
 
9:10 AM
@BartekBanachewicz Yes. It is. If all you need is a function that returns true 75% of the time, then bringing up "Math.random is browser-implementation specific" has literally nothing to do with the answer to the question.
 
The proper answer to the question should mention that this could be solved using specialized generator and distribution function.
 
@BartekBanachewicz That's crazy.
That's ridiculously unnecessary, overcomplicated, and provides the exact same functionality.
 
No, it doesn't provide the same functionality
That's like saying node.js and php provide exact same functionality because they both serve web pages
 
@BartekBanachewicz So which of our functions won't return true 75% of the time?
 
@BartekBanachewicz did you understand what im asking?
 
9:13 AM
I'm on mobile, but I bet the one that used modulo operator
Anyway, meh. On the one hand you claim you understand the problem. On the other, you're ignoring this understanding. This is going nowhere.
 
@BartekBanachewicz The correct answer is neither. Both my function using Math.random() and your function using a hundred lines of custom written generator and distribution function will return true 75% of the time.
 
Or so you think
Also I like how you needed to mention "hundred lines"
 
@BartekBanachewicz Yes. It will. Every single browser has a decent implementation of Math.random which will give well distributed random numbers.
 
TLDR don't answer with shitty incomplete explanations, -1
Bbl.
 
@BartekBanachewicz Wow, it never ceases to amaze me what an asshole you are.
TLDR: Answers should be about helping the person and giving them the information they actually need, not about showing everyone how much of a goddamn intellectual you think you are.
 
9:31 AM
Is this really the best way to read an HTTP response in Node.js?
function readFully(stream){
  stream.setEncoding("utf-8");
  return new Promise.Promise(function(resolve, reject){
    var chunks = [];
    stream.on("readable", function(){
      chunks.push(stream.read());
    }).on("end",function(){
      resolve(chunks.join());
    })
  })
}
 
10:13 AM
@Retsam lol, low self-esteem much?
@this.Tony expose a rest API on the server and use .ajax to fetch data from it. You're on the right track.
 
what do you mean expose a rest API on the server?@BartekBanachewicz
sorry im still a beginer
 
@this.Tony say, you want to fetch a number of likes of a button
you need a way to get just that from a server, not the whole HTML shebang of information
say, create a GET handler on /posts/x/likes that returns a JSON with that number
if you're using one of those modern web framework gimmicks, there's a high chance they already generate such APIs from your model
 
@BartekBanachewicz exactly but i would like to not only get the likes but also the comments for that post so pretty much i thinkk i should get everything from a post
 
@this.Tony everything != HTML. You still want to be sending relatively thin data there
you could, instead of sending just the post id, send the timestamp of last update
this way you'd get only "delta" from the server, from your last update to "now"
I've never written a facebook, though :)
Also long polling is a pretty bad thing and in a few seconds someone actually compenent will shout at me how you're supposed to be using websockets and stuff
 
10:21 AM
@BartekBanachewicz im still a beginner and websockets are far from where im at lol but im going to try something else
 
@this.Tony what something else
 
Websockets are easier than long polling
 
well im going to load all 400 posts and only show 50 so if ssay i hit the like button it will update eveything inside a div because that what i was doing before and it seemed to work with the more button @BartekBanachewicz
 
@JanDvorak they're not if you're going through a web middleware
 
@JanDvorak the thing is i dont have time to learn websockets and plus i have to release this website soon and im trying to see whats the best way to do this
 
10:24 AM
@this.Tony uh what
 
Drink a lot of coffee and learn how to use websockets
 
how can you load data that's not there
 
@BartekBanachewicz as in if your server has to long poll anyways?
 
@BartekBanachewicz okay say 800 posts are in the database im going to load 400 if ther is 400 and im going to only show 50 so that if you hid the load more button 50 more will show till it gets to a total of 400 do you get me?
 
@this.Tony what's the point of loading posts that you aren't going to show?
 
10:26 AM
@JanDvorak hm? I dunno, I just send keep-alive on both ends and technically the only overhead is the header here.
 
So just load 50
 
@this.Tony why don't you just load 50
and then load next 50
 
Will the average user press load 8 or more times?
 
There's no point in loading data to keep it hidden, really
 
paging is a kludge anyways
 
10:27 AM
Also I thought the point is that users are adding those in the meantime
 
you guys have to point but i cant seem to do this any perfect because i cant get a good answer and im dying over here lol
 
there's no good answer if we don't know what you want to do
seems you don't know what you want to do either
 
@BartekBanachewicz ok wait let me explain
 
how about you read something about how it's done first?
You know people write shitload of articles about REST, web dev, name it you get it.
 
Let's not be jerks ok
 
10:31 AM
I'm not a jerk.
Just pointing out that we can sit here on his problem, or he could try to look for examples, and only if he has problems with these come here.
That's the spirit of SO in general.
 
Hey I wasn't saying anyone was being a jerk
 
50 posts are already loaded and you hit the load more button and you hit the like button... once you hit the like button i want to load all the comments and likes for all of the other posts that have already been loaded.. do you get me?
how can i do this via ajax
 
You have ajax fetch a page that has more posts on it
 
so... I can only see past the first 50 posts if I dump a +1 vote on any of the previous ones?
 
10:34 AM
^
 
@JanDvorak what do you mean?
 
Oh. NVM. Still... huh?
 
omgosh you dont understand?
0
Q: How can I update loaded content without refreshing browser

this.TonySo I have a li tags that are posts and inside each li tag there is a like button. so when someone likes a post i want to update the post so that the like button counter is updated and i want to include this for loaded more content also.. so far i have this let me know if you guys need to know mor...

 
Look into Ajax...
 
4 mins ago, by Meredith
You have ajax fetch a page that has more posts on it
That is how
 
10:40 AM
@Meredith how much more posts and thats what im doing... i have ajax fetching 50 more posts everytime load more is clicked
is that what you mean?
 
You request a page that has the data required to display 50 more posts, then you insert that into the DOM.
 
@Meredith yea that what im doing BUT I want to be able to call a $.ajax get request and still have the li tags that were added when more button was clicked
 
Rephrase
 
@this.Tony ...???
 
@this.Tony .append?
 
10:44 AM
here's my problem if i click on the load more button 3 times its going to load 150 posts
 
Yes
 
That's desirable, isn't it?
 
and if i click on a like button im going to call a get request via ajax
and its going to get the posts without including the other 150 posts
that were loaded
and thats whats killing me
 
tell the server how much data you want
 
what do you mean "like " data
 
10:46 AM
What?
What happens when you click like?
 
@this.Tony fixed
 
@this.Tony just how much data :P
 
smart
 
I meant, data about likes
 
but how just send a number with ajax call?
i should just send a number with ajax call and input that number on the LIMIT query
 
10:47 AM
If you're "liking" something
 
!!tell this.tony jquery get
 
All you need to do is tell the server what you liked
 
damn you, bot!
 
yeah i know but i dont just want to load that post i want to load all the other posts data so it can be sorta like real time
 
Rephrase
 
10:49 AM
Just look up the docs...
 
im just going to send a number to mysql query through ajax call
i dont want to waste any more of your time
 
Is the number the post id?
 
no the number is the number of times you hit the show more button + 50
 
Why?
 
so if you hit the load more button 3 times then its going to load 200 posts without refreshing the page
and within that its going to load all the posts
thats basically what i want
 
10:52 AM
That makes no sense
Are you reloading every post every time someone likes something?
 
Well, you can send that to the server...
 
because if you guys liked a posts before the one i liked i get to see that someone like the post before mine
because the posts updated when i clicked on the like button
its sorta like realtime because everything updates
 
So the user's view only gets updated when they press like or load more
That's not realtime hun
 
yes or when they refresh the page and its sorta like real time because they arent refreshing
 
Why not update them when they change?
 
10:55 AM
what do you mean when they change?
nvm how
 
What?
 
how can i update them when they change?
 
Websockets
 
i dont know how to use websockets
 
Once upon a time I didn't know how to tie my shoes
Now I know how to tie my shoes
 
10:57 AM
trust me i was going to try that approach but too much work maybe once my website is up and running
i have so much other features to worry about then to waste time lagging on the launch
 
When did your boss say it was due?
 
lol
my own website
 
So you don't have a deadline?
 
my birthday dec 15
i still have to test some other features
 
You should probably learn how to use websockets
 
11:00 AM
^
 
i am maybe after launch because im going to need too
 
Or you can spend 10 hours figuring out how to do this with ajax and still end up with a worse product
 
just attach open and message handlers and you're done.
 
you make it sound so easy
 
var ws=new Websocket(url); ws.onopen=function(){...}; ws.onmessage=function(e){...}
bam, you're done
 
11:02 AM
im going to screen shot this so when i learn it i can already have a head start
 
ws.onopen is for when you want to send stuff through the socket before the server does
 
Really the only issue with websockets is setting it up on your server
 
use node.js
 
Cheap hosts don't really like them
 
yes that where i was stuck on
no i have to use what i already learned and then i will start recoding
 
11:04 AM
" i have to use what i already learned" - not true
 
till then im stickin with ajax and auto refresh with jquery
 
...
 
Tbh just do what espn.com does:
ESPN_refresh=window.setTimeout(function(){window.location.href=window.location.‌​href},900000);
 
lmao
ahahaa
thats what im using
but only when all eventlisteners are inactive
with a timeout of 7 minutes
 
What?
That was a joke
Don't do that
 
11:07 AM
why not?
 
...
 
if all eventlisteners are inactive might as well
function setup()
{
this.addEventListener("mousemove", resetTimer, false);//needs to be fixed where this caculates if mouse is frozen or still or no moving
this.addEventListener("mousedown", resetTimer, false);
this.addEventListener("keypress", resetTimer, false);
this.addEventListener("DOMMouseScroll", resetTimer, false);
this.addEventListener("scroll", resetTimer, false);
this.addEventListener("mousewheel", resetTimer, false);
this.addEventListener("touchmove", resetTimer, false);
this.addEventListener("MSPointerMove", resetTimer, false);
 
eugh
 
bahahahaa
im still a NOOB
@Meredith why is that bad?
 
It's just a really bad way of solving the problem
 
11:11 AM
Now for the next topic: how do you promisify a function that doesn't follow the node.js convention of passing an error as the first argument in bluebird?
 
@Meredith i will keep that in mind ;
 
Speaking of node
I gotta write a whole project in like 2 days
I should get started on that soon
 
Has anyone had an issue generating the same hmac hash in PHP and Node.js? For some reason the two are different... (For sha256)
 
newlines? Different parameters?
 
No, same parameters
@JanDvorak I trimmed it, still nothing
 
11:38 AM
anyone want a brain popcorn
 
11:57 AM
Hey guys
 

« first day (1506 days earlier)      last day (3446 days later) »