Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

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.
 
  • Locked thread
Shaggar
Apr 26, 2006

pointsofdata posted:

There's a thing called Logical Correlation Context or something which works really well using some sort of magic

request correlation ids are one of the best features of asp.net. also the magic is thread local storage (I think?)

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
latest nlog or older nlog + nlog contrib has support for correlation ids as a logging variable so you don't even need to do any extra work.

necrotic
Aug 2, 2005
I owe my brother big time for this!
we have been gifted with typed json to fix all of its issues lets celebrate
https://tonyarcieri.com/introducing-tjson-a-stricter-typed-form-of-json

HoboMan
Nov 4, 2010

oh should i be doing api logging different than just synchronously making GBS threads the request into the database?

distortion park
Apr 25, 2011


HoboMan posted:

oh should i be doing api logging different than just synchronously making GBS threads the request into the database?

Nah yiu do it the same but put async=true in your nlog config

distortion park
Apr 25, 2011


Shaggar posted:

request correlation ids are one of the best features of asp.net. also the magic is thread local storage (I think?)

Put it gets passed between threads started from abother somehow and always just works

Shaggar
Apr 26, 2006
oh. its just in HttpRequestMessage.Properties . not much magic there

akadajet
Sep 14, 2003

necrotic posted:

we have been gifted with typed json to fix all of its issues lets celebrate
https://tonyarcieri.com/introducing-tjson-a-stricter-typed-form-of-json

gross. if i hated myself id just use xml

Soricidus
Oct 21, 2010
freedom-hating statist shill

akadajet posted:

gross. if i hated myself id just use xml

why would you use something easy, pleasant, and fit for purpose if you hated yourself?

akadajet
Sep 14, 2003

Soricidus posted:

why would you use something easy, pleasant, and fit for purpose if you hated yourself?

https://www.youtube.com/watch?v=yfelqZpapZA&hd=1

HoboMan
Nov 4, 2010

pointsofdata posted:

Nah yiu do it the same but put async=true in your nlog config

nlog?

GameCube
Nov 21, 2006

Luigi Thirty posted:

so I have a VMWare virtual machine here

the Amiga is hooked up to it via PPP and is ppp0. my normal internet is hooked up to it via NAT and is ens33. the amiga and VMWare can talk to each other fine but the Amiga can't see anything other than the computer

how do I set up the routing so ppp0 can talk to my LAN via ens33?

hmm. on second thought maybe i don't want to hook up this amiga

distortion park
Apr 25, 2011



It's a logging framework there's ones for java too

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


does that typed json seriously support float as it's ONLY decimal type?

JawnV6
Jul 4, 2004

So hot ...

Condiv posted:

does that typed json seriously support float as it's ONLY decimal type?
can it even store NaN

9-Volt Assault
Jan 27, 2007

Beter twee tetten in de hand dan tien op de vlucht.

JewKiller 3000 posted:

pasting this here since only 1 person responded in the PL thread:

I think No Starch Press has some good books for kids, about building games and such. Much more fun than Eloquent Javascript, which i would not recommend for a 14 year old. its way too dry and also probably too difficult for a first introduction.

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

Condiv posted:

does that typed json seriously support float as it's ONLY decimal type?

well its the typed javascript object serialization format and javascript only has floats

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

necrotic posted:

well its the typed javascript object serialization format and javascript only has floats

this. javascript has nothing more precise than floats. if you deal with monetary stuff, for example, you really need to be disciplined about making sure your JS's only job is to accept the user-entered values and then ship them to something written in a less garbo language to do the actual math on them.

fritz
Jul 26, 2003

i thought javascript only had doubles?

darthbob88
Oct 13, 2011

YOSPOS

fritz posted:

i thought javascript only had doubles?
ECMAScript does, at least.

Su-Su-Sudoko
Oct 25, 2007

what stands in the way becomes the way

Condiv posted:

does that typed json seriously support float as it's ONLY decimal type?

if you need anything else you just put it in there as a string, duh

Shaggar
Apr 26, 2006

fritz posted:

i thought javascript only had doubles?

javascript has strings and then different interpretations on strings. that's it

KidDynamite
Feb 11, 2005

What's that devs you think we're going to miss the deadline? Here's another feature that has no service or ui that is due in 8.5 working days

tef
May 30, 2004

-> some l-system crap ->

Corla Plankun posted:

why doesnt null equal null in psql

null isn't a value, it's the absence of a value

in sql at least

so, you'e not asking if it equals itself, you're asking if one missing piece of data is the same as another missing piece

well, most of the time. sometimes in sql null does equal null when you're doing operations over the same column

Bloody
Mar 3, 2013

am i a stupid rear end in a top hat if my request logging mostly consists of shoveling the json request thats POSTed to my API into a postgres jsonb column

Shaggar
Apr 26, 2006
its kind of gross since it limits your input formats to the api to json, but if you're only doing json then meh.

the only thing is it makes it sound like you might be manually parsing json instead of using a formatter and normal model binding.

Bloody
Mar 3, 2013

i've got the normal model binding going in the controller, i suppose there's probably a way to bind the model in a handler thing? im making a DelegatingHandler and sticking it in my HttpConfiguration

Bloody
Mar 3, 2013

maybe i should be logging from the controller endpoint where the request content has more meaningful context. or maybe log from both the generic handler and the endpoint?

HoboMan
Nov 4, 2010

Bloody posted:

am i a stupid rear end in a top hat if my request logging mostly consists of shoveling the json request thats POSTed to my API into a postgres jsonb column

it's what i do

so probably

HoboMan
Nov 4, 2010

I needed to make a temporary db branch in tfs since that's apparently the only way to attach a change script to a commit after the fact, but i named it tempDB_Because_Im_A_Dumb in the tfs foldermapping, is there a way to delete this folder? lol

Bloody
Mar 3, 2013

welp doing a few db inserts has absolutely ruined my application for some reason. was good at 2k requests per second with no db stuff, now some simple db logging is basically broken at 100 requests per second

Bloody
Mar 3, 2013

it looks something like:
using(var conn = new NpgsqlConnection(connectionString))
{
await conn.OpenAsync();

using(var query = new NpgsqlCommand())
{
query.connection = conn;
query.command = "insert blah";
query.parameters.addwithvalue("blah", blah, blah);
await query.ExecuteNonQueryAsync();
}

using(var query = new NpgsqlCommand())
{
query.connection = conn;
query.command = "insert blah";
query.parameters.addwithvalue("blah", blah, blah);
await query.ExecuteNonQueryAsync();
}

}

and then under anything vaguely resembling a load it completely melts

Bloody
Mar 3, 2013

it seems like running two db inserts every time my controller gets hit is not ideal

also doing parameterized multi-row inserts feels hacky? like my model is just an array of poo poo that im passed usually as a json array of poo poo and so i want to shove the whole thing in the db but i wanna do that reasonably quickly so i wanna do a multi-row insert so im doin like
for(var i = 0; i < fart.length; i++) cmd += $(@foo{i}, @butt{i}),"
cmd = cmd.Substring(0, cmd.length-1);
and just like mashing strings together and poo poo myself and then doing another loop to AddWithValue all of those parameters i just mashed into a string and like ??? idk i feel like this shouldnt require so much string janitoring?


i like that half of the results i find for multi-row ado.net inserts are trivially vulnerable to sqli

Bloody fucked around with this message at 20:45 on Nov 3, 2016

distortion park
Apr 25, 2011


Do the same but into an elasticsearch cluster

Bloody
Mar 3, 2013

"dev", "prod", and the "db cluster" are all local to my machine. there is no cloud. there is no vm. hail satan

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

Bloody posted:

it looks something like:
using(var conn = new NpgsqlConnection(connectionString))

is this configured to use a connection pool of some sort (doesn't look like it)? otherwise, yeah, a new DB connection every request is gonna limit you a lot.

Chalks
Sep 30, 2009

Bloody posted:

welp doing a few db inserts has absolutely ruined my application for some reason. was good at 2k requests per second with no db stuff, now some simple db logging is basically broken at 100 requests per second

How long does each request take?

The connection creation is probably your biggest overhead if you've not got connection pooling going on, but 100 requests per second seems low even taking that into account.

Bloody
Mar 3, 2013

i dunno! how does npgsql connection pooling work?

also i fudged together a bulk insert command and it is way faster than the non-bulk insert like 10x faster

MrMoo
Sep 14, 2000

qntm posted:

"poor culture fit"

Looks like they translated this into a slightly more prosaic form:

Recruiter posted:

Thanks for following up and I wanted to circle back with you in regards to your previous email. Unfortunately due to HR policies, we cannot provide specific candidate feedback.

Took my second application for an SRE position though, I seem to be missing the secret handshake to get a terrible programmer role. I'm starting to wonder about their SWE roles as they appear to have no logging or monitoring on anything in production and many questions were about inspecting what an app is doing at runtime.

Adbot
ADBOT LOVES YOU

Powerful Two-Hander
Mar 10, 2004

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


I thought the sql connections got auto pooled or something? so even if you close the connection in code or dispose of it it actually gets retained in the background and reused

or something. i read like one tutorial today and realised that i know nothing and am actually just stack overflowing myself to success

  • Locked thread