« first day (3904 days earlier)      last day (1256 days later) » 

5:18 AM
Good morning
@Botler Should optionally add the filter before the .ToList as to not get all assets form the database when you only want one
First build the query: var query = databaseContext.Assets.Include(asset => asset.Alerts);
Then if(id) query = query.Where(id);
Then await query.ToListAsync
5:42 AM
Also if it goes via the network, why even bother making the list readonly?
 
2 hours later…
7:14 AM
[Squirrel in Training] kilerino @Botler no workie u need to type out nick that workie
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
But then it won't link to that specific message
And technically I don't ping Botler but like, :52483613
[Squirrel in Training] mkay welp in that case might i suggest ot add the @NICKNAME?
[Squirrel in Training] u lazy cmf
In that case might i suggest you stop spalting and get in here for real :P
[Squirrel in Training] I am splitting for the better good!
[Squirrel in Training] Roel hasn't written in like 4 weeks and here I am pining him asking him sth and all of a suddon sama seinpai is back amongst the living 😄
[Squirrel in Training] Maybe if we ping avni it works 2
8:07 AM
[Captain Obvious] @SquirrelKiller you're the one who's meant to be migrating here away from the evil ban happy stack overlords
Hey the last ban was on my behalf :P
8:32 AM
[Squirrel in Training] just timeout not ban
8:44 AM
suspension
Btw haven't heard anything from jdoe lately
Whats the thing again
||bantimer
Invalid command! Did you mean: ballmer, timer, bender? Try help for a list of available commands..‍.‍.‍.‍.‍.‍.‍.‍
||howlong
Invalid command! Did you mean: how_old, wrong, nothing? Try help for a list of available commands..‍.‍.‍
Invalid command! Did you mean: die, adoc, joke? Try help for a list of available commands..‍.‍.‍.‍
8:45 AM
I...did not mean die, no
lukl
Jack, JDoe
:<
Let him boot first lol
[Squirrel in Training] that'll take 'till the heatdeath of the universe
Damn
Jack, jdoe
He ded
||jdoetimer
Invalid command! Did you mean: timer, define, time? Try help for a list of available commands..‍.‍.‍
8:50 AM
Damnit james
||help
Command documentation and syntax can be found here.
Hi
How to download a file
I tried using href it just takes me to that path
I want to download D:/test.xlsx using html/javascript
The file needs to be provided by the web server
You can't just href to the D
if I keep in the same project, then it will work?
Put the file into wwwroot, then href to the file
8:52 AM
there is no wwwroot
using angular
Start from the root of where the site is hosted then
In your angular app you can make a folder /resources or something, deploy that into the folder with the rest of the app, then href resources/yourfile.png
Puzzle time!
Given 4 numbers: 1, 3, 4 and 6.
Each number can only be used once.
Use as many as you want the following operators and parenthesis to obtain the largest possible number.

The operators: *, /, +, and -
The parentheses: ( and )
it just tries to open it in new path
nothing happens
[Squirrel in Training] My ituition claimes 1+3 * 4 * 6
[Squirrel in Training] But then (6+1) * 4 * 3 would be more
[Squirrel in Training] So i need to think more than 1 minute which is already to much for my brains
[Squirrel in Training] so I'm out 👋
9:11 AM
Hey guys I have a quick question. Is sqlLite much different from using mssql?

I'm replicating a project from a book. The book uses mssql, but I can't seem to get it working. SQLite offers similar features while allowing me to commit the database into the repo. Are the two much different? Does is there a C# SQLite library with transactions (rollback if transaction not completed)?
[Squirrel in Training] IIRC The main difference is inthe max DB size which I think is limited to 10GB in SQL LIte
[Squirrel in Training] But don't pin me down onthis
@LetMeBeYourLostDisciple If you put the 1 and 3 really close you get an 8. Multiply this by 3*4. 8*3*4
[Squirrel in Training] Also EF uses transactions under the hood
[Squirrel in Training] Entity Framework
[Squirrel in Training] YOu can do sth like context.Database.BeginTransaction if you relly need but usually one doesn't
9:17 AM
Just use LocalDB, gives you mssql syntax and you can commit it
@Squirrelkiller Thanks, I thought so.
[Squirrel in Training] Pfft why does botler always get the credit >;<'
@Botler Okay, Botler thank you removed.
Because Botler does all the hard work, obviously
9:39 AM
[Captain Obvious] And then botler gets all the emails about people replying to him
[Captain Obvious] All hail inbox rules
10:20 AM
I think the max is 84.
@Botler How to create this kind of hyperlink automatically?
Hm I get to 96
Again, most uniform/even gets you the most bang for the buck, so use the 1 to make the three a four and multiply the rest
I know (1+3)*4*6
@Squirrelkiller: You are genius!!!!!!!!
Making the thing most uniform will always get the biggest result for a given input
This way there's usually an "intuitive" way of maxing something out
10:24 AM
Now the problem is, how to create a program to solve this kind of problem?
Depends on how precisely you can describe the general problem
"combine 4 numbers using +,-,*,/ and ( ) only"?
(in a way to get the highest result)
"Combine these X numbers using operators Z only to get the highest result"?
I think a computer would have to compute all the possibilities
Let A is a set of the first N natural numbers. B is a subset of A.
Use as many operators or parentheses as you want to create the greatest number obtained from using at most once for each element of B.
Since B seems to be totally random, I actually have to think on this one first, 1/product(n1...nj) may not work here.
Can we solve this problem using notation likes +-*/ 1 3 4 6
I am not sure
*** 1 3 4 6 = 1*3*4 * 6 for example
*-/ 3 4 1 6 = ((3/4)-1) * 6 another example
this notation seems to be promising.
10:40 AM
It's called prefix-notation is needs ( ) too
+(1,6) == 1+6
1+6 is infix, (1,6)+ is postfix
Ignore the parentheses to easily do permutations.
spaces are enough
Hi all
10:56 AM
@LetMeBeYourLostDisciple depends on how well you want it to work
are you using only integers or also reals?
are you using negative/neutral numbers as well?
of course integers only
is your operator set limited?
natural numbers as i said above
+*-/
> the first N natural numbers
no power, sin, cos, tan, exp log, etc
10:57 AM
Positive integers
so you wont expand it?
then it is simple
for every 1 in your input, pick the lowest number to sum with
There an be only one 1
10:59 AM
then, get the product of all numbers
oh, input numbers are unique?
then super easy
a subset of the first n natural nubmers
In case you didn't see it:
31 mins ago, by Let Me Be Your Lost Disciple
Let A is a set of the first N natural numbers. B is a subset of A.
Use as many operators or parentheses as you want to create the greatest number obtained from using at most once for each element of B.
11:01 AM
sort all numbers
if the sorted set starts with 1, then sum it with the 2nd number
then multiply all the numbers
I hit Abort during a git rebase in Visual Studio. It looks like the changes from another dev and mine are now included in my local code.
division and subtraction can be ruled out since you use only positive integers
Should I do another rebase or a merge?
When you git rebase --abort, all changes from the rebase are undone
multiplication gives you the highest result for inputs where both are >1
11:02 AM
You should be back to your original state
Oh, okay
(when both are 2, it ties with summing)
so, you only use the sum if either input is 1
Of course if your branch is saved on the server, you can just reset it if you wanna make sure
and you sum it with the lowest number because it has the greatest effect
so
No, there are commits on my pc that aren't on remote
11:03 AM
@Wietlol: I will analyze it mathematically.
numbers
    .sorted()
    .reduce { l, r -> if (l == 1) l + r else l * r }
or in pleblang
numbers
    .OrderBy(it => it)
    .Aggregate((l, r) => l == 1 ? l + r : l * r)
11:27 AM
@Wietlol: Your conjecture seems to be wrong, consider 2,3,4
The sum of the first two is 5, mutliplied it with 4 produces 20. The max is 24.
2 != 1 though
12:00 PM
^
the algorithm becomes more difficult once you have non-unique input
but again, that is out of scope
only the first number can be 1
which results in a plus operator with the next number
if it is more than 1, you just have full products
(1 + 2) * 3 * 4
2 * 3 * 4
these are the only 2 cases you want to care about
single number input is just that one number
for empty input, there is probably something wrong
@Wietlol: You should get a field medal.
You too though. Handling an internet chatroom while teaching is next level schooling.
12:17 PM
@LetMeBeYourLostDisciple I should get a break :)
Thank you all. I am learning java. My next mission is developing android application with opencv. Flutter has not mature opencv binding yet. :-)
 
3 hours later…
2:49 PM
Any recommendation on how to secure web APIs? I've heard of many things; token-authentication, JWT..etc
any good reference or article is very appreciated
3:01 PM
No idea lol. We're using JWTs, works quite well, but I heard we're doing it wrong. My personal project just uses a guid as login token, probably not very secure but it works.
I still have to make those guids expire at some point...
How GUID can secure the API?
I mean how the API accept/rejects calls based on a GUID?
@mshwf One of the simplest ways depending on how much control you have on the HTTP client portion, could be to use a simple GUID in the request header providing a header name of x-api-key, then in your web API examine the request and either accept or decline. If using Asp.Net for the WebAPI a piece of middleware could be easily coded and then added to the pipeline. The WebAPI would need knowledge of the same GUID which could be stored in a configuration file or environment variable.
3:40 PM
Sorry, I'm not familiar with the concept. If a not-authenticated user sent a request with x-api-key of a random GUID, how do I know he is not authenticated?
When a user logs into my application, it generates a new guid and stores it in the database. When a request comes in, the db is checked for the guid.
I know, not very scalable at some point.
Should it ever get used for real, I'd probably code an expiry date into the token
Then use a db-stored token as refresh token
Not sure how that interaction works yet
But this assumes the API is only reachable from a client you developed, but what if someone tried to access the API from ,for example, Postman, or browser?
For a browser, there is swashbuckle
Postman can be used to obtain a token via the normal login route, just as any client would
Ah I got confused. If someone tried to access the API from external client the API won't find the GUID in the DB.. well that's good security :D

« first day (3904 days earlier)      last day (1256 days later) »