« first day (3840 days earlier)      last day (1091 days later) » 

mr5
6:35 AM
It seems COBOL is being reincarnated
 
6:54 AM
^ everywhere. Just like everything is in cycles.
 
@Freerey fiddlers are not a place to save your work
that is like saying "wowwww Azure can suck it, they dont even send me a notification when I have to wake up"
 
7:10 AM
@Wietlol You could totally make Azure send you wake up calls :P
Or like, make coffee
 
7:26 AM
Btw anyone know of a concise way of unit testing this so I don't have to mock and stub all the things?
public class ExceptionHandler : IMiddleware
{
	public async Task InvokeAsync(HttpContext context, RequestDelegate next)
	{
		var feature = context.Features.Get<IExceptionHandlerPathFeature>();
		var exception = feature.Error;

		var result = JsonSerializer.Serialize(Result.Negative(exception.ToString()));
		context.Response.StatusCode = StatusCodes.Status200OK;
		context.Response.ContentType = "application/json";
		await context.Response.WriteAsync(result);
	}
}
 
7:39 AM
it is a very closely coupled class to the entire foundation of the framework you are using
... good luck
 
7:52 AM
^ don't test that. It's like testing the framework. context.Features.Get<IExceptionHandlerPathFeature>(); < I would start testing the interesting part without the above boilerplate
 
i always thought that unit testing would become easier once you drop all the frameworks and just have input/output operations
turns out that I still do minimal unit testing...
 
8:08 AM
why is it that xamarin android emulators suck so much
buggy an shiz.
 
mr5
I only had that problem when my computer has no GPU. Solution: buy GPU :)
 
you must have a igfx
or just download it online, its free
 
hey ny
nice to hear from you again
i have amd
 
mr5
izz time!
 
8:24 AM
@mr5 i have a pretty old entry gaming laptop
whats igfx anyway
 
mr5
dunno
I'm not hardwarish guy
I only know keyboards & mouse & monitor
everything is just a blackbox for me
 
same here.
for some reason ive had this laptop for quite some time but never managed to play games properly on it.
seems im missing some setting and stuff
kinda frustrating to have a gaming laptop
and fail on the games
 
mr5
I have this laptop that can run DOTA2, PoE, 2 instances of VS2019, Android Emulator, and Chrome with multiple tabs at the same time.
this is probably my best investment
what brand is that
 
toshiba sattelite
a10 processor with
some asd8uu098 graphics
hahaha dota 2
nothing will replace dota 1 late nights on garena tho
and beer.
 
mr5
@c0dem0nkey lmao
it's not even recommended as gaming laptop
 
8:34 AM
hahahahahahaaha
plus that its old
anyway.
 
mr5
yeah
 
it sometimes run it only a bit slower
but theres intermittent issues like the emulator hanging / just wont work
 
mr5
buy PC. it's much faster
 
i have a mac
 
mr5
 
8:35 AM
can run both
 
mr5
look at this beast
that green one is the entire system unit
 
wow
 
mr5
@c0dem0nkey running on M1?
 
bolts and nuts to me
hahahaha
a10
 
we'll buy a new laptop
 
8:38 AM
this model.
nah on my mac i can code pretty much okay
 
mr5
@c0dem0nkey so you're telling me your toshiba has an Apple chip?
 
its just this pc has a larger screen. and its windows.
@mr5 this.
 
mr5
how about plug your mac into a bigger monitor so you don't need to deal with that old toshiba
 
yeah.
sadly.
i just love this thing.
lol
well i can run the emulator. just sometimes it gets stuck like right no won "deploying to pixel_2_x...."
i cant even play valorant on this thing
 
mr5
ah
it's probably the adb
 
8:42 AM
but when it auto detects graphics it puts it on "very high"
 
mr5
have you tried restarting it whenever it happens?
 
hmm
dunno i tried a million things.
most probably yeah.
 
mr5
it's the adb that communicates with the Android devices
and VS just relies on it
 
there we go restarted it.
lets see if itll push thru
oh fck me
 
mr5
also take note, adb could be running in multiple instances. just kill them all before starting it.
 
8:45 AM
thats it all along
thanks matey i owe you a couple of beers now
since 2019
 
mr5
nah
I don't drink anymore
just an ETH would be enough ;)
 
why
oh i see.
lol
i own other alts
 
mr5
for some reason, I can't buy doge
 
i bought doge feb this year
sold it away.
no fundamental use for me.
 
mr5
it got 400% last last last last day only
 
8:50 AM
damn.
 
[Hans1984] I dont know
 
Turns out I had my exception handler attached incorrectly. .UseExcpetionHandler wouldn't run without having it added to services first, so I had to .AddScoped<ExceptionHandler>() first. Also the middleware has to 1) call the next delegate 2) catch exception thrown from that call.
		public async Task InvokeAsync(HttpContext context, RequestDelegate next)
		{
			try
			{
				await next(context);
			}
			catch (Exception e)
			{
				var result = JsonSerializer.Serialize(Result.Negative(e.ToString()));
				context.Response.StatusCode = StatusCodes.Status200OK;
				context.Response.ContentType = "application/json";
				await context.Response.WriteAsync(result);
			}
		}
This is it
 
[Hans1984] I dont know why you pinged me
[Hans1984] of all ppl
[Hans1984] 🤣
 
Still no idea how .AddExceptionHandler is supposed to work with a middleware
 
[Hans1984] im just here for th elolz
[Hans1984] you should know by now
 
mr5
8:54 AM
@Squirrelkiller is this the official way to make an extension middleware on ASP?
 
No idea lol
 
mr5
I thought you are making a middleware for ASP?
 
It is a middleware
 
mr5
e
[HttpGet("{id}")]
public async Task<Product> GetProduct(long id)
{
    var product = await context.Product.FindAsync(id);

    if (product == null)
    {
        return NotFound();
    }

    return product;
}
does ASP have a specialized exception for each HTTP status codes?
 
ASP does not map exceptions to status codes
Exeptions will generate 500 Internal Server Error by default
 
mr5
8:57 AM
if I throw from there, it will just be 500?
 
mr5
yeah so I need it to wrap to ActionResult
 
If your application throws an exception and you don't handle it from the application, that right there is an actual error in the application that needs to be fixed
@mr5 Absolutely not.
Trying to explain how you need ActionResult because of http codes while abstracting away http on clients is a great way to make me quit a conversation
 
mr5
err
you don't get me
// WebAPI
// this would either return a Product or varying application/json Content-Type
[HttpGet("{id}")]
Task<ActionResult<Product>> GetProduct(long id);

// Mobile
// this would either return a product or throw
[Get("/api/product/{id}")]
Task<Product> GetProduct(long id);
 
@mr5 just go with AWS API Gateway, backed by AWS Lambda already, dang it
:)
 
mr5
9:08 AM
nah
I like to learn ASP :D
I will probably learn the AWS lambda someday when I finally switch to backend career
 
mr5
oh
so I can just throw directly from the controller and handle it from there right?
 
you specify an exception handler
that one can return special responses
 
mr5
do you know an existing handler that can already do that? say, I would just throw from the controller like this: throw new HttpError(404, <optional response body?>)
 
I dont,
I dont do ASP
because without it, everything becomes much easier
since I stopped using frameworks, I get a lot less questions of "how do I do this?" or "what happens if I do that?"
 
9:28 AM
Thoughts on the design? :/
 
smol
 
mr5
add border-radius:2.1px !important;
 
It's WPF :D
 
mr5
oh. then...
<Border BorderBrush="#FF000000" BorderThickness="2.1">
   ...
</Border>
 
That's pretty cool - thank you
 
mr5
9:35 AM
no. it isn't
 
The design seems a bit too compact.
 
mr5
:D
 
Do you know where I can find some decent layout examples
I found some super basic ones
 
mr5
ah no idea
I am just actually messing with you. I have no xp doing WPF
 
What about xamarin then ;)
 
mr5
9:53 AM
my artistic skill didn't develop actually so I wouldn't recommend you listening to my UI suggestions ^^
 
Love the honesty
I have this property:
        private double _fat;

        public double Fat
        {
            get { return _fat; }
            set
            {
                _fat = value;
                OnPropertyChanged();
            }
        }
And use it like so <TextBox Text="{Binding Fat, UpdateSourceTrigger=PropertyChanged}" />
It loads up like this:
Then this happens, which I believe is a normal flow.
But now - when I try to type 0.5 it only shows 5 and ignores the 0.
Ah
<TextBox Text="{Binding Fat, UpdateSourceTrigger=LostFocus}" />
Changed the UpdateSourceTrigger to LostFocus
 
10:43 AM
lands softly
!~shiba
 
ahhhhhhhhhhhhhh
 
11:13 AM
@Wietlol it's not like the fiddler was my only copy of that code, but ffs I expect the save button to actually do what it's advertised to do and not disappear for no reason
 
12:03 PM
@nyconing Fluffy overload
 
yep
 
lmao so this work on fiddle, but not on my webform? pls dotnetfiddle.net/PRqS6A
 
mr5
@Freerey I feel honored with my screenshots being useful to someone ^^
 
I IDD NOT STEAL SCREANSHOTS WHAT ARE YOU TALKING ABOUT
 
mr5
maybe because you have a different netframework version?
 
12:17 PM
ye I am, hmmmm
 
mr5
or package version
<!DOCTYPE html>
why do some people use a more complicated starting tokens other than this
 
the webform master page uses <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
@mr5 who does?
 
mr5
that guy ^
 
oh yeah my supervisor gave me some photos to use in the new webpage design, told me to come back and ask him before implementing them, and now he's like "hey don't do too much work on this cmon"
also remember: the carousel is called on a specific asp.net page, whereas the fiddle is structured more like how the master page is
 
12:23 PM
[Captain Obvious] @mr5 because back before html5 when browsers were all fucking dumb they needed to be told how to render shit because depending on what spec developers were working to it would be totally different depending on what dialect of HTML you were writing in
 
mr5
oic
the spec looks rushed. didn't even consider the long run impact of that syntax
 
[Captain Obvious] I believe there was a few different key versions, XHTML Strict, XHTML Transitional, HTML strict and HTML transitional
 
mr5
the same with User-Agent value. Whoever designed it.
ha
you seem to have experienced dwelling on that shit syntax
 
[Captain Obvious] By the early 000s by a mile the dominant standard was XHTML transitional I think, but some browsers would still default to other dialects if it wasn't specified
[Captain Obvious] It never mattered to be me because I first dipped my toes into html around 2009, but I was around before HTML5 came around and the declarations were no longer important
[Captain Obvious] It was essentially just a magic string to make sure your document rendered something resembling correctly even on 15 year old browsers
 
and then there's me, who worked with html a year after html5 😂
 
12:29 PM
[Captain Obvious] When did html5 actually get published
[Captain Obvious] draft spec in 2008, officially recommended since 2014
[Captain Obvious] shiiiit
 
okay, so I actually got into html the year html5 was recommended
 
[hollystyles] IE Quirks mode mwahaaaahaahahahaaaaaaa
 
mr5
I think started writing html (circa 2011) without even using those starting tokens and it just work so that's why I didn't bother. Then I develop the interest to write my own browser too and I learned about that.
 
[Captain Obvious] IE is something that relied (partially) on the doctype declaration to decide on how to render the page
 
mr5
lucky me. didn't even bother to deal with IE mwuahaha
 
12:49 PM
I have to deal with it still :D
we still have yet to move everyone over to Edge Chromium
 
[Captain Obvious] Fuck Chromium based browser
 
wut? but it's good
 
[Captain Obvious] Not when it doesn't render shit properly
 
when does it not do that?
srsly idk because I can't use chromium on my work pc 🤪
 
[Captain Obvious] I found an example the other day in my current prohect
[Captain Obvious] one sec
 
12:56 PM
so?
 
aw das stupid
 
[Captain Obvious] Yeah it is
[hollystyles] Hyper text markup is just a hint based heuristic for browsers to interpret how they see fit.
[hollystyles] The first example is not accessible to the horizontally challenged
[hollystyles] Sorry vertically chalklenged
[hollystyles] I am axidextrouse personally
[Captain Obvious] I don't get it
[hollystyles] I am totally not being serious 🙂
 
mr5
@CaptainObvious use css' transform instead?
 
[Captain Obvious] Transforms are weird thougj
[Captain Obvious] especially when writing-mode is supported kinda on most browsers
[Captain Obvious] BUT THE NEW MODES TO RENDER SIDEWAYS TEXT ARENT SUPPORTED ON CHROMEIUM BROWSERS
[Captain Obvious] And this is why we don't have all but one browser using the same damn engine
 
1:22 PM
@CaptainObvious you mean one is in firefox and the other is in chrome?
 
one time I told a gen-x coworker about how I came to places like this to get help with programming
but when I told him, he's like "oh, you mean you use 4chan?"
which I just found out the company has been blocked from accessing
 
mr5
use 9gag
> Generation X, or Gen X, refers to the generation of Americans born between the mid-1960s and the early-1980s
eh it's for USAnians only
 
1:43 PM
[Captain Obvious] @Wiet yes
 
ye, they might be both chromium, but that doesnt mean they are the same
iirc, they still use their own vendor prefixes in css for example
how did you make it vertical though?
 
1:55 PM
if you are using transform: rotate, then you probably want the same effect for -webkit-transform and -ms-transform
obviously, KotlinJS does this for you :D
styledH2 {
	css.transform.rotate(270.deg)
	+"text"
}
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
results in the above
-moz- appears not necessary as firefox handles it already
 
mr5
the transform is a hack though. there is actually a more standard way of doing this.
 
yes, except that it doesnt
writing-mode only supports rotate(90deg) not rotate(270deg) which is what Cap wants
or... it does support it and it just doesnt work in chrome...
 
mr5
2:13 PM
yeah it looks like it.
tried it and that spec sucks ...again
it's just strange to me that I can't see any "day in the life of an Apple SE" on YT
prolly an NDA thing
 
2:46 PM
I'm trying to set up an API call rate limiting system and I'm trying to figure out the best way to identify individual people. I was initially going to use IP address, but some of our users are going to be behind the same firewall so they would register as being behind the same IP. There's ConnectionID and SessionID and I'm trying to figure out if one of those would be better. Can anyone suggest anything?
 
best way? identity
for unauthenticated/anonymous usage, then IP would probably suffice
 
mr5
or use an existing rate limiting middleware
there is someone actually that introduced me to one and he's asking about something...
 
Where do I get Identity?
 
mr5
oh
it was also you haha
 
lol
Yeah, I couldn't get that one to work at all.
 
mr5
2:53 PM
it didn't work?
ic
let me try it
 
I couldn't get it to affect the rate at all
That library. I can't remember what it was called now.
 
@Hypersapien whoever is authenticated
assuming you have to be authenticated to call your service
if your account gets blocked, good luck invoking the service
 
Some of this stuff is for unauthenticated people. Primarily OTP requests
 
if it is one-time, then rate limiting should be limiting the endpoint to a single call
 
2:58 PM
Yes, but it still needs to be able to label that person somehow to make sure they are the one being limited
What was the Identity you were talking about?
Oh, that's only if they're logged in?
 
3:14 PM
yes
 
mr5
yeah
fuck that package
it doesn't work
 
3:37 PM
:)
Good, that means I'm not (necessarily) incompetent.
 
mr5
@Hypersapien I made it working
 
1
Q: Bootstrap container content does not center when window is shrunk

FreereyI am in the process of developing a BootStrap wrapper for an ASP.NET website that works with almost everything I have used in it -- with the only exception being that content in the main panel does not center itself properly when shrinking the browser window's width, despite the header and footer...

went and added a link
 
mr5
@Hypersapien I posted my code here for your reference: gist.github.com/mr5z/508da5ddff2494a3ba14ea0f9f98c400
if you use the library and you wanted to work that app.UseClientRateLimiting, I think you should specify that as well in the appsettings.json (something like "ClientIdHeader": "X-ClientId") in which header you are basing the client identity (this is just a guess though)
If you're using a standard auth library for example, you can just do "ClientIdHeader": "Authorization"
again, just a guess
I deleted the code from my app as soon as I made it work so I didn't have the time to made further testing :)
 
 
1 hour later…
5:03 PM
Hello. First time in chat. Hey, I've asked a question a couple of days ago and I've since realized it is irrelevant to my problem. It has no answers yet. Should I delete it or leave a note on it... what's the agreed upon protocol? Thanks.
 
I think you should keep it up and share it with more people, consider rewording it if you need to
oh but wait...if it's irrelevant, than yes delete
 
Ok will do. Thank you very much.
 
5:29 PM
I'm trying to take an anonymous object and turn it into a json string, but the property names keep getting converted to item1, item2, item3...
 
man I wish I could downvote answers to my own question regardless of rep
 
5:47 PM
I'm glad for this chat because this would be a very silly thing to open a question about, I think. I have the following doubt: what's the correct exception to throw when a certain language isn't installed?
I'm trying to use OcrEngine, and it has the method OcrEngine.TryCreateFromLanguage(Windows.Globalization.Language lang). This returns null if the language isn't installed. It also has a OcrEngine.IsLanguageSupported(lang), this one returns a bool.
 
catch (Exception ex)
{
    if (ex.GetType().ToString() == "System.Exception")
        Message.ShowMessage(ex.Message);
    else
        Error.ShowError("Error when saving the image information.<br />" +
            ProgrammerInfo.Department() + ProgrammerInfo(), ex.Message);
}
something like this?
there's already an exception class in c#
 
Yes. Should I just use the general class Exception, that's my question. Or is there a more specific one. I know there's CultureNotFoundException in System.Globalization but nothing for LanguageNotFound/Not Supported, at least I'm not finding anything.
 
I think you should use the general one
 
Ok cool. Thanks.
 
fyi I don't know about the OcrEngine, but I assume the regular exception has enough features to work with it
 
5:57 PM
Yeah the regular exception will be fine. If the API itself doesn't bother to have an specific exception why should I, right?
 
there ya go ;D
 
6:29 PM
Hi all
 
hi
 
Let's say you have a table of values with a unique constraint on 4 columns. I need to delete a row and reset an ID column to reflect the deleted item. The other columns' values stay the same. In other words, in a list of 5 rows, I deleted #3, and now need to set them to say 1, 2, 3, 4. How do I do this to avoid getting a Violation of UNIQUE KEY constraint exception?
I'm using EF. Do I delete them altogether, then add them back?
And if above is confusing, no worries. I'm rubber ducking here :)
 
I've been told one should just let numeric auto-increment Primary Keys be. If you need a unique number for logical reasons you just create a new field.
 
6:45 PM
Yeah, this isn't a PK or auto-increment.
 
Oh I see. I understand now.
 
One dirty solution: I know that the column's values will never exceed 30 or so. I can set the column to a number I know won't violate the unique constraint, then set it again down to the normal range. This is almost like creating a temp copy and then setting it back to what it needs to be
 
What I'm about to say may be very stupid, but couldn't it be done with a WHILE loop? You update record by record (all the ones which have values greater than the one you deleted) and make their value equal to value - 1.
the value of the field in question, I mean.
 
Hmm. That may work. So start after the deleted item and work down
Any way you look at it, this is tricky :)
 
Yeah. Maybe if you have the value of the field of the deleted item you could SET your counter variable (let's call it @counter) to it, and you should SET a variable as the upper bound which should be a SELECT COUNT() on the table minus @counter... maybe
then the UPDATE uses a WHERE field = @counter and sets field as @counter + 1, and then you increment @counter.
I mean, @counter - 1
 
6:59 PM
dotnetfiddle.net/6dmcaX man I feel like I'm so close to figuring this one out
just gotta get the main container to follow the center
 
Thanks, Davi
 
or something... there's an off-by-one error in my thinking somewhere but you'll find it quickly since you're actually writing the code
No problem, glad to help. I feel like such a leech in this community. Actual answers to actual question are put through such a high level of scrutiny, it's like peer-review.
 
It's okay. I'm terrified of answering questions for the same reason
If it's web related, I can try
 
Glad to know I'm not alone in this :D
 
Nope. If you're ever in the wpf chat, you'll meet some experts there too. Those folks are doing stuff that blows my mind
Been programming for 20 yrs and still feel like a n00b
 
7:04 PM
Asking questions in Stack Overflow is usually my last resort. I try everything I can imagine first.
 
Lately my questions just sit there. Nobody answers but thankfully nobody buries me in downvotes either
 
^I feelt aht
 
 
3 hours later…
10:19 PM
[Captain Obvious] Whoa it was busy this evening
 

« first day (3840 days earlier)      last day (1091 days later) »