« first day (1557 days earlier)      last day (3390 days later) » 

7:01 PM
Some advice please
 
@SecondRikudo don't pee on the electric fence
 
Save up for a rainy day
 
@rlemon Already have, the fence got electrified and died.
I have an app that needs to run periodically, with a different set of inputs each time (for simplicity, think about a scraper that takes a different page each time, and processes the data)
I'm thinking about how to execute this
 
have a second app call it
the second app runs constantly.
or use cron
 
The 3 ways I've thought of are
- Call it internally with a setTimeout/setInterval
- Set up a simple HTTP server and have another app call it periodically somehow (or maybe with cron and curl)
- Call the app directly with cron each time
Now, the first way is the easiest to implement, but it's fragile (if it crashes, bad for me)
 
7:03 PM
use node, because node is cool
 
@rlemon I am
 
and use node-cron
and make a simple node app (run with forever.js) to execute the cron
it's how I did the selection for 12 days
 
@SecondRikudo we do it with a REST API (like your second option), setInterval/setTimeout is bad - scheduling is platform specific. I think a REST API is more robust since you can then easily trigger it.
 
var job = new cronJob({
    cronTime: '59 59 23 * * *',
    onTick: forceWinner,
    start: true,
    timeZone: 'America/Toronto'
});
node-cron is SUPER easy to work with
 
@BenjaminGruenbaum In the case of a REST API, how do I save state?
 
7:05 PM
What state?
 
I'll still have to use another app that will run the setInterval
@BenjaminGruenbaum For instace, advancing the page number.
 
Yes, the only big gain here is that doing the actual scraping and manipulation is separated from the code running the index and running on cron
So you can invoke it manually, host it on a different box and so on
 
Although node-cron might be better, never worked with it. Azure just has scheduled jobs and stuff
 
@SecondRikudo Twitter stores the first/last id in the set for pagination, but I don't think that's going to work with your use case :P
 
7:07 PM
@BoltClock Hmm?
It won't work if I'm going to make the scraping bit stateless.
 
Yeah I see what you mean
Don't mind me
 
@BenjaminGruenbaum Even with a schedule job by Azure, can you have actual state and logic?
For example, I'll give a slightly more complicated case, I want to traverse pages from 1-100 periodically, after which only hit page 1-2
 
@BenjaminGruenbaum The best I can do re: canonicals would be to monitor browser implementations as closely as possible and post immediately when a feature is implemented
 
So hit 1, 2, 3, .... 98, 99, 100, 1, 2, 1, 2, 1, ...
 
@SecondRikudo Our use case is more complicated since it does more but we synchronize with a queue.
 
7:10 PM
Chrome implemented that thing way back in August and nobody noticed
 
There is a consumer that consumes the queue, and makes the REST calls to the isolated service, the periodic service just adds things to the queue and it is the only bit aware of the things like 1,2,...100, 1, 2, 1, 2 logic
@BoltClock that could work
 
@BenjaminGruenbaum Going to be annoying for me to do, but what the hell. I'm supposed to be dedicated, right?
 
That's the spirit
 
No points for guessing how many of them refer to :matches, :nth-child(an+b of sel)...
 
@BenjaminGruenbaum mocha --compilers js:6to5/register
<3 <3 <3 <3 <3
My life just became a lot better
 
7:24 PM
@BoltClock stackoverflow.com/questions/22811495/… gotta love that's closed as opinion based.
@SecondRikudo nice, I wonder if someone should write an ES6 able promise library
 
@BenjaminGruenbaum What do you mean?
Isn't bluebird already ES6-able?
 
@BenjaminGruenbaum I closed this as too localized stackoverflow.com/questions/12991369/…
 
@BenjaminGruenbaum github.com/petkaantonov/bluebird/issues/… is this true?
 
@SecondRikudo not bluebird, mocha
 
7:26 PM
native will never out perform bluebird (speed)?
 
@BenjaminGruenbaum mocha is not a promise library?
 
lol, I meant test not promise :D
 
Ah
Well, the fact that mocha supports 6to5 with the --compilers option is pretty awesome on its own
It makes sure that as long as there's a transpiler out there, mocha is future proof.
 
@rlemon the issue is converting callback APIs to promises. A native promise library can outperform bluebird but it's very unlikely it will (a concentrated effort can be made). It would require native promises to expose a promisify method too which is unlikely and to perform other optimizations for creating promises and aggregating them.
So - native promises can in theory be faster but likely won't
 
ok, that makes sense. I think.
 
7:29 PM
@rlemon let's say you want a promise version of fs.stat, native promises do not expose any API that is even close in performance to bluebird - so unless node/io relies on undocumented v8 internals and adds it themselves or v8 exposes a method that lets node do that - both very unlikely it will be slower.
Although the killer feature in bluebird is the API and debuggability, it's fast enough not to be the bottleneck in apps anyway.
Native promises will likely be fast enough for most use cases in a year though - the problem will just be creation
 
@Loktar my ecig IRC room has been talking about guns for the past hour
you should jump in
 
haha
I would so much damn work to do though :(
 
##vaperhangout
you know you wanna
prem0.com/gunporn/1022_1.jpg one guy is showing his off.
 
Is it possible to have private methods on an ES6 class?
(Other than just defining it outside the class and not exporting it)
 
ok, I need to minimize all chats and work
you guys are distracting
 
7:37 PM
@SecondRikudo no, es7, although private methods are pointless.
 
@BenjaminGruenbaum How so?
 
You can use symbols for private properties, that's a good compromise.
@SecondRikudo Just prefix it with _ - same effect.
 
@BenjaminGruenbaum Yeah, I guess that's true.
 
how does bluebird know what to "promisify" when you give it an object?
PromisifyAll seems like a bunch of VooDoo to me
 
@SecondRikudo the ES6 solution is symbols though - symbols are used for that. For example in order to mark your class as iterable you implement Symbol.iterator which has a method that returns an iterator for it.
 
7:38 PM
yo hows it going
 
@BenjaminGruenbaum How do I "implement" a symbol?
 
@rlemon promisify is called on a single method. promisifyAll iterates all properties recursively.
@SecondRikudo this[Symbol.iterator] = ...
 
@BenjaminGruenbaum In... the constructor?
 
@BenjaminGruenbaum yea but how does it know which properties to promisify? or it just does all?
 
@SecondRikudo maybe :P? I don't think there's good syntax for putting it on the prototype
@rlemon all functions
 
7:40 PM
new Foo() returns a 'foo' object with a .bar async method. if I did PromisifyAll(Foo.prototype) .bar then returns a promise?
 
@rlemon no, it does not override methods it just adds them - your foo object would gain a barAsync method which would return a promise and retain the original bar method.
 
ahh, ok, that makes more sense
 
Hi, does anybody know if it's possible to use JavaScript to play a sound from a certain speaker?
 
anything is possible
 
@icrmaxell Right... re-phrasion, does anybody know HOW to use JavaScript to play a sound from a certain speaker?
 
7:51 PM
I'm sure someone knows
 
I don't think javascript can access your speakers...
 
Yeah the best is to just edit the sound file and have it only play from that channel
 
@NickDugger HTML5 can
 
(it's late and I don't know what I'm talking about)
 
7:55 PM
@AquatheSeaWing what speakers?
@carb0nshel1 ...
 
@carb0nshel1 lol
 
Well, say you're making a game, and it'd be nice to be able to play sounds from a specific side of your computer or headphones.
Eg the left and right speakers in my MacBook Pro.
 
@AquatheSeaWing just skimmed this, not sure if it's what you need or not html5rocks.com/en/tutorials/webaudio/positional_audio
2
 
I'll take a look.
@Nick Dugger ^--
 
@AquatheSeaWing you totally can (in the link @NickDugger posted is the best way)
 
user4330208
7:56 PM
that page should be the rick roll of SO
 
@NickDugger woah there's an actual API for that :O What I had in mind was way more hacky
 
lol, I didn't know it existed either
 
yeah its been around for a year or so at minimum
maybe longer idk.
no reason for flash fallbacks for sound anymore
 
I am at awe from the power of Promise.coroutine
 
crouton
 
7:58 PM
almost no reason for flash fallbacks at all
 
It effectively lets me shed off 1-2 levels of nesting on every promise based function I have
 
@SecondRikudo did I show you the 100 LoC implementation getify did for that :D?
 
unless you care about IEsuck
 
@BenjaminGruenbaum Yeah :D
He hasn't responded yet has he?
 
7:59 PM
yeah definitely @rlemon only thing I still don't think Flash is bad for is making games honestly
 
@SecondRikudo I don't think I ever had more than two levels of nesting in promise based functions - with or without generators. Generators are cool though.
@SecondRikudo nope
 
I don't think flash is bad. I just don't see much of a need for it on the web today. the new api's cover pretty much everything
 
@Loktar it's way better than HTML+JS :P It just runs nowhere
 
I personally believe flash will always hold a place for desktop apps
 
@BenjaminGruenbaum yeah its kind of shitty actually the hate campaign against it
I mean people have no problem installing the Unity web player for games
 
8:00 PM
Could someone verify a question I have? In the following code snippet, does the `$scope.$watch()` expression result in that function being called every time `emailBody`'s content is changed?

https://gist.github.com/Vannevelj/6e20d732ce5d4510bc5a
 
@NickDugger I took a look at it but it's using OpenGL, which isn't going to work for the thing I'm making. (A Scratch Extension)
 
user4330208
steve jobs started that
 
@Loktar the hate campaign is justified, Adobe dropped the ball - flash player sucks really hard now.
 
webGL*
 
@carb0nshel1 seriously. do you only come here to shove random text into conversations?
 
8:00 PM
now sure, but in 2011/2012?
 
Steve jobs didn't "hate on flash", flash got bloated slow and got security issues.
Even in 2012
 
Oh yeah, sorry, WebGL*
 
ah yeah the security issues were a problem
 
^
 
0 days all the time.. almost forgot about those days lol. Same goes for Java too though, I don't have it installed on my machines anymore
 
8:01 PM
Java hasn't had zero days in a while
 
user4330208
@rlemon The hate campaign against flash bugs me too. I spent like years learning it, and its all due to Steve Jobs
 
I guess Flash is just used a lot. :P

I don't use Flash because I don't want to buy it, and Python suits me well.
 
that we know about :/
 
@carb0nshel1 no it isn't at all
 
8:01 PM
Used to hit 0 all the time
 
But it'd be nice to learn Flash one day.
 
Maybe that site is just not updated though
 
Because it costs money to program with Flash I can't use it, and so I can't give a good, correct-to-me opinion. :P
 
user4330208
I have proof but you still wouldn't accept it.
 
@AquatheSeaWing you can do it totally free
flashdevelop is free
 
8:03 PM
Oh, really?
 
I'd love to use a flash-like tool or better yet teach it.
 
Is it a big file to use?
 
It just goes nowhere.
 
download*
 
I guess the flash of 2015 is unity.
they render to webgl too
 
8:03 PM
most Flash devs I know/knew used that over Adobes tools
 
@carb0nshel1 this isn't "hating on flash" or "the reason flash failed" this is Apple trying to justify not supporting it
 
@BenjaminGruenbaum yeah definitely agree
although I'm not a huge fan of unity either
 
I should really learn it, never bothered to
 
user4330208
 
@rlemon I had to stop reading
Calling the kettle black eh?
 
user4330208
8:04 PM
Conversation over.
 
> Adobe’s Flash products are 100% proprietary. They are only available from Adobe, and Adobe has sole authority as to their future enhancement, pricing, etc. While Adobe’s Flash products are widely available, this does not mean they are open, since they are controlled entirely by Adobe and available only from Adobe. By almost any definition, Flash is a closed system.
^ really Apple... really?
haha anyway I'm glad Flash died to an extent, people always expected front end devs to know Flash as well.. and it always sucked getting a relatively large unmaintained steaming pile of action script dumped on you to maintain lol
 
how is that any different than XYZ-Specific-technology today?
 
I didnt enjoy the toolset
 
Adobe makes things that they expect to run everywhere, Apple doesn't
 
> Must know Angular
> Must know Unity
> Must know Three!
 
8:07 PM
for example, jQuery 'apps'... :shudder:
 
@rlemon nah
dude you will not find any corporation (not in the game world) using Unity for applications lol
or three.js at that
 
that was just an example
 
It would be nice to have objects in js with flash positioning, _x _y and _rotation etc
 
don't read too far into the techs I listed
 
However you will find some companies using some pos Flash application tied into a access db backend lol
I hope not too often anymore.. shudders
 
8:08 PM
ofc, those are the same companies that use "ie7 because of security reasons"
 
Can confirm, FlashDevelop is awesome
For programming, anyway
Nothing beats Flash Professional for drawing
 
yeah for sure. Adobe introduced Flashbuilder too which wasn't too bad either (for code)
in my experience (in the training world where flash is used ALOT) rarely anyone used .as files organized neatly. I remember dealing with really large fla's and AS tied to objects
god man it sucked.
 
is there no standard try catch in javascript?!
 
@Bubbas sure there is...?
 
8:11 PM
@Bubbas What do you mean by "standard"
 
yes and on that same site i see
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Lol wait im retarded.
 
@Bubbas try catch is standard...
 
thats for conditional try catches
 
@Bubbas Sadly, yes
 
8:12 PM
e if e instanceof ...? Wow, that is pretty weird
 
Yeah, conditional try won't make it, ES7 will introduce pattern matching in try/catch
@BoltClock fact of the day: C# is introducing it in C#6
 
MLM
Reminds me of Python ternary syntax a if test else b
 
@BenjaminGruenbaum How is that different from catch (TypeName ex)?
 
@BoltClock TypeName is a type name and a if can contain arbitrary checks?
 
How does everyone feel about stickers on a laptop? tacky?
 
8:14 PM
@BenjaminGruenbaum Oh
 
@Luggage depends on the sticker
 
@BenjaminGruenbaum is ES7 getting pattern matching anywhere else?
 
I'd show you but codeplex is down.
 
@Luggage yes
 
@ssube yes, it's a very early proposal though.
 
8:14 PM
git, node, etc. I want some smallish ones
 
user1596138
@Luggage Do whatever you want? lol
 
I will do whatever I want. Just curious
 
You people should all follow esdiscuss, it's like 3 emails a day perfect for a toilet break or a bus ride.
 
only hipsters put stickers on their laptops
 
@Luggage you're a professional, not a skateboarder.
 
8:15 PM
@Luggage Don't forget the Apple sticker
 
user1596138
If anybody looks down on you for your laptop stickers you take there lunch money
 
@NickDugger you would know
 
I happen to have 0 stickers, anywhere
 
you had no stickers before they were cool?
 
same. and i can't imagine ordering one. too much work. If I HAPPENt ohave a git sticker or simlar layougn around I would do it
 
8:15 PM
All my Stack Overflow stickers are still unused :V
 
I don't think having no stickers is cool, seeing as all the cool kids do have stickers
 
user1596138
Ugh I'm waiting to buy my laptop still
 
I don't have stickers (that is a lie, I have the Ubuntu and i7 sticker, but they are small and on the inside)
 
user1596138
At least you have something to put stickers on
 
My laptops (yes, I have 2) are absolute garbage, but they run what I need.
Just not any games
 
8:17 PM
the ubuntu sticker you put on or it came on?
 
@Luggage put on, it came with the i7 sticker
but it is a linux laptop with Ubuntu on it, so I put that sticker on under the i7 one
 
sup bizzles!
 
@BoltClock send me some, I only got pens and shirts
 
I was supposed to get a shirt, two years ago, it never showed up
 
my laptop that's more usable than my older one has an i3... I can code on it, but even then, it's a bit slow.
 
8:18 PM
they said they would send another, never got it either
 
I almost asked @BoltClock to email me a sticker
 
@Luggage I had stickers on my old laptop - there are stickers I'd put if I had them but more than 2-3 is too many.
 
 
he can email the design and you can have it printed
 
@taco You wouldn't download a car
 
8:19 PM
does that count?
 
yea 1-3 in the corner. not plasterd all over
 
 
@BoltClock I would
 
I have that sticker on my laptop
 
@NickDugger fairly certain my tablet has an i3 in it, and it actually works for most code (wouldn't do C++, but some Java/JS stuff, sure)
slap it in the dock and attach a mechanical keyboard and it's usable
 
8:21 PM
I can't use anything less than 17" screen
 
@dystroy still has to send me SO stickers
 
@BoltClock I'd download a car
 
shipping would be like $3 for him
 
@rlemon oh wow
 
@dystroy works for SO?
 
Wait it wasn't actually printed
 
no, but he has >100k rep
 
the body was @BenjaminGruenbaum localmotors.com/3d-printed-car
 
@BoltClock That was such a fragile message. If someone answers yes to any of the early questions, you're just encouraging further crime.
 
ah @FlorianMargaine wow
 
8:24 PM
he has 155k, actually
 
Woah
that's a lot :D
 
It was probably intentional by the CIA to reinforce the criminal culture they created in unfortunate parts of the country.
 
Is the entire car 3D printed?
Everything on the car that could be integrated into a single material piece has been printed. This includes the chassis/frame, exterior body, and some interior features. The mechanical components of the vehicle, like battery, motors, wiring, and suspension, are sourced from Renault’s Twizy, an electric powered city car.
 
Damn, I spend all of my free time playing Destiny, not on SO
 
aw, I forgot to post a conspiracy theory on facebook yesterday. Dammit not working on monday.
 
8:25 PM
OK I really should head off. tis late
 
Cya @BoltClock
 
Does anybody know if @HatterisMad left the US yet?
Btw, we're hiring if anybody is looking. Work out of UK, San Antonio or Atlanta
 
no love for the canuks?
 
Lol, there are 14 users with higher rep than me in Israel.
 
@SecondRikudo being one of them?
 
8:27 PM
@rlemon or the almost-canuks
 
Who's "we"?
 
@FlorianMargaine I probably don't count
Because my location isn't set to Israel
 
Woah me and @SecondRikudo are only 8k rep apart. I should really give more bounties.
 
give them all to me
 
in case anyone is interested in what a lisp-to-js language looks like github.com/Ralt/lispkit/blob/link-hints/scripts/link-hints.ps
 
8:31 PM
ew
I can't even read what's going on. It looks entirely esoteric; lisp, I mean.
 
Would you say that it's OK to violently override internal object parameters in a test for mocking purposes?
 
@NickDugger I mean, that's sort of to be expected of a language you don't know, right?
 
For instance, I have this ApiClient object instance, and I want to override api.request to a mock
 
Eh, I can read java and c++ and at least understand the basics. with lisp, I'm just lost in a sea of parens
 
8:36 PM
@NickDugger Well, yeah, because they're both C-style languages.
 
touche'
 
Hi guys, sorry for the noob question. What's the meaning of this syntax var namespace = namespace || {};, it assigns the variable to what it already is or an empty object if not declared right? or at least the term to search for
 
@Underscore 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.
 
With angular-ui router can you redirect to a state instead of the url in code. Normally I'd use $location.path() but I can't figure out from their docs if you can do that.
 
@Underscore it's just (interesting) short-circuiting because of the logical operators
 
8:38 PM
@Underscore If namespace is truthy, it will stay as it is
 
do we have a reliable way to detect chrome?
 
@Underscore it's used for "default values"
 
If it's not (for instance, if it's undefined) it will be set to an empty object.
 
@FlorianMargaine I told you I'll give them to you when you come eat again in Lyon
 
For example:
 
8:39 PM
Assuming you only put objects in it - it will assign to it an object if an object was not assigned to it already
 
@dystroy told you I'm not coming soon :P
 
@ssube thanks all, that clears that up
 
function defaults(a, b) {
   a = a || 5;
   b = b || 10;
   console.log(a,b);
}

console.log(defaults()); // 5, 10
console.log(defaults(6)); //6, 10
 
defaults(0, 0) // :P
 
Yeah, not the best example in the world XD
 
8:40 PM
Using default arguments with || should never be done for primitives
Also, ES6 has better syntax for that :D
 
WFYT @BenjaminGruenbaum on my question above? ^
 
function defaults(a = 5, b = 10) {}
 
@SecondRikudo so it's similar to C# null coalescing SomeObject a = getInt() ?? 5;
 
function defaults(a = 5, b = 10) {
   console.log(a,b);
}
@Underscore yes, ?? in C# is similar to it.
 
@Underscore @BenjaminGruenbaum is the C# guy
 
8:41 PM
thank you all very much
 
@BenjaminGruenbaum puking_rainbows.gif
 
@Underscore in JS || returns the value that was truthy, not a boolean - that's the trick here. Same for &&
 
@Underscore If you're wondering why that's done, consider these two functions:
function f1 (namespace) {
    namespace = namespace || {};
    if(namespace.foo) {
        alert("foo");
    }
}

function f2 (namespace) {
    if(namespace.foo) {
        alert("foo");
    }
}
 
user4330208
so would jsfuck.com be a good way to "encrypt" a website
 
If you execute f1() (and don't provide a "namespace"), then, as you'd expect, nothing happens.
 
8:42 PM
@carb0nshel1 No.
 
user4330208
:(
 
@SecondRikudo don't feed the troll
 
@Retsam assigning to namespace won't do much for you, that's why the convention is pass exports and assign to exports.namespace
 
But if you execute f2() (again, without a namespace), you'll get: TypeError: Cannot read property 'foo' of undefined.
 
so it's a way of avoiding the equivalent of a null reference exception
well
 
8:43 PM
^*3 likely the desired outcome, silent errors are never good
 
not direct equivalent
 
@Underscore sure there is, you just saw it:
 
@BenjaminGruenbaum It's a fine outcome if you want an optional parameter.
 
!!> var x = null; x.y.z = 15;
 
@BenjaminGruenbaum "ReferenceError: bull is not defined"
@BenjaminGruenbaum "TypeError: x is null"
 
8:44 PM
^ a null pointer exception in JS
 
@Underscore Before moduling frameworks came to be, you'd use that to put method on the global object in case your namespace weren't set
window.myApp = window.myApp || {}
Then you can safely put methods on window.myApp because you know it's always there.
 
@BenjaminGruenbaum it's not a real null reference exception unless it causes the OS to hang for a few seconds :p
 
@Underscore segfaults crash pretty quick
 
Like I mentioned, this is bad practice today, you have requirejs and commonjs (browserify) to handle moduling and dependencies.
 
What does moduling, dependencies, exports have to do with what he asked?
 
8:46 PM
@Underscore in NodeJS it'll likely crash a server in a handler (unless you're using a construct like promises that is throw safe.)
 
@Retsam the namespace part, specifically. You don't manually define namespaces anymore.
 
I use namespaces sometimes when I can't justify a tool like require or don't want to use it
 
short-circuiting and how JS (and a few other langs) return the first truthy argument is another thing
 
@Retsam In "the dark days", we'd put an object on window to coordinate function defining and calling between different scripts
 
To ensure that the object always exists, regardless of who you'd call first
window.obj = window.obj || {} was a common pattern.
 
user1596138
> looking for someone who is interested in working on marketing applications (possibly some game development as well!)
 
user1596138
Position: PHP developed
 
@Jhawins Format that a little nicer and I'll pin it
 
Sure; but that doesn't mean that's what he's using it for here. I use obj || {} quite a bit. It just seems like an unnecessary diversion to start talking about one historical usage of the pattern
 
8:48 PM
I think he's joking @SecondRikudo
 
user1596138
I'm mobile
 
user1596138
And it was a joke yes
 
@Jhawins you're not mobile, you're @Jhawins - don't be silly.
 
My humor detectors are broken after this long a day.
@BenjaminGruenbaum Maaaaaaaaaaayyyn!!!! This ain't my dad! This is a cellphone!
 
user1596138
> echo jhawins.mobile
// true - in a way you're right
 
user1596138
8:49 PM
Mixing bash and js lol or some shit
 
@Jhawins that's called groovy, and don't bother with it.
 
user1596138
@loktar buy my laptop for me and ship it to me
 
lol
 
user1596138
Lmao
 
8:54 PM
I'm sexy and I know it
 
ninjad
 
such a good album
especially the videos documenting a zombie apocalypse with bass
most apocalypses are missing a healthy amount of bass and liquor :(
 
@SecondRikudo :)
 
any reason orderBy not working at all in angular? Im doing ng-repeat, and i clearly see the values not being sorted. Looks like ng-repeat="event in events | orderBy:'attend' "
 
@rodling plnkr.co or jsfiddle.net make a small reproducible example
 
@BenjaminGruenbaum I hate doing that. Every time I do that, I solve my problem and don't get the satisfaction of someone solving it for me.
 

« first day (1557 days earlier)      last day (3390 days later) »