New around here? Register your SA Forums Account here!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
redleader
Aug 18, 2005

Engage according to operational parameters

HoboMan posted:

so this is my first new app in several years. can anyone recommend a logging or error handling framework for a angular.net project?

in my experience so far error handling and logging has been "none, but maybe make a bespoke thing if you need it" so i would like to do better now that i have the chance.

dunno if you're going to be dealing with datetime stuff, but if you are going to need to deal with dates/times over multiple timezones or deal with daylight savings then you'll want to think very hard about incorporating something like nodatime from a very early stage. you don't want to start by using DateTimeOffset etc then suddenly realise how poo poo the .net date time apis are

Adbot
ADBOT LOVES YOU

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

so preoccupied with whether they could
didn’t stop to think whether they should

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
god i hate writing boilerplate dtos

animist
Aug 28, 2018

eschaton posted:

so preoccupied with whether they could
didn’t stop to think whether they should

"i wish i had c, but without static typing" --nobody, ever

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
code:
typedef void* var;
welcome to the wild west.

e:
code:
struct Float {
  double val;
};
wait wut

elite_garbage_man fucked around with this message at 23:02 on Apr 15, 2019

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
code:
#define in ,
i guess that's one way to make a foreach macro work

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
imagine how much more amazing a C++ version could be, with template metaprogramming mixed in too

Asleep Style
Oct 20, 2010

Is there a modern use case for macros besides include guards or platform specific compilation?

Qtotonibudinibudet
Nov 7, 2011



Omich poluyobok, skazhi ty narkoman? ya prosto tozhe gde to tam zhivu, mogli by vmeste uyobyvat' narkotiki

gonadic io posted:

i'm having increasing amount of issues with discord's formatting especially on mobile. how dumb is it for my bot to dynamically generate a png or svg instead of responding in discord's half-assed markup?

I lose: copy/pasting, any links to web or other users. bandwidth maybe??
I gain: columns stay even on mobile, dynamic text scaling to the size of the user's screen.

what the gently caress are you doing in discord

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

Asleep Style posted:

Is there a modern use case for macros besides include guards or platform specific compilation?

https://troydhanson.github.io/uthash/

redleader
Aug 18, 2005

Engage according to operational parameters

Asleep Style posted:

Is there a modern use case for macros besides include guards or platform specific compilation?

https://github.com/orangeduck/Cello

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

florida lan posted:

what the gently caress are you doing in discord

sounds like they’re attempting to use it op

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
i definitely want to expand my chat client to be really big to make some bot's wacky multi-column layout legible, and then shrink it back down so that it's actually usable for chatting

every single time the bot posts something

that wouldn't be annoying at all

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Asleep Style posted:

Is there a modern use case for macros besides include guards or platform specific compilation?

absolutely

you can do a lot of metaprogramming with macros that can actually be beneficial to your code, both for clarity and for safety

as an example, if you need to do a lot of buffer processing, you can write alloc/free macros that sagely choose to create buffers under a certain size on the stack rather than the heap and significantly boost performance

the GCC ({ … }) can also help by letting you write macros that return something reliably

of course being purely text substitution they’re still not as powerful as Lisp macros

dick traceroute
Feb 24, 2010

Open the pod bay doors, Hal.
Grimey Drawer
ctps: turns out you shouldn't create hundreds of thousands of instances of HttpClient in a tight loop
who knew

AggressivelyStupid
Jan 9, 2012

dick traceroute posted:

ctps: turns out you shouldn't create hundreds of thousands of instances of HttpClient in a tight loop
who knew

aaaaaaaaaa

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


macros are great for embedded stuff bit janitoring too, most manufacturers supply macro libraries for dealing with peripherals and whatnot

meaning you can write something like this without function call overhead:

code:
void UART2_Init(unsigned long baud_rate){
  /*The internal UART module module is set to :
     default Tx and Rx pins. 
     115200 baud 
     8-bit data, no parity. 
     1 STOP bit. 
     */
  USART_InitTypeDef USART_InitStructure;

   
  GPIO_Configuration_USART2();
 
     
  USART_InitStructure.USART_BaudRate = baud_rate;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  USART_Init(USART2, &USART_InitStructure);
   
  
  NVIC_Configuration();
  
  USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);

  USART_Cmd(USART2, ENABLE);
  
}
(stolen off github im on my phone)

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
the c preprocessor is so bad but I can't stop using and abusing it

help

gonadic io
Feb 16, 2011

>>=

Symbolic Butt posted:

the c preprocessor is so bad but I can't stop using and abusing it

help

Same but Rust's version: https://crates.io/crates/future-union

distortion park
Apr 25, 2011


dick traceroute posted:

ctps: turns out you shouldn't create hundreds of thousands of instances of HttpClient in a tight loop
who knew

It implements IDisposable but that's a trick, disposing it doesn't help!!!! SqlConnection on the other hand is fine with doing this

e: "fine"

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Asleep Style posted:

Is there a modern use case for macros besides include guards or platform specific compilation?

https://github.com/sekrit-twc/zimg/blob/master/src/zimg/resize/x86/resize_impl_avx.cpp#L143

the holy trinity: template metaprogramming, assembler intrinsics, c preprocessor macros

the macros actually do help slightly in making these unrolled loops somewhat more readable, i think. if you want to nerd out about optimization, image processing is one of the more accessible applications for it with quite a bit of high quality open source code. this particular library does some pretty cool poo poo. the template metaprogramming combined with assembler intrinsics is there to generate hand-vectorized codepaths for a whole bunch of different scenarios, and in some cases even have handwritten assembler that is generic over a bunch of different types. it will also generate a graph of these vectorized dsp filters to get from any arbitrary input to any arbitrary output (including resizing, bitdepth conversion with dithering and colorimetry changes including gamma).

if you're sick of javascript being slow, maybe commit messages like this will make you feel better?

code:
colorspace: use bfloat16 for SSE2 linear-to-gamma LUT

On Skylake, processing 512 pixel array:

direction	cycles/sample	cycles/pxvector
     g->l	         2.35	           9.43
     l->g	         2.49	           9.97
e: also has some pretty nice feature request comment threads

e2: quoted the wrong post lol

TheFluff fucked around with this message at 12:27 on Apr 16, 2019

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
nim has a cool macro system that lets you manipulate the AST using the language itself.

sometimes I miss working on the geospatial database stuff I used to but I don’t miss that company.

getting a C job immediately out of college and working on a SPARC64 based application loaded with macros and bitpacking made doing stuff in managed languages less... interesting

dick traceroute
Feb 24, 2010

Open the pod bay doors, Hal.
Grimey Drawer

pointsofdata posted:

It implements IDisposable but that's a trick, disposing it doesn't help!!!! SqlConnection on the other hand is fine with doing this

e: "fine"

I actually feel like it shouldn't be idisposable
Not that we had it in a using block...

No joke, same day I found a set of tests with:

singleton HttpClient (good)
running in parallel (good)
Altering default request headers on the client, breaking other tests in the process (Hella lol)

redleader
Aug 18, 2005

Engage according to operational parameters

dick traceroute posted:

ctps: turns out you shouldn't create hundreds of thousands of instances of HttpClient in a tight loop
who knew

the pit of success

Asleep Style
Oct 20, 2010

Thanks everybody, all of those examples are super helpful

Aramoro
Jun 1, 2012




The last Chrome updated silently broke our application.

lol.

poo poo.

akadajet
Sep 14, 2003

Aramoro posted:

The last Chrome updated silently broke our application.

lol.

poo poo.

you write ublock?!

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

dick traceroute posted:

ctps: turns out you shouldn't create hundreds of thousands of instances of HttpClient in a tight loop
who knew

lol same but with EF DbContext in our app... the Russians were aggressively recreating DbContext for EACH function call... which is what you do if you need EF to do work on other threads... but then they just did everything on main thread, so wow I got a huge performance gain by just using the scoped DbContext from the DI container lmao

pseudorandom name
May 6, 2007


https://www.youtube.com/watch?v=srme0p3oxFo

gonadic io
Feb 16, 2011

>>=

florida lan posted:

what the gently caress are you doing in discord

here's what it looks like on web when the screen is wide enough:


here's what it looks like on discord's mobile app:


other than the app just being poo poo (see how many of those names are just @invalid-user) i'd like to resolve this. markdown has support for tables but discord doesn't support it. some bots use monospaced code blocks like this:

but if they're too wide then it line wraps and looks loving awful

so yeah I was thinking about generating SVG/PNGs and that at least would not gently caress up the formatting and would in fact auto scale to the width of the user's screen if they clicked on it

necrotic
Aug 1, 2005
I owe my brother big time for this!

gonadic io posted:

markdown has support for tables but discord doesn't support it

no this is a lovely thing about "markdown": there is "markdown" (the original design) which doesn't include tables, and then a zillion "extensions" that do. saying it supports "markdown" doesnt really mean poo poo anymore.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I realized just today that proper markdown doesn’t include a bullet among characters that denote a list item

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
dev targeting react gets tripped up by responsive design, news at 11

HoboMan
Nov 4, 2010

man, the imposter syndrome is real at my new job. i killed it at my last job and my new manager keeps talking about how smart i must be and how everyone at my old company only had the highest praise for me, but i don't know anything about dev process or achetecture. i can make lovely code slightly less poo poo and that's all really

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

idk i feel like "make code less crap" is a pretty dece skill

Soricidus
Oct 20, 2010
freedom-hating statist shill

HoboMan posted:

i don't know anything about dev process or achetecture. i can make lovely code slightly less poo poo and that's all really

congratulations you’re in the top 1% of professional programmers

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Soricidus posted:

congratulations you’re in the top 1% of professional programmers

we should really pick that bar up off the floor someday.

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER


leper khan posted:

we should really pick that bar up off the floor someday.

no don't it's been there for so long it's integral to our architecture

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.


leper khan posted:

we should really pick that bar up off the floor someday.

well it's not today because the "authentication problem with the iis server" that has been keeping two people occupied for 2+ days turned out to be copy and pasting code from one app to another without understanding any of it resulting in attempts to access session variables that didn't exist and had zero exception handling or logging in place to actually flag this. nobody had even thought to work through the code from session start to check.

the bar remains low....

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=
the junior we hired today astounded me. i left him with: the structures seem sound - get it compiling and then we can start to test it

turns out he achieved this by, whenever he encountered an error about a variable not being found, adding "var foo = null;".

funnily enough it didn't work during testing

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply