« first day (3262 days earlier)      last day (1669 days later) » 

1:22 AM
Quick question. There is tool we use to implement SSO (Shibboleth). Basically its a service provider which intercepts unauthorized requests, goes to IDP and then puts authenticated username in server variables of .NET web app. I should be safe always checking the server variables for the SSO authenticated user correct? I mean they are PER request ... I was worried that I might have had to save values from server variable and save it in a session (and then check here). Any suggestions?
 
 
2 hours later…
2:55 AM
Lol, I finally got some progress on my C# tetris
decided itd be easier to make in Unity
Since I have no actual past experience making a moving updating game in plain winforms
setting up groups and models/textures atm but its lookin good
 
lmk when its on steam
lol
 
Lol
Im actually remaking all the groups now because I screwed up the sprite size
I gotta change all those -0.5s to -1
bruh so much work XD
Either way, the Gamestate and the elements are finished
now for the coding part / - /
Anyone else ever screwed up someone so bad you had to reset the settings and sizes for every texture and resize/reposition every element
ffsssss
 
3:22 AM
sounds like a normal day of programming
 
3:33 AM
yuppers
 
when it comes to .select
 
actually had to reset settings AGAIn
 
how do i get in an object list the month/day/year?
 
finally got the positioning and sizing PIXEL PERFECT
 
.GroupBy(x => int.Parse(x.MONTH) * 31 + int.Parse(x.DAY) + int.Parse(x.YEAR) * 365).Select(x => new {EXPIRATION = x. AMOUNT = x.Sum(y => decimal.Parse(y.AMOUNT)), TIME = x.Key })
i did a preceding 'groupBy'
and on the select'
 
3:34 AM
im an Amateur bud, no OPs on right now, may have to wait a while
 
im trying to do expiration as 'month.tostring + "/" + day.tostring + "/" + year.tostring"?
but it wont let me..
 
rLemon seems to magically appear out of thin air to help people, but seems to not be doing it right now lol
 
huh
first off why are you using groupby?
 
Adan
Firstly, that formatting is Inccorect
 
to stack
 
3:36 AM
its .ToString()
 
theres multiple objects with amounts but using the same name
 
And, you may want to assign the integers to a seperate variable
 
there are syntax errors in that string you pasted
 
and then convert that variable to string
 
i use group by to concatenate the amouonts per/name
 
3:36 AM
you mean expiration = x.Key i assume?
but you can just use select?
 
i cant because x.Key is the name
i need name and date
what x.Key does i want another one for date
like, y.Key = month, z.Key = day, ...
currently, x.Key stores unique names
@TaylorSpark yea i know that error, in my IDE it already points it out
 
im not following what you are tryign to do
you have a list of objects with month day and year
you want to group them by # of days since the birth of christ
 
i have a list of objects with the same name and date, but different amouonts
i use groupBy to stack the amounts as x.Sum(x.Amount)
 
I feel that projects related to Dates and time, they are simpler and more easy to complete on Javascript
 
so that i can get 1 unique name/date + amount
 
3:39 AM
so you are just tryign to figure out the amount per day?
 
What exactly are you trying to achieve? just curious :P
 
yes, i have the name, amount, not the date
x.Key is the name, amount is already x.Sum, wheres the date?
 
int.Parse(x.MONTH) * 31 + int.Parse(x.DAY) + int.Parse(x.YEAR) * 365
isnt this the date?
 
i have x.MONTH, x.DAY, x.YEAR
in a regular 'select'
yes it's the date converted
i want the actuall month/day/year in a string
 
use a date function
 
3:40 AM
but you have the month day and year? lol
 
not in the format i want
 
$"{x.Month}/{x.Day}/{x.Year}"
 
DateTime.Now.ToString("MM/dd/yyyy")
:L
like 20 formats here: c-sharpcorner.com/blogs/…
 
you still dont get what im trying to do
 
Yeaahhh not really
 
3:42 AM
explain it better
 
when the statement is filtered i end up with an object that stores names and amounts
date is missing
 
what statement
 
the new object list only contains names/amounts
 
what filter
 
well, I dont usually answer people's things because, really, Im still a C# Average Joe, still learning here, this might be a question worth asking in SO
 
3:42 AM
var BT0aprList = ConversionsDataList.Where(x => (x.METHOD == "Treg" || x.METHOD == "Tbt" || x.METHOD == "Tca") && x.SOURCENAME == sourceName
                && (int.Parse(x.MONTH) * 31 + int.Parse(x.DAY) + int.Parse(x.YEAR) * 365)
                     <= int.Parse(returnHowFarForwardDate(offerMonths, openMonth, openDay.ToString(), openYear).Split(',')[0]) * 31
                     + int.Parse(returnHowFarForwardDate(offerMonths, openMonth, openDay.ToString(), openYear).Split(',')[1])
                     + int.Parse(returnHowFarForwardDate(offerMonths, openMonth, openDay.ToString(), openYea
 
whaat the hellllll
thats one bulky date
Im assumign your trying to use dates in an equation
 
im not going to decipher that
 
no because the resulting list is an object list {NAME, AMOUNT}
i want to add {NAME, DATE, AMOUNT}
 
just show me the object before
 
the .select wont let me
 
3:43 AM
and tell me what you want
 
Adan, You may just want to ask this on SO

lol thats a bit much for this micro C# help desk / chat
 
Select(x => new {EXPIRATION = x.  AMOUNT = x.Sum(y => decimal.Parse(y.AMOUNT)), TIME = x.Key })
 
are you purposely just tryign to confuse the issue?
do you not see im trying to help him
 
alright. Ill leave lol
 
in this select satement, this is where i need to add the code
to include 'DATE'
 
3:45 AM
why dont you just group by date?
 
because i have to convert it
and it is in an undesirable format
i just want EXPIRATION = 'month.tostring + "/" + day.tostring + "/" + year.tostring"
in a regular 'select' statement you can do that
apparently 'groupBy' is not letting me
 
so why dont you group by month.tostring + "/" + day.tostring + "/" + year.tostring
 
because the logic for group by has to be a conversion of the date
 
what are you talking about
 
month * 31 + day + year 365
 
3:47 AM
why does it have to be that
 
i have to group by this
 
why
 
because if i convert the date into an int, i can order by ascending
i can tell which dates are first, i can organize random dates into ascending
 
first of all there will be overlaps in your dates
 
but.. in the end of the list i want to keep date
 
3:48 AM
becaus enot every month as 31 days
and not every year has 365 days
 
nope
 
second of all you can sort by date
or by string
or by anything that can by compared for that matter
 
why? i already have it
everything is working fine, and i have the date already in the object list being sorted
all i want is to keep the date objects into the new list, that isnt hard to ask
 
well it sounds like you have a better way to do it
so then do it
i already told you your groupby logic is incorrect
 
i dont have a better way
that's why im asking here
what is that way?
 
3:50 AM
not only because it doesnt let you do what you want
but because its logically inconsistent
by your logic feb 29 2019 is the same as march 2 2019
 
not really, i ran the code to check, and theres no bugs
 
yea dude youre right
im wrong
 
hold on
feb 29 does not exist
the cap for feb is 28
 
whatever
 
3:53 AM
i thought i checked for stuff like this, well thanks anyways
@cubesnyc solved it
EXPIRATION = x.Select(z => z.MONTH.tostring,...
make a select inside a select under a group by ; )
cheers
 
first off you would use first not select
second off that doesnt solve the problem with your logic
 
nah, select solved it
just ran the code and i got what i wanted, no bugs
 
lol
takes a pretty special person to just keep denying theres a bug in their code
when someone tells them 3x why
 
4:09 AM
hey is there a way to use Math.round but only up to a certain decimal?
 
i wana send a screenshot but damn
@TaylorSpark i remember having to do that, it's possible, i forgot how
i think you round and then do a .toString("N6")
6 means up to decimal places
so round first, then specify the decimal places
 
4:56 AM
@TaylorSpark yes there is a parameter for how many decimal places you want
 
mr5
5:17 AM
my eyes hurt
@TaylorSpark I don't think building the piece in a single image is the way to go.
 
 
6 hours later…
11:26 AM
Hello,
I want to prevent that 1 user can access a Controller in ASP.NET MVC concurrently.
When he requests a 2nd time while the first is still running, the 2nd request should not be executed.

I wrote some code to solve it and i would really appreciate if someone could review it. I'm unsure if it works and i have trouble with testing it.. :(

Here is the code:
public class LockTestController : Controller
    {
        //localhost:8751/LockTest/Submit?userId=1
        // GET: LockTest
        public string Submit(int userId)
        {
            try
            {
                if (TransactionLockRepository.HasLock(userId))
                    return DateTime.Now + $"Err: UserId {userId} already requested";

                //todo: do important stuff an user should not execute concurrently

                TransactionLockRepository.RemoveLock(userId);
And here is the LockRepo:
public static class TransactionLockRepository
    {
        private static ConcurrentBag<int> userLocks = new ConcurrentBag<int>();

        public static bool HasLock(int userId)
        {
            var hasLock = userLocks.TryPeek(out userId);
            if (hasLock)
                return true;
            userLocks.Add(userId);
            return false;
        }

        public static void RemoveLock(int userId)
        {
            userLocks.TryTake(out userId);
 
Does the order of items matter when solving 0/1 knapsack problem, order by weight or valu?
 
 
1 hour later…
12:38 PM
In sql we can join and get all the rows. In Linq is there a way to join and get all the rows without specifying it?

for example

from a in tableA
from b in tableB.Where(x => x.tableAId = b.Id).DefaultIfEmpty()
select new { a.*, b.* }
 
i didnt try but select new {a, b} should work or not? then you would have 2 objects returned
 
1:05 PM
select new {a, b} will create a object collection which will have two object a and b in each element. I wanted flat object with all the properties of a and b
For now I had to hand code 40 properties. I could not find any AutoMapper examples :(. But I will keep trying.
 
1:24 PM
hmm maybe make a dynamic object and serialize a and b into it
 
1:45 PM
That is what I am doing. I wanted to avoid hard coding to destination object props
 
 
1 hour later…
2:59 PM
I have my local iis setup in a way so that when I have asp.net projects I only have to build them and the local IIS detects that and run new code. How can I do that for asp core?
 
 
3 hours later…
6:05 PM
@qd0r your code would allow a user to put two locks in
if he requests the page twice
and no lock ahs been set
 

« first day (3262 days earlier)      last day (1669 days later) »