« first day (2299 days earlier)      last day (2648 days later) » 

8:00 PM
stdlib--I think that's those Sails.js guys
bastards... I want that npm name
 
I don't really care what it is, I don't wanna use it now because they tried to market it to me unsolicited
 
They don't even use it for anything useful
garbage npm name squatters with their garbage code
 
damn, the name "garbage" is taken.
 
Howdy guys - could do with some tips on JS if anyone's got some time?
Ahh no wait... mind have worked it out (if not - I'll do an Arnie)
 
Only if you mods decide to do something about Joel's off topic Q on meta... /salty
 
8:07 PM
:P
@JonClements that was quick
 
glad i could help
 
@ndugger bah.... I've stayed out of that completely
 
Good man. I know other mods have as well
 
any better way to poll an endpoint other than this?
export async function poll(url, callback, settings) {
  const { timeout = 60000, interval = 2000 } = settings;

  const start = Date.now();
  let response = await makeRequest(url);

  while (!callback(response)) {
    response = await makeRequest(url);
    await sleep(interval);
    lastPoll = Date.now() - start;
    if ((Date.now() - start) > timeout) {
      throw new Error(`Timeout exceeded after ${timeout} milliseconds`);
    }
  }

  return response;
}
 
no that's perfect
 
8:11 PM
can't tell if sarcasm
 
perfect?
 
@Luggage adjective
ˈpərfikt/
1.
having all the required or desirable elements, qualities, or characteristics; as good as it is possible to be.
 
if makeRequest() never returns, it'll just hang.
the timeout is broken
if callback returns a truthy value, it's supposed to stop?
 
HAMMERTIME!
 
the fuck was I doing?
 
user2620028
8:15 PM
@Luggage car stopped, lights went off, i assumed that the car turned off
 
ah
@corvid also, it'll stop on the first timeout. Is that intended?
 
what, you have a filed named console.log(1);?
 
yes
 
... how, uhm. yeah that's odd
 
the contents are
> > 1
undefined
>
 
8:22 PM
how does that even happen
 
amazing
 
I think I was drunk nodejsing
 
process.stdin.pipe(fs.createWriteStream('console.log(1);'))?
 
@Luggage nah, is not, just trying to make it time out after n number of ms
 
well, it'll wait until makeRequest is done, then decide if it was longer than the timeout
Promise.race() if you want to know as soon as it times out.
 
8:28 PM
I deleted a bunch of files, they exist in the repo tho
how do I tell it "I know I'm up to date, but pull anyways"
$ git pull -f
Already up-to-date.
 
and a git status says you are clean?
 
you mean, pull the deleted files?
wouldn't that be a checkout?
 
no.
well, sorta. maybe
 
no git status tells me all the files that are deleted
 
if git status says you are clean, then you are. you can do a git reset --hard to overwrite all files
 
8:29 PM
@rlemon A pull doesn't do anything if you're up to date. Do you mean a checkout?
 
ah, ok.
and you want to replace them?
 
@KendallFrey I wouldn't be asking if I knew how to git better
@Luggage yes
 
git reset --hard
there is likely form of git checkout that'll work, too.
 
Just checkout branchname
 
great. I ran everything
the files are back
I hope I didn't do anything else 😃
 
8:31 PM
nah. if status says you are ok, you are.
 
@Luggage, yeah got it working fine, it just seems relatively inefficient
 
git reset --hard
HEAD is now at ...
git pull -f
Already up-to-date
git checkout master
Already on 'master'
Your branch is up-to-date with master
// files are there
😃 randomly gitting is the best gitting
 
make a genetic algorithm to determine the most efficient way of gitting
 
just learn git. :)
 
I know enough to get the basics done
 
8:33 PM
a GA is certainly easier
:P
 
That's not enough
 
I know enough to ask the right people
 
and then run all the answers
 
you know it
 
even the conflicting ones :)
 
8:34 PM
:P
fucking your repo to high hell is a good learning lesson
 
Any great ideas to voluntarily make the hostname of a client known to JS running in a website?
 
i.stack.imgur.com/ljBUZ.jpg broke my binding :(
 
I have POS-kind of thing that displays one of our web apps and I want to be able to identify the device by name. We manufacture the devices, so we already have a device naming scheme
 
    try { console.log(new ActiveXObject('WScript.Network')) }
    catch (e) { }
 
@rlemon I did that once at work. Once is enough.
 
8:36 PM
@rlemon Saw that on SO. Comments said it's shit
 
@KendallFrey I disabled networking on the production server
via ssh
 
you can't fuck a git repo in under 30 days without going into .git/ and screwing with it there
 
:D
@OliverSalzburg what comments? stackoverflow.com/a/922529/829835
 
or whatever the time period is for it to delete unreferenced objects..
or running git gc. that can delete things.
 
@rlemon Sorry, I meant the first line of the answer, not comments :P
 
8:37 PM
We had a similar application, and solved it by altering a url param on device installation. Fortunately we only needed to install a few devices
 
I didn't break git, only the code by misusing git
Except for the fact that it was hg
 
@OliverSalzburg you mentioned POS type system
does that mean you control the browser / extensions
?
 
@rlemon Yes
 
ahh, then there is a better chance
chrome has a lot of apis that are specific to them
 
Electron?
 
8:40 PM
If it was something I wouldn't have to bother the guys who handle the OS stuff, that'd be great though. Also, we would have to re-image or update all devices
 
Just a wild suggestion
 
@OliverSalzburg so you have an (electron type) app that connects to your web-service? so you can at least push client updates?
 
@rlemon It's a Windows-based device with "some build" of Chromium which just navigates to a specific URL
 
gotcha
don't think you're going to get this without having them re-image then
 
Okay, good enough to know that I'm not missing an easier option
 
8:42 PM
maybe you could get fancy with localstorage and having them self-identify
but that assumes a lot about the setup
like.. that being possible :D
 
One of the applications we run on it connected to a C# service through websocket to ws://localhost
That is pretty fun
But not available on all devices and would require just as much re-image
 
sounds fairly similar to how my application works
 
there you go. use that.
the c# part
ohh, nevermind
 
@rlemon What does it do?
 
@OliverSalzburg we have a control system that needed to be modernized. my device runs a node server which talks modbus to the control system then does some other crap but eventually acts as the ws server for the client. when they connect to the web portal I proxy the ws requests to their device.
so their control system can have a web interface
 
8:46 PM
Sexy
 
I'd MITM that
 
it's a giant house of cards. I'm surprised it has worked for as long as it has
@KendallFrey we limit what you can do from this interface. so if someone does mitm it they can't actually do any damage.
just piss off the operator
 
@KendallFrey We actually use wss. I think it's wss://something.that.maps.to.localhost.ourawesomecloudcompany.de
The realization that you can just make arbitrary connections to any port on localhost through WebSockets...
I never figured out what to do with that
Is there fun to be had with that?
 
9:04 PM
I need to prepare a short introduction to FP for work tomorrow
throw ideas at me
 
FrontPage?
MS FrontPage?
 
does anyone know of a good way to store and re-run previous functions with async/await? I want to save a function on a catch, try a back up method, then re-attempt the previous method
 
@ndugger functional programming. c'mon.
 
@BartekBanachewicz Any specific language?
JS?
 
LC
a thing that I often see done wrong, is people showing FP starting with the usecases. The best ways to start is making sure everyone understands that FP is not as useful as most languages in most cases, and going from there
is this for a bunch o' students?
 
9:16 PM
Lambda calculus is a pretty good place to start with FP
Because it's so simple
 
want to introduce haskell to your company's stack?
(then again, LC is one of the things that best shows the use of FP, it's like showing it in yer face)
 
It doesn't show any use whatsoever
 
@towc um
I actually disagree with most of the things that you've said (which probably means it's good input)
 
I'd say FP is more of a use case for LC
 
@towc Not really.
 
9:18 PM
@KendallFrey but if you google LC, you'll immediately be scared because all you'll find is how to use it in clever ways to solve problems, and that's a big leap
@BartekBanachewicz sounds like you :)
 
How familiar is your target audience with programming in general?
 
@towc Well, the biggest thing is that I actually think that FP is useful.
 
who's the presentation for?
 
my coworkers
 
It may be a good idea to start with the functional concepts they already know and build up
 
9:19 PM
@BartekBanachewicz sure, it is, but not for what people who are being introduced to it think it is
 
"soft" functional programming. map and reduce.
 
for fun, to start having them learn a functional language, to adopt funciontal-ish guidelines?
 
@KendallFrey I'm kinda trying to lay a basis for future stuff
 
If you want a bit of sensationalist, show them how concise it can be
 
@towc The last one. I'd like to show them that FP can be used right now, right away, in the code they write.
Not necessarily make them learn Haskell or Lisp and rewrite everything they have and know.
 
9:20 PM
with the base language being JS?
 
Java and C++ I suppose.
We're not exactly a web shop :)
 
@BartekBanachewicz For that, I figure you'll need to focus on the benefits of it to get them to actually use it
 
@KendallFrey yeah, that's what I was thinking
 
oh, TIL C++ has lambdas
 
user1596138
@KevinB I triple pinged him earlier pretty sure
 
9:21 PM
c++ has everything.
 
user1596138
@KevinB It might've been 4
 
except brevity
 
user1596138
@KevinB Idk it's been a few hours I forgot.
 
I don't want to show that FP is the silver bullet. I want to show that it has cases which trump other styles/paradigms, and in those cases it's perfectly fine to know and use it.
 
@Jhawins tripple ping you say
@Jhawins how interesting that you pinged kevin three times as well
@Jhawins ..
 
9:22 PM
well, pick parts (ideally by someone who's already been fired, or doesn't mind criticism, or even yours) of the code that aren't written in FP style, then slowly show them how it can be better if put in FP style
 
For me, the main thing I like about FP is the tendency to produce small, composable units, rather than only powerful abstractions.
 
how long do you want it to be?
 
6-8"
 
I suggest a series of personal attacks and public criticism.
 
@towc I was aiming at 40 minutes. I'd like to take a lot of questions.
If I finish earlier that's fine as well, is an internal thing. The worst case is that people think of me a bit less than they did when they got in there and they feel that they wasted 40 minutes.
@Luggage I'll save that for the advanced course ;)
 
9:25 PM
If you have any examples of problems that you solved by using FP, include them
 
well then, I'd say that maybe you can start by showing them something very far from FP, that they consider to be a good thing, and then turn it into FP while introducing a few concepts, over time, making sure it's a good case in which FP will make a lot more sense to use :P
 
user2620028
present while juggling
 
@BartekBanachewicz FP in JS?
Or generally?
 
tbf, when I use JS, I don't think about FP concepts, so I'm probably the wrong person to ask
@MadaraUchiha Java/C++
 
6 mins ago, by Bartek Banachewicz
Java and C++ I suppose.
 
9:26 PM
I don't know C++, but Java is hardly functional
 
you can still carry over a few concepts
 
Except for lambdas (which are a relatively thin syntax sugar around anonymous classes), Java doesn't really have any functional concepts.
 
I'm guessing modularity is a good one, as functional programming almost forces it
 
@towc Except for "try to return as much as possible", I don't think there's anything significant, although I might be wrong.
 
you're wrong
FP is a lifestyle
 
9:28 PM
@towc Have you ever programmed in Java?
It's like it actively tried to discourage you from doing anything functional.
 
if you have an amazing voice, it doesn't mean you can be a rockstar
 
he knows haskell, js, and lambdas
that's it
 
that's all one needs
also, I'm learning more now damnit :P
 
did you ever venture into Python or PHP or Ruby?
or sticking with node on the back end
 
@MadaraUchiha java is known to be used very wrongly modularity wise, so that's something
 
9:29 PM
@towc There are no modules in Java
The abstractions aren't modular, they're OO
 
@rlemon I am ok in all 3 of those. Certainly not production-ok or fluent, but I can manage my way through them
@MadaraUchiha so you don't get modularity ;)
 
@MadaraUchiha You don't need a "functional" language to write code adhering to FP principles.
 
@BartekBanachewicz Right, but Java is a bit "special" in that sense
2 mins ago, by Madara Uchiha
It's like it actively tried to discourage you from doing anything functional.
 
modularity isn't stuff like module.exports. That allows for easier modularity of some parts, but that's not all there is to it, far from it
 
I've been doing Java for a pretty long while in my previous job
There's not a lot of room for functional there
 
9:31 PM
keeping stuff in different objects, if done right, can lead to good modularity
 
@MadaraUchiha Maybe you just don't see it :P
 
making things do only what they're supposed to do, which is one of the main advantages enforced by pure FP, is modularity as well
 
Very weak typesystem, very very weak closures, no functional composition, no partial application. etc
 
@BartekBanachewicz It does help to have a language that knows when you've introduced side effects
 
@MadaraUchiha lambda calculus has no types, no closures...
 
9:32 PM
The best you can do is use lambdas often (which Java calls the "Strategy Pattern"), and return often.
 
and LC is as functional as it gets
 
@towc no closures? You're drunk af
 
@towc So go program in lambda calculus
 
what? Strategy Pattern already existed.
 
@KendallFrey closures require state, don't they?
 
9:32 PM
@MadaraUchiha no, then we'll have to hear about it for the next three months
 
also, typed lambda calculus does indeed have types
 
sure, you can implement them, but they're inherently discourages
@KendallFrey not the base one
 
@towc yes, but not mutable state
@towc by base I think you mean untyped.
 
@MadaraUchiha which will bring the benefits of FP if used correctly in appropriate places.
 
@KendallFrey well, then they're not used as closures in imperative, right? It would be kinda pointless
 
9:33 PM
@towc No, without closures in LC you can accomplish pretty much nothing
 
@KendallFrey Oh sure it does. But that's miles ahead if you're not convinced that FP has any uses whatsoever.
 
@KendallFrey that's base, base = pure, in my head
 
@BartekBanachewicz Namely, in methods like .map() and .filter(), that's about the level of FP you get in Java
Not a lot more.
 
@MadaraUchiha ever heard of Spark? :)
 
@KendallFrey but you don't call them closures... or do you?
 
9:34 PM
@BartekBanachewicz Sure I have
 
because the purpose they serve is different than a closure...
although I guess they actually act in the same way...
 
@MadaraUchiha Well then. Languages are flexible. Human minds are actually less.
 
Again, being able to pass functions anonymous classes around doesn't make it functional.
 
@towc Maybe closure is slightly the wrong term
 
Sure, I'm not saying it can't be done
 
9:35 PM
but I get what you mean, I think
 
@MadaraUchiha It's not my goal to prove that Java is a functional language.
 
I'm saying that I've tried, and the experience was not fun.
 
s/functional/useful/
 
h8r
 
I can relate. But again, I don't intend to convince anyone that Java is a perfect platform for FP logic. Heck, I'd need to convince myself of that first. I just need one or two good examples.
 
9:36 PM
again, go for modularity
 
I wouldn't go for functional abstractions in Java
Mainly because there would be the smartass that would figure a way to do it more neatly in OO abstractions, and, being Java, he'd probably be right
@BartekBanachewicz I'd go with showing the type inference and the transduction with the Java8 Stream API
someList.stream()
  .map(a -> toB(a))
  .map(b -> toC(b))
  .filter(c -> !c.isD)
  .map(filteredC -> filteredC.getName())
  .collect(Collectors.joining("\n"));
This works in Java (given a few assumptions), and it would infer the types of everything inside.
Spark is another good example
You can also showcase the older APIs that got a shiny new Lambda syntax, like Runnable
 
@KendallFrey looks like he wasn't tortured too badly :D
 
Basically any interface with only one method can be represented as a lambda as of Java 8
 
already seen it :P
 
9:41 PM
damnit
 
Guys, does Node.js garbage collector always free up objects from memeory as long as it's no longer referenced from the root object?
 
@JasonMarsh No.
 
@MadaraUchiha I'm stealing that. ;)
 
for example, it does not matter if I
aa = undefined
or
aa = null
they will be equally freed up
 
9:42 PM
not deterministically
 
@JasonMarsh Not necessarily
 
right
 
@JasonMarsh There's nothing to free there
 
a.aa = aa;
 
the previous value of aa.
 
9:42 PM
let foo = {};
const bar = foo;

foo = null;
// or even
delete foo;
 
Also null is an Object.
 
Since bar is still holding a reference, the object won't be GCed
 
ok
question about null
 
that's fine. null is not the same object.
 
@BartekBanachewicz I don't think that's true (even though typeof null is object)
 
9:43 PM
since it's an object, does that mean I am assigning new object to that variable if I do = null?
 
an object gets de-allocated once ALL references to it are gone. Eventually.
 
and it's not technically freeing up from the memory
 
@MadaraUchiha I think it's sort of a singleton.
 
or is only referenced by other non-referenced objects
 
@JasonMarsh Even if you do assign a new object, that won't prevent the old one from being collected
 
9:44 PM
@JasonMarsh The reason (in my example) the object won't be GCed is because it's still referenced in bar
 
right
 
As long as there's still a live reference to the object, it won't be GCed
 
The only exceptions to that are the new WeakMap and WeakSet structures.
 
that means even if it's aa = undefined
as long as it has reference
it's not GCed
 
9:45 PM
That's not a reference to an object
You seem to be confusing variables and objects
 
right
 
let a = {}; //an object created
let b = a; // another reference to it
a = null; // one reference removed
b = null; // all references gone, will get GCed (eventually)
 
@JasonMarsh let foo = {}; let bar = foo; Only one object was created here
And it has two references
It's references from foo and from bar
 
9:48 PM
When both references die (either because foo and bar were reassigned, or because the scope ended, or whatever), the object will get GCed (eventually, not immediately)
 
@Trasiva I love these
 
```
let a = {}; //an object created
let b = a; // another reference to it
a = null; // one reference removed
b = null; // all references gone, will get GCed (eventually)
console.log(b); // not yet GCed
// a GCed
```
right?
 
@KendallFrey I'll make sure I cc you next time too then.
 
you just console.log()ed null.
 
yeah
 
9:48 PM
Nobody would happen to have experience with DataTables would they?
 
null is still an object anyways right?
 
a and b are the same object. They are unlikely to be GCed right away, but you already threw away the reference, so as far you your code knows, they are gone.
 
@JasonMarsh Not in the ordinary sense
 
it's AN object in Javascript, but an unrelated object. It's not relevant that it's an object, here.
Why do you care about garbage collection? knowing is useful, but I am starting to smell a little XY
or is that Kendall?
 
I'm just curious
not X/Y questions at all. I don't have any issues with my code regarding to GC
 
9:52 PM
ok.
 
If it's X/Y then I'd ask questions like "I have some JSs code, what is wrong with GC here??"
 
Hi guys, i have a problem : jsfiddle.net/xbuppd1r/66 - When I type in input coup, cou, and then coup, the results are different. Does anyone know what could be the reason for this.. Or just backspace in input..
I don't know why it produces different results when I type in my entry, it's very strange.
i have try results = [];
but same
 
You have way too much inside your keyup. You are also re-adding a click handler to #next on EACH keyup
I don't think that's intended.
 
!!afk 🎸 🍺 👖 🧀
 
the problem has to do with data-index on #list
but I don't know what you intend, there.
 
10:08 PM
halp
I can't webpack
 
@tereško sup
 
don't make me !!welcome you. :)
 
> ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' /mnt/nfs/public_html/project_name/ui/js/pages in /mnt/nfs/public_html/project_name
what am I doing wrong there?
 
is that at build time or run time?
 
at the build time
what I am trying to build is something like this in the result:
 
10:12 PM
I would assume webpack knows what to do with a directory, but just in case, I would try: pages/index.js
 
/js
    /pages
        for-page-1.js
        for-page-2.js
        for-page-3.js
    main.js
 
oh.
That's not how you do that.
 
that's what I want as a result
 
all as separate files?
 
yes
the subdir is not important
hell, I dont even know what to google
 
10:15 PM
"webpack multiple entry points" and/or "webpack code-splitting"
I think you'd need to list all the files in /pages separately as an entry point
but I might be wrong.. I don't use that. I create bundles with multiple pages
 
that would be kinda annoying
it would mean that each time I add a page, I need also to alter the build config
 
well.. it's a .js file, so you can do it with code.
get all files in pages into an array, and put that as entry:
but.. i would read about code-splitting first.
also, there will be a lot of overlap in all those page-specific bundles
 
@Luggage its for pagination,
 
but a "commons chunk" can help with the overlap
 
@Luggage it is a necessary step
I am trying to bring an ancient legacy project up to date
 
10:19 PM
I see.
 
@tereško does the file it is looking for exist?
 
it's a directory
 
file(s). He's trying to take pages/* and make a bundle for each file in there.
basically you want this: github.com/webpack/webpack/tree/master/examples/… but generate the list of pages programatically
note that you need an entry point for each page. you can't out them all under "apps"
 
yeah
I guess I will have to look into node's directory-lookup modules
 
but that should be simple to make an object with [filename]: filename
I would hard-code a few, and make sure it's what you want.
 
10:24 PM
I wonder if I can do a sub-dir
 
driving home. good luck. i might be around later
 
oi
 
user2620028
ziggy ziggy ziggy
 
long time till oktoberfest
 
The best answer "almost" works for me: stackoverflow.com/a/19647381/775359
But I have some issues with scope in Angular...
 

« first day (2299 days earlier)      last day (2648 days later) »