« first day (1646 days earlier)      last day (3296 days later) » 
00:00 - 16:0016:00 - 00:00

12:10 AM
@Catgocat convertANumberToAString(0.1, true)
 
Guaranteed to be faster than native
 
12:46 AM
I am developing an API that is secured using HMAC and a timestamp for expiration. What is a generally acceptable amount of time to expire a request? Currently I am using 8 minutes.
 
 
4 hours later…
4:39 AM
o/
 
\o
 
4:58 AM
How can I make my promise throw an exception that I can .catch?
 
Use a decent library
 
I can't just throw new Error('blabal');?
 
Depends. Are you using a decent library?
 
bluebird
return this.exists(d).then(function(exists){
  if(!exists){
    return computers.create({domain:d});
  }else{
    throw new Error('ComputerAlreadyExists');
  }
});
this.exists(d) is a promise and should throw error
maybe I am not asserting correctly since my test fails
assert.ifError(err); if thrown should pass?
nvm just had to use assert.throws(err, Error);
since assert.ifError(err) isn't correctly recognizing thrown Errors()
 
5:24 AM
Is there a popular js/jquery library that can give me an easily templateable grid-like layout? Something I can hook up to an array and give me something like Chrome's New Tab page, a customizable-size grid of complex objects?
 
Always nice when a failed mission brings back 250+ science
 
@AvnerShahar-Kashtan You could try Pingendo editor..
don't know about any specific js library.. GSS is cool. It replaces CSS :D Big time
 
I was hoping for something that already does the heavy lifting, like JQuery EasyUI already does for tabular datagrids, for instance.
 
drag drop customization?
 
Not needed at this time.
 
5:29 AM
very easy layout engine
It's a bit different..
 
Yeah, I'm looking at it now. It does seem very nice, a much more intutive and declarative way of laying out elements.
 
You create html for defining elements, css for textures and gss for structures or layout.
I use It very much.. especially when I can't do something with css ( I'm pretty bad with css )
@AvnerShahar-Kashtan vimeo.com/91393694 A brief introduction..
 
@l0oky I'll get to it (sitting at a cafe without headphones right now, so videos will wait), but it will probably not make its way into this project in the next couple of sprints.
 
Yeah. GSS feels like a big hack for now. I feel like It should be implemented in browsers. :D
You can use CSS and GSS side by side..
 
stackoverflow.com/questions/29725661/… should I custom flag a question that's an obvious plug for someone's github repo?
 
5:38 AM
@royhowie ofc
 
@royhowie Vote to close
 
I voted to close the question (b/c it's asking for an offsite resource)
why do my "unclear what you're asking" flags get disputed, if the question is closed as "too broad"?
I've never understood that
 
Just flag with a custom message :D
 
@l0oky (referring to other questions, not that one)
 
MLM
6:33 AM
Why is f not defined? Working on #9 of the javascript quiz Catgocat linked
if (function f(){}) {
	// ...
}

f
Trying to find some info about declarations in a expression/condition
 
named function epression !== function declaration
You can't have a declaration inside an expression
 
MLM
But it does evaluate to true?
 
Functions are objects
 
MLM
Yes but since you "You can't have a declaration inside an expression" why is it still kinda working
It seems to get declared but doesn't escape the condition/expression "scope"
 
Named function expressions create a new function with its name set. Here, the function is then tested for truthiness and discarded. In a function declaration, you also get it assigned to the variable of the same name before the rest of the code executes. This is not a declaration, however. You only get a declaration if you start your statement with the keyword function. In any other place, it's an expression.
 
MLM
6:46 AM
hmm, I believe you but I am trying to find it in the spec. 12.4 Expression Statement?
> Also, an ExpressionStatement cannot start with the function keyword because that might make it ambiguous with a FunctionDeclaration.
 
That, and the semantics of FunctionDeclaration
> 5. For each FunctionDeclaration f in code, in source text order do
> The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function to call itself recursively. However, unlike in a FunctionDeclaration, the Identifier in a FunctionExpression cannot be referenced from and does not affect the scope enclosing the FunctionExpression.
 
@SomeKittens umm... no
 
MLM
@JanDvorak This sums it up really well. Along with your own very understandable description above
Thank you for the help and references :)
 
@JanDvorak very yes
 
MLM
6:57 AM
A named function expression in disguise as a function declaration
 
It's a named function expression :-)
 
hi, is there a built-in javascript equivalent of c++ lower_bound? Briefly, lower_bound means given a sorted array find the first position where a given data could be inserted without compromising the sort invariant.
 
Not really, but you can make one
 
ok, just checking before implementing one.
 
In Haskell you'd do (left, right) = span (< el) ary
 
7:31 AM
Hello everyone!
 
This is not the place to advertise yourself...
 
It surely isn't.
 
Then don't post it here...
 
I even checked my answer in the console ("1function"), yet this thing disagrees
 
@royhowie refresh the page first
 
7:44 AM
I have the intuition that it's browser specific
refresh the page for what?
 
did you already run one of the other bits of code?
you probably had a function called f in scope already
 
oh
don't some browsers hoist even in that case, though?
 
Hey guys, do any of you know when tail call optimization will be available in V8 or Spidermonkey?
 
@IanClark clearly an outstanding question \t
 
7:53 AM
:D
 
@KamranAhmed especially not to multiple rooms at once. Flagged.
 
8:08 AM
testdome.com/cert/8k3ntsub9u this website has the easiest html/css/js web "certification" ever
testdome.com/Programming-Tests/Html-Css-JavaScript/16 the whole test took me like 3 mins
I can only wonder who actually uses this for screening
 
8:22 AM
Your total score for the HTML/CSS, JS test was 100%
Great! That score puts you in the top 10% of all candidates.
...
That was ridiculous
 
fizbuzz of frontend dev?
 
8:36 AM
Wow
And what was the point of the decorateDiv() function?
And the final question of "fix this shiz" (paraphrashing), was like... ok
 
8:57 AM
@phenomnomnominal that means that someone has actually failed the test? wut?
 
@towc some people are really bad
 
Perhaps they came, they saw and they decided it wasn't worth the effort
 
more likely
 
How is CommonJS similar to require?
and differences respectively
 
@StevensHaen what do you mean? CommonJS vs node require or, CommonJS vs requirejs/AMD?
 
9:00 AM
isn't common async?
I'm not familiar with it. I have worked with require
 
hello there
guys, is there a moderator at this site that is good at js
 
@VividD Hopefully, there would be soon.
 
define "good"
 
my points, there should be
 
@VividD Vote for me then :)
 
9:06 AM
good = knowledgeable
 
define "knowledgeable"
 
knowledgeable = good
lol
 
*** Exception: <<loop>>
 
What's the meaning of "interface" in terms of JS modules?
 
@StevensHaen The same thing as other languages, the agreement on what methods/properties are available, what parameters they expect, and what they will result in. :P
 
9:34 AM
@SecondRikudo GL btw, you got one of mine :)
 
9:53 AM
cc @SecondRikudo @Mosho
@SomeKittens look at the description :D
 
Who's that Ben guy, I'd totally do him
 
> Benjamin is a software engineer who doesn't afraid of anything.
c00l grmr brh
 
10:16 AM
@BenjaminGruenbaum can you arrange a better priced ticket?
 
What is the hype about node.js? How is browserless JS runtime superior when building applications?
 
Unlike browsers it can access HTTP, filesystem...
 
@JanDvorak Could you clarify why functions are used as namespaces for me/
 
so that they can be called?
 
10:31 AM
@JanDvorak I see.
 
@StevensHaen It's not. It's just a very easy environment to build server-side applications with a high performance and real-time capabilities. Plus the fact you can share code with the browser makes it convenient, but it's not some kind of magic solution to all of your problems.
 
So, the module interface is a list of the methods/properties that can be called from it?
@RoelvanUden how does performance imporve? Looks the same to me.
 
@StevensHaen The same as what?
 
@RoelvanUden the Chrome console for example
 
That's a completely irrelevant point. It's a server environment.
You build server applications with it. Compare it with Ruby, .NET, PHP, etc.
Whatever you normally use on the server.
 
10:34 AM
@RoelvanUden How is it even possible to build server-side apps with JS?
JS was meant for the front end
 
@StevensHaen Are you trolling or is this a genuine question?
 
I'm serious
 
why would it not be possible
 
For example, how do you connect to a RDBMS via JS?
 
it's not "via js"
 
10:36 AM
It doesn't matter what you run on the server side. I personally use C#.NET environment for nearly all of my server-side needs; but NodeJS is a capable platform. Who cares what something was "meant" for? If we'd stick to that, we'd not have any technology today.
@StevensHaen You get a JS interface to some DB bindings so you can interact with it.
 
We don't want to end up in a huge mess, that's all
 
You also get bindings to things like accessing the file system.
 
I am really shaky in this subject
 
@StevensHaen And what exactly do you use right now for your server-side environment?
 
I've never used anything else but PHP for the purpose
 
10:38 AM
good, then you can only improve
 
Are you really saying that PHP is not a huge mess? ;-)
 
I'm happy with it is my answer
 
@SecondRikudo can't Taboola pay? They have better negotiating power
 
Then stick to it. Don't look further. Don't try to look at other solutions to see what makes them tick and how they can improve your life. Don't embrace other philosophies. After all, you're happy with the current status quo. Don't be surprised if your expertise is no longer required in 10 years though.
 
Woah, 10 years is a massive overestimate.
In this day and age
 
10:44 AM
@StevensHaen NodeJS has a lot of advantages over PHP
PHP has some advantages over NodeJS
We can list them out for you, but I doubt that'll do any good.
Give it a shot, build stuff, try it out, and you'll see for yourself.
 
@SecondRikudo I'm not ready for advanced stuff yet, I mean, it just came as a surprise for me that you could use JS as a controller.
 
@StevensHaen And you'll never be.
You just gotta make the jump at some point :)
 
In all honesty you should learn about something other than the fire-and-forget paradigm. If that's all you know, every language will remain a mystery. That Java, .NET, Node, etc, are all using that "crazy thing where you can even share variables between requests"
 
@StevensHaen the biggest advantage NodeJS has over PHP (or rather, the biggest disadvantage PHP has over pretty much every other language) is persistent memory between requests.
PHP is not a webserver, it's a tumor attached to a webserver.
With NodeJS you actually control the webserver
 
What would be a really good read with exercise apps in it for NodeJS?
 
10:49 AM
@StevensHaen How familiar are you with JavaScript?
 
@SecondRikudo moderate
slightly advanced
 
@StevensHaen JavaScript: The Good Parts and Eloquent JavaScript are both good books
 
I am half way through Eloquent
 
I'm not familiar with any great books specifically about serverside JavaScript, but I also don't think you really need one.
 
I'm talking about nodeJS specifically
 
10:51 AM
If you're sufficiently familiar with JavaScript, NodeJS should come pretty easy with tutorials you find online
 
Tutorials often times just scratch the surface and are unprofessional from what I've seen
@SecondRikudo What do you think about his one by the way (unrelated to Node) freecomputerbooks.com/Programming-JavaScript-Applications.html
 
Haven't read it.
 
Oh, Eloquent covers NodeJS, sweet
 
11:14 AM
Keen to get more eyes over this if I can. Want criticism
3
 
module.exports = function person(options){
  return {
    firstName: options.firstName,
    lastName: options.lastName,
    //hides internal implementation
    name: function name() {
     return fullName(this.firstName, this.lastName);
    }
  };
};
is modules an object literal here? I can't get my head around the options argument
 
It's a module which returns a function
 
this refers to it's parent object, i.e. function name(), correct?
@Qantas94Heavy Which parts should I export?
 
this works the same as any other time
 
@Qantas94Heavy it's a reference to the parent object?
 
11:20 AM
Only if you call it as a property
 
So, this exports thing is a single key in the module, that could have an array of possible values?
 
11:43 AM
duh.
 
Why do we wrap the return functions of a module in a separate object?
 
12:04 PM
How do you deal with people who argue about false things?
For example (and please don't downvote ring him) stackoverflow.com/questions/29729067/…
 
@BenjaminGruenbaum You completely and utterly decline to acknowledge his/her existence.
 
That's a way, sure.
 
@vtz The last update to that article was 7 years ago. We moved on quite a bit since. — Second Rikudo 57 secs ago
 
12:24 PM
With Bluebird, I should be able to do something like this, right?:
return new Promise((resolve, reject) => {
  resolve('hello world');
});
 
Yes, why?
 
Hmm.. the TypeScript bindings for Bluebird must be bonkers I suppose.
String is not assignable to parameter of type Thenable<string>, which is weird
 
Not really
A string isn't a Thenable<string>
 
Yeah but why would resolve require a Thenable<string>?
As argument that is
 
Does it? I'd expect any
 
12:29 PM
That's why I believe it is bonkers. It should be any indeed, but it's a Thenable<any>
So if I go Promise<string> it's a Thenable<string>
 
0
A: Merging branches on GitHub created on different locals

Second RikudoYou should first understand how branching is done in Git. Git doesn't really have a concept of branching like you might think of it. A Git "branch" is actually just a pointer to a commit. The "branch" you think about, is actually implemented by chaining the top commit (called the branch's HEAD, ...

feedback please?
It's a big answer
 
@SecondRikudo very nice
Thanks for trying to help but I'm downvoting this because it is not useful to any future visitors on this site except OP. I appreciate the effort though and the time you put into trying to help another user. — Benjamin Gruenbaum 7 secs ago
 
4/5 votes
 
12:45 PM
I wonder whether they'd take to such a comment positively. For me, I could see someone taking that as a passive-aggressive comment.
 
closed
... which is a close reason as well. Don't forget to vote to close — Jan Dvorak 3 mins ago
 
12:59 PM
@KendallFrey I've a small math question
 
@KarelG why ask him in particular?
 
he has admitted once that he's just a nerd. So the chance is high that he could answer my question easily
 
We all know a little math
 
i know. but it's about permutations and rotations/mirroring and possibility of elimination of a 2D array values. I should define an upper bound instead of finding the right value
 
1:17 PM
Morning :)
 
Thanks, i've already done it, but it don't works :/ — Antoine 50 secs ago
sigh I make the same mistake over and over again.
 
voted unclear
 
you could have added the snippet showing the canvas_id to do step 4 :p
 
Hey guys! Could you possibly help me out get on the path of learning google maps API? I am stuck at hello world following their tutorial. Am i using the wrong API key? jsfiddle.net/tc4zohf4
 
@Sergiu-AntoninGhita 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.
 
1:27 PM
I don't remember the API key used in their tutorial, unfortunately
 
@JanDvorak They don't have one. It's API_KEY as the value.
 
I gotta watch out, I'm less than 100 points from the jQuery tag :(
 
It's most likely not the key. I get requests in the google developer's console. Plus, you can actually see the script if you open the link with the key i supplied.
 
ooh, the new user profiles :-)
 
Do inform me if i'm in the wrong channel to ask, as it's the first time i use stackoverflow channels :)
 
1:32 PM
You're fine here. I can't see any problems with the code, but I don't have any google maps experience
 
On my node application it briefly loads a portion of the map and gets removed immediately in less than a second
 
guys is there any opensource report designer which will work with html and javascript?
 
What's that?
 
@Sergiu-AntoninGhita jsfiddle.net/tc4zohf4/3
 
@Kar
@KarelG thanks, any explaination as to why it didn't work with their google.maps.event.addDomListener(window, 'load', initialize); ?
 
1:41 PM
that line triggers if you manually load the page i think. i don't use that function
.
.
 
Thank you for that @KarelG
Why the edit? :D
 
meh, i was not sure if both events would conflict if both are hooked
it's been a while when i played with google maps. i am using Leaflet for displaying maps.
 
The issue was actually CSS related. At least for the node application.
 
2:05 PM
I don't understand answers to Haskell questions, they always focus on the wrong thing :/
Except for @AaditMShah's, his are usually spot on
23
Q: Bringing babies to bar?

krugmeister65Full disclosure: I'm not a parent. I was at a bar last weekend, and I saw something that was pretty startling to me. There was a woman with a baby in a baby bjorn, standing in the bar drinking and talking to her friends. I don't mean a small toddler, I mean a infant. He looked like he was at mos...

 
@BenjaminGruenbaum Hi. did you write any articles( so I can read) about Reactive programming, Observables ? I saw your request to ngconf. and I thought you might have suggested favorite links/articles of your own
 
@BenjaminGruenbaum Do you have something to tell us Benji?
 
@RoyiNamir Generally, I don't write a lot. I just thought I'd offer to give an advanced talk at ng-conf - something that's not CSS/HTML or super basic "how do I grunt" and I figured this is something people would like, you can +1 it on the pr if you like the idea.
 
@BenjaminGruenbaum Link?
 
2:33 PM
hello fellow coders. Has anyone worked on this problem?
JavaScript code to create current time and if it's in between two time boundaries to execute some code?
 
@macroscripts Yes, it's quite a common problem.
Have you tried searching?
 
yes
I am searching as I type. But I come here to ask as well
Do u have solution?
 
Google does. Look at the Date object
!!tell mac mdn date
 
What's an "explicit dependency"?
 
2:39 PM
A dependency you mention explicitly, I assume?
 
So, that makes it discrete?
 
Thanks for the edit on stackoverflow.com/questions/29728024/… @SecondRikudo
 
@macroscripts we don't use u here, you're a programmer you can type.
How silly would I be to open a dupe of my own question and then close it?
Imma do it
 
posted on April 19, 2015 by admin

Hovertext: Mmm, claspers. New comic! Today's News:

 
2:43 PM
@BenjaminGruenbaum I can already hear the rustling of pitchforks
 
@BenjaminGruenbaum i dont understand.
 
@macroscripts I
0
Q: What is the promise constructor anti-pattern and how do I avoid it?

Benjamin GruenbaumI have code like this where myPromiseFn returns a promise: function getStuffDone(param) { return new Promise(function(resolve, reject){ myPromiseFn(param+1).then(function(val) { resolve(val); }).catch(function(err) { reject(err); }); }); } ...

@SecondRikudo @JanDvorak I tried, let's see how it's accepted by the community. It just got brought up a lot of times before in answers
 
hey guys
 
@BenjaminGruenbaum What are they gonna do? Close it? :P
 
I am trying to fix a bug in IE11... something about cookies. it seems to me like IE won't get rid of its cookies.
 
2:51 PM
Should I ask about it in meta?
@guymograbi that gives us very little to work with.
 
I can already hear the torch fuel crackling. Wait, is it supposed to crackle?
 
yes. sorry.. I have a node/express server with session cookie. When user logs in - the id is kept on the cookie. Now lets say I manually went to the login page again and logged in again. In chrome/FF it overrides the existing userId on the session cookie, in IE it keeps the old one..
 
@BenjaminGruenbaum when a promise question is posted: img-9gag-ftw.9cache.com/photo/aNZO6Ov_460sv.mp4
 
Are there multiple cookies with the same name but different paths or domains?
 
app.use(require('cookie-session')({
secret: conf.sessionSecret,
cookie:{maxAge:1, expires: new Date(), path:'/', http:false}
}));
 
2:53 PM
@SecondRikudo I actually actively try to avoid this and let other people answer.
 
So I tried deleting all the cookies.
and in the code I set it to a specific path from now on.
I also set it to expire very quickly. nothing helps.
 
Is the cookie http only?
 
tried both.
either way can't see it in document.cookie
 
That's what I was about to ask
 
i am going a bit crazy here..
 
2:55 PM
Is it a different session?
 
the only thing that helps is
in developers area there's a button - "always refresh from server"
when activated.. everything works just fine..
but obviously I need it to work without it
deleting the cookies with every combination alt+.. or buttons in developers area appears to do absolutely nothing.
 
@BenjaminGruenbaum I hope you don't mind me asking that question in comments. In the linked question also, Promise.resolve was not mentioned. So, I put that comment there so that future readers will know what to do in ES-6 instead of using new Promise :-)
 
@thefourtheye I don't mind it, you're also welcome to add an answer about that part (delcarative) on the dupe
 
Is it a better practice to export module methods via the export object, or just return them all withing the module?
 
@BenjaminGruenbaum Come on, you know Promises a lot better than me :-) Can your answer be edited to include that?
Oh, ES-6 was not even tagged there :'(
 
3:04 PM
If I keep the IE window open, and delete the file from FS, and click "refresh" it still remembers the cookie.. I have to delete the file, close the browser and reopen and only then it reacts as if the cookie was deleted
 
> You've got 0 answers wrong.
Flawless victory.
 
I have the js code written here. jsfiddle.net/52s1pqhL
 
But it's not working properly
 
Nice quiz, indirect calls and hoisting can be a bitch, and mutable arguments in lossy mode too
 
3:07 PM
@macroscripts Too. Many. Alert. S.
 
This one has less.
 
@macroscripts Why exactly are you breaking the current date into components, composing them into a string and parsing that string as a current date (twice)?
@macroscripts I'd take the timestamp modulo 1000*60*60*24 and do a range check on that. Better than crafting a string to parse.
Or you can use Date#setXXX
 
"1000*60*60*24 and do a range check on that. Better than crafting a string to parse." This looks promissing :)
I'll try it and get back to you
 
Is clash of clans is html 5 game ?
 
@macroscripts no, you didn't. They don't parse the string back into Date
 
3:11 PM
so "1000*60*60*24 and do a range check on that. Better than crafting a string to parse." is the simplest solution?
 
Date.now().setHours(..).setMinutes(..).setSeconds(...) > Date.now() is another option.
(pseudocode)
 
I play clash of clans
@jemz Im its not html5
 
@Catgocat, is it java ?
 
function require(name) {
  var code = new Function("exports", readFile(name));
  var exports = {};
  code(exports);
  return exports;
}
Why do functions take exports as an arg? Isn't this a object that's always "there"?
 
@jemz Im sure its in Objective-C and Java
both for iOS and Android
 
3:16 PM
@Catgocat, what game engine did they use ?
 
Idk lol
 
@Catgocat, Thank you.
 
im sure the engine is not exclusive cause there are other copies of the game that released before COC
hero sky, boom beach etc..
COC had such success cuz graphics
 
@StevensHaen that's how it's implemented
That's how it's always "there"
 
@Catgocat, so hero sky , uses same engine like COC ?
 
3:37 PM
@BenjaminGruenbaum he he, nice.
But that's a terrible picture of you
 
Yeah, it is
lol
 
@BenjaminGruenbaum I posted an answer in the dupe, please give feedback.
 
@thefourtheye upvoted, lgtm
 
Thanks man :-) Please let me know if it can be improved, any time
 
@thefourtheye I learned something, nice
 
3:45 PM
Oh, thanks :-)
 
@BenjaminGruenbaum what did you think of my XHR canonical draft?
 
@SomeKittens link?
 
fetch API is half-dead
 
3:59 PM
looks good overall
 
hi, I want to create a function that takes a string argument by reference and modifies it. The javascript way of doing this is to return a modified copy?
 
00:00 - 16:0016:00 - 00:00

« first day (1646 days earlier)      last day (3296 days later) »