« first day (3145 days earlier)      last day (1786 days later) » 

5:57 AM
Hello
 
6:19 AM
good morning
 
@KarelG good morning
 
6:40 AM
@david Yes, it was also used for that reason as well.
But most would just add a semicolon before their IIFE in case it gets concated with another that doesn't have a semicolon
 
6:51 AM
Why if I do this work:
async create(@requestBody() project: Project): Promise<Project> {
    let projectToCreate = new Project(project);
    if (!this.projectService.hasPermission(projectToCreate, "w")){
      throw new HttpErrors.Unauthorized('You do not have enough permissions to do this action');
    }

    project = await this.projectRepository.create(projectToCreate);

    return pick(project, [
      'id',
      'projectNumber',
      'name',
      'startDate',
      'endDate',
    ]);
  }
But if I substitute the return by a method
    return this.projectService.hideRoles(project);
This method:
hideRoles(project: Project): Promise<Project> {
        let projectWithoutRoles = pick(project, [
            'id',
            'projectNumber',
            'name',
            'startDate',
            'endDate',
          ]);
        return projectWithoutRoles;
    }
I get an error on the method return, because it has not all the parameters of Project
Maybe this is a good solution?:
hideRoles(project: Project): any {
        let projectWithoutRoles = pick(project, [
            'id',
            'projectNumber',
            'name',
            'startDate',
            'endDate',
          ]);
        return projectWithoutRoles;
    }
 
@QuicoLlinaresLlorens First off: this one is wrong because it doesn't return a Promise.
@QuicoLlinaresLlorens any is almost never a good solution. It is a solution, but it's rarely a good one.
 
7:21 AM
I get this error:
Type 'Pick<Project, "id" | "projectNumber" | "name" | "startDate" | "endDate">' is missing the following properties from type 'Project': getId, getIdObject, toJSON, toObject
 
7:34 AM
@QuicoLlinaresLlorens You say you return Project, but you return an object derived from Project with less properties.
@QuicoLlinaresLlorens I'm way more surprised that this one works.
 
I just added the missing things and works
 
 
1 hour later…
8:58 AM
How can I do a type Promise<Object | null> to be of type Object?
 
I cant say i am 100% whats going on here jsfiddle.net/9ktcd318
 
@objectiveME technically nothing
as it isn't being called
 
Whats the point of having a function inside another function, whats is this called, is there a term for it
 
@objectiveME that's semi normal
I think there's a term for it, but now it doesn't come to mind
 
Okay cool
 
9:05 AM
there's a trick where if you define a function within an anonymous function, everything declared in the anonymous function is unrecoverable by whoever uses it
but the inner function can see it, so it sort of acts like private member section
though that doesn't seem to be the reason for the inner function in this case
 
Cool. And then there is this javascript.info/call-apply-decorators
 
@objectiveME The inner function is only visible within the enclosing function.
Just like variables defined within functions, they are not accessible from the outside.
 
@objectiveME cachingDecorator is a good example of what I was referring to
cache gets hidden that way
 
Thanks so much guys
 
the term I was looking for wasn't decorator though
 
9:09 AM
How can I parse from Promise<Type | null> to Type?
 
Does the await/async work on the browser or is it only restricted to node
Ok
 
@objectiveME node only, unless there is some sort of experimental feature that I'm not aware of
 
@Neil wait, so async/await shall only work on node and not on browser?
 
@objectiveME admittedly, when I type await function() { } in the console, it doesn't complain
I'm not very current with latest features though :)
Probably not the best person to ask
 
you can use async/await in browsers
 
9:13 AM
@KarelG When did they add this?
 
2 years ago?
 
well that's nice
 
@Neil Thanks so much. Towards the end of this callbackhell.com
Lies some info i thought shed somelight on where we are
 
Down with callback hell!
 
haha
 
9:16 AM
Promises were enough to get rid of callback hell
but I'm glad they also added await/async
That seemed like a natural addition
 
Yes indeed
 
Interesting, discovered a "feature" by accident
made a typo I just recognized, but the script ran without issues.
 
kareIg which one?
 
function foo(a,b,) { // notice the , at the end
  // do something with a and be
}
that works perfectly.
!!> function foo(a,b,) { return has ${a} and ${b};}; foo(1, 2);
 
thats not something to celebrate haha
 
9:22 AM
@KarelG "has 1 and 2"
 
just a grammar thing. but oh come'on ...
 
hahaha, people gave up on javascript eons ago precisely for bending all rules even when its completely and 100% unnecessary
 
hence why I'm a firm believer that the compiler should be strict and uncompromising
 
I second you on that @Neil
 
it's actually a good thing in the long run
too late for javascript
but there is still hope for typescript
 
9:31 AM
hello
 
9:44 AM
@Neil good for large projects. But for legacy code , it is best that the compiler is not strict :P
I occasionally even see remnants of javascript code from before 2005 (in CRM)
le old ActiveXObject ^^
or cmd calls. that will be a tough refactor
 
10:00 AM
@KarelG beh, would there be any harm in attempting to use a strict compiler (and if anything, resorting to the non-strict compiler should everything go to hell)?
 
that is the same problem as in other languages (mainly C / C++)
eg in C, there are unsafe functions and the buffer memory is executable.
(among other issues)
eg in the latter; a lot vulnerabilities can be prevented if the buffer memory is marked as non-executable but that does not happen because there are a lot applications that relies on it. (yes, I am serious. That is from my security professor. He knows some still-in-use programs that relies on it).
 
seems like an incredibly bad idea
 
 
1 hour later…
11:09 AM
Hi guys. Hitting CORS issue while logging in from myapp.com, because I have www.myapp.com hardcoded into the login form. Any tip on how to go about this without using the cors() npm package?
 
12:01 PM
how to consume wcf in node js ?
 
@EdmondTamas lookup how CORS work. It is a simple rule set.
why is that url hardcode btw?
 
12:26 PM
@KarelG the frontend gets compiled when pushed to Azure (CI/CD). And while having two servers (prod/dev) at build time I compute the URL based on the branch the changes were pushed to. And because its front-end code I can't use localhost (or maybe I'm wrong) so I use constant HOST that is concatenated with the path (/login)
@KarelG or should I use window.location to set the domain? Hmmm
* to set the origin
 
why not use relative paths?
 
can someone help me, I want to use the biggest font size possible so all my content is visible, does anyone know how I can do it?
the container would be changing size btw
 
12:41 PM
Jeezz, I must be reeaallyy tired, yea @rlemon it works absolutely fine using relative path! Thanks guys, its so good to have a discussion sometimes :)
 
@JacobSchneider so you want to increase font size until the container overflows?
 
interesting. is it a title? or wrapped text? or what?
 
that is hard to figure out for me. I think that rlemon can solve it tho
 
what's the use case
if it's just a generic usecase. no thanks. if it's like trying to have the largest title on say.. user submitted images.
 
12:47 PM
maybe I would look at the dimension of the said element and will keep increasing the font-size until it hits the container boundaries
 
that is doable.
 
okay, so I've got a screen that's displaying messages, and these messages change, and because it's a notice board, it's needs to be legible from afar, so I need to max the font size
 
I think you just need to figure out a reasonable font size ratio and min/max and just use those
fontSize = Math.min(Math.max(min, fontRatio * image.width), max)
or something
it's still too early for maths
 
1:13 PM
@rlemon what time zone are you in?
 
the one that makes it morning
 
doesn't Canada have like six XD
all of them are in the morning
* off topic question * rlemon do you like piano music?
 
I like all music genres
 
If you were in a lounge what songs would you want to hear on the piano?
(I have to put together a playlist)
 
@rlemon that conflicts with the internet etiquette D:
 
1:23 PM
@KarelG there is no etiquette on the internet. not since may 2nd 1999
 
is that date arbitrary or not? what's the event?
 
ohh completely arbitrary
 
1:53 PM
@KarelG We don't talk about the Great Alpaca Incident of 1999.
And you should not ask.
 
remids me of rimworld
Man eating alpacas, the horrors!
 
@paul23 Pfft, those aren't the horrors of RimWorld
The horrors of RimWorld is eating husky puppies and wearing human leather cowboy hats.
 
Ok squirrels, those are even worse.
 
I loved some events in Rimworld
like a man using a body to learn to become a good doctor. Then once he got sufficient skills, he resurrected the body to re-examine it
 
I had a badass @Mosho holding an excellent plasteel knife riding on a grizzly bear into battle.
On one of my previous saves :D
 
1:59 PM
I used literary over 1000 boars as my "army" - game had like 1 frame every 10 seconds but those boars repopulated faster than the enemy could kill them.
 
the only animals I use are boomrats and boomalopes
 
> boomalopes
 
keep taming them every chance you can, then set the animal area surrounding the poison ship, then shoot one
 
god those monsters
 
easy peasy
works well for ships and sieges
protip
 
2:05 PM
Well I couldn't keep my boars near my base anymore - they'd directly starve to death due to all grass being eaten.
I discovered nuclear fallout is good for one thing: it spawned new grass on otherwise desert regions.
 
@rlemon You can milk boomalopes for chemfuel too, they're fairly useful
But I'll admit that keeping them around always makes me nervous XD
I got a raid a few days ago and completely by chance had someone manning the one mortar I stole from a siege. So while I was preparing my troops, one shot, 20 kills, within like 5 seconds of them entering the map
 
eh. I don't use many generators past like early game
solar / water is the way to go
then geo mixed in
 
@rlemon Chemfuel is useful for a bunch of other stuff, namely, mortars and transport pods
 
don't use mortars either.
transport pods, fine. but there are many ways to process chemfuel
 
@rlemon Yeah, I usually overproduce food by a very large margin (for easy money), so I use that for chemfuel.
 
2:12 PM
my money game is usually drugs. the return rate of yayo is outstanding
 
Mortars are my go-to way to dealing with poison/psychic ships easily. When it gets to 50% the mechanoids assault my base and crash on my defences without my colonist having to fire a single weapon shot
Once all of the mechanoids are down, I just send someone out to punch the ship to pieces
 
yea, see my goto is usually just setting up a few barricades, sending in the 'bombs' (IEDs or boom*s)
 
The only case where you're really fucked with my scenario is if the ship lands smack in the middle of my base, past my defences
But the storytellers have not been that cruel to me just yet.
 
I can't remember when they changed it, but building on the tile next to a ship can trigger it now. used to be able to setup 2-3 layers thick of IEDs then a wall then burn them alive
 
@rlemon Yes. I learned that one the hard way.
 
2:15 PM
@MadaraUchiha the BEST scenario I've ever had was a ship landing on my bridge over deep water. destroying the bridge, and the ship all in one fell swoop
 
But you can still do 3 layers just one tile away
 
free goodies
 
It's still well within the blast radius.
@rlemon Wait, if the ship somehow drops into deep water it despawns?
 
blows up
 
And the mechanoids?
 
2:16 PM
have only had it happen once. so I'm hoping it wasn't a fluke
the mechanoids die with it.
 
That's amazing lol
 
you don't get any of their loot. just the loot you get when you destroy the ship
but I normally play on large rivers because of power gen and the ease of being able to set up blockades
 
@rlemon I used to do that, nowadays I do deserts and boreal forests for the challenge, might try the sea ice challenge at some point.
 
I up difficulty now. Or give my guys crappy loadouts
Like forced traits, everyone is ugly
 
@rlemon I'm already at merciless
 
2:20 PM
Or everyone I get will have a drug addiction
Fuck with the starting settings
 
@rlemon I saw an interesting one that I might try, the "no sun" scenario (always Eclipse, world temp down two notches)
 
I wanna do a toxic run soon
 
@rlemon Toxic is just annoying frankly
 
I've also had a lot of fun with the Android mod. 1 colonist. Disable random joins. Only use mechs you make
 
You just rush hydroponics and roof everything (or run into a mountain)
 
2:22 PM
@MadaraUchiha mid game it is annoying. From day 1, might be a challenge to get food and shit setup
 
@rlemon Does toxic fallout kill plants?
It does
Then yeah, either sun lamps or mods like glass ceiling or whatever
Might be an interesting challenge.
 
posted on May 27, 2019 by CommitStrip

 
3:02 PM
it is easy to delete a kubernetes cluster it seems
I loved how they planned their migration.
 
3:38 PM
If I run code after a setTimeout and that setTimeout is of 5 seconds, will the code after the setTimeout run before the setTimeout?
TLDR; is setTimeout async
 
yes
setTimeout( fn, delay ); // this is run immediately.
but fn isn't executed until after the delay
 
Then I can't understand why they aren't both being removed here.
Seems both cards are removed on the second go, I think its my assignment to lastClicked that's dodgy.
 
user1596138
4:19 PM
New name who dis
 
user1596138
@AshSmith Closure
 
user1596138
lastClicked is updated before the setTImeout function runs to remove it
 
user1596138
From what I see anyway.
 
user1596138
So you miss one
 
user1596138
 
user1596138
4:27 PM
There are plenty of ways to go about it but that shows a method of sort of queuing the cards to delete
 
user1596138
Then deleting everything in the queue before clearing it.
 
where can i find the reverse proxy information such as hostname for nginx webserver?
 
user1596138
This is the Javascript room
 
i know, just wanted to see if anyone could provide an quick answer :P
 
4:41 PM
 
 
1 hour later…
6:00 PM
How to Reload jquery datatable loaded with form submit
 
user1596138
How to ask a question
 
How to reload jquery datatable which is loaded with form submit, And fetched date related data. with click on other button I want to reload datatable with previous submitted form data.

var mainTable = $('.mainTable').DataTable();
$('#Form').submit(function(e) {
  e.preventDefault();
  var form = $(this).serialize();
    $.ajax({
        url: "result.php",
        type: "post",
        data: form
    }).done(function (data) {
    mainTable .clear().draw();
    data = JSON.parse(data);
    mainTable .rows.add(data.data).draw();
 
You want to reload the entire table when clicking one row?
 
@BenFortune yes
 
As opposed to reloading that one rows data?
Anywho, mainTable.ajax.reload(); will only work when using datatable's built in ajax source IIRC
Add your logic to a separate function and call that instead
 
6:07 PM
@BenFortune how to add separate function for that.
 
1 message moved to Trash can
@lipon Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
Have you really been pasting that same snippet into here since saturday, instead of trying to figure it out yourself?
I've lost interest
1 message moved to Trash can
 
user1596138
How to even. I can't
 
I've told you what to do, go do some research.
 
6:12 PM
@BenFortune oh no this is a different question,
 
it's really not
 
user1596138
0
Q: Reload jquery datatable loaded with form submit

liponHow to reload jquery datatable which is loaded with form submit, And fetched date related data. with click on other button I want to reload datatable with previous submitted form data. var mainTable = $('.mainTable').DataTable(); $('#Form').submit(function(e) { e.preventDefault(); var form =...

 
despite that. if you have been asking questions for half a week. you should know how to format them. barring that, you should be using a paste service like the bot suggests.
 
user1596138
I'm 100% lost on this one
 
don't fite the bot. she will win.
 
6:16 PM
@lipon Hint, you can serialize a form without submitting it
 
user1596138
Can you call .send() multiple times on a XMLHttpRequest ?
 
user1596138
I really don't know
 
@DJSpud # I mean how to resubmit form with it
 
You've already done it
 
user1596138
var form = $(this).serialize();
 
user1596138
6:18 PM
^ You serialized it.
 
user1596138
You could save form and use it again later :P
 
user1596138
@lipon Lose "resubmit", it's not a thing. You can however submit a new request using the original data, make sense?
 
user1596138
This is not even about web development at this point. Pretend you're sending a letter and you'll need to send another copy of it later.. What would you do? Save a copy. Send a new copy later.
 
8:17 PM
hey
 
user7659542
yeh
 
8:55 PM
 

« first day (3145 days earlier)      last day (1786 days later) »