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.
 
  • Post
  • Reply
Bloody
Mar 3, 2013

gonadic io posted:

assuming you mean proc macros, once you have those 4 libraries set up (syn, quote, proc-macro2, ??? proc-macro-hack?) i haven't found it too bad.

if you're rearranging valid rust syntax, then it's p direct. use quote, and then you manipulate the ast directly.

if you are making custom syntax, then you deal one big ast type stemming from a token stream, i.e. an iter of https://docs.rs/proc-macro2/0.4.27/proc_macro2/enum.TokenTree.html

the most complicated thing i've done with it is when instead of being ad-hoc when looking at tokens you actually make new syntax by providing an alternate Parse instance and then reusing the rest of the existing infrastructure.

is there anything specific you are stuck with? previous horrors i've done with proc macros are:
type level binary trees: https://github.com/djmcgill/future-union
named argument functions: https://github.com/djmcgill/named_args

and then old macros i did this goddamn monstrosity to avoid copy pasting (and copy pasting drift): https://github.com/atsamd-rs/atsamd/blob/master/hal/src/gpio.rs#L424

synstructure, syn, quote, and proc_macro

i have these structs, and for all of them i keep writing this long mess of extremely boilerplate code, and i want to not do that, but i don't know what i'm doing, so it's going very poorly

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=

Bloody posted:

synstructure, syn, quote, and proc_macro

i have these structs, and for all of them i keep writing this long mess of extremely boilerplate code, and i want to not do that, but i don't know what i'm doing, so it's going very poorly

this is the boilerplate pattern i see everywhere (taken from my named_arg macro):
code:
struct NamedField {
    name: Ident,
    colon_token: Colon,
    expr: Expr,
}
impl Parse for NamedField {
    fn parse(input: ParseStream) -> Result<Self> {
        Ok(NamedField {
            name: input.parse()?,
            colon_token: input.parse()?,
            expr: input.parse()?,
        })
    }
}
i kind of feel like you could make another level of proc-macro to make that a derive :q:

Luigi Thirty
Apr 30, 2006

Emergency confection port.

fritz posted:

the z-machine has been reverse-engineered for years and there's tools like http://inform7.com to build things for it, but then again there's : http://cowlark.com/vbcc-z-compiler/index.html

I meant just writing an interpreter that compiles to version 3 Z-code based on the specs that exist

I know that Z-machine’s been reversed for years, ZIL hasn’t (there’s an OSS compiler)

Powerful Two-Hander
Mar 10, 2004

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


Powerful Two-Hander posted:

i just got asked why nothing was updating following an ajax call, they had not even thought to check whether the call succeeded or what the expected result was (nothing) or if it was returning an error.

i can see a big pile of "http request antiforgery validation failed" errors logged and in the js they are executing they have commented out the addition of the antiforgery token to the posted data. i wonder what the problem could possibly be......

trip report: ~2 hours later they realised that this was the problem. not sure if it was by random "comment and uncomment code until it works" or by following my hints to check the logs and look for any exceptions

if they'd just looked at the globals file they'd see that all Http exceptions are automatically logged before being rethrown to catch this exact sort of "I'm getting a failure before I hit my controller" problem. who knows, maybe they've learned something...

Luigi Thirty
Apr 30, 2006

Emergency confection port.

https://twitter.com/OpenBSD_ports/status/1118603848593993729

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

webass

CPColin
Sep 9, 2003

Big ol' smile.
code:
// In a Grails service
res = res.sort { r -> 
    // add "inverse timestamp" to beginning to sort by most recently accessed
    // 13 digits in System.currentTimeMillis() is year ~2286
    String.format("%015d", System.currentTimeMillis() - (r.lastAccessed?.getTime() ?: 0)) + r.name
}
That's certainly an interesting way to sort by access time descending, then name ascending. But wait, why isn't the page showing results in that order?
code:
<%-- In a Grails GSP file --%>
<g:each in="${items.sort { (it.hasChildren() ? '000-' : '001-') + it.name }}">
Right, of course. The only page that calls the above code re-sorts the data it returns.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Luigi Thirty posted:

I meant just writing an interpreter that compiles to version 3 Z-code based on the specs that exist

I know that Z-machine’s been reversed for years, ZIL hasn’t (there’s an OSS compiler)

doesn't inform 6 compile zil code? i was under the impression that it worked with the original source for zork

pseudorandom name
May 6, 2007

the Infocom source dump claims that the compiler for that source no longer exists

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

pseudorandom name posted:

the Infocom source dump claims that the compiler for that source no longer exists

not the original compiler, but i thought inform was (mostly) compatible

Soricidus
Oct 21, 2010
freedom-hating statist shill

necrotic posted:

I am a 10xer and therefore right 10x fewer bugs

poo poo there's a bug in that sentence.

how unambitious. I’m a 10000x programmer :smug:

x = 0

Qtotonibudinibudet
Nov 7, 2011



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

gonadic io posted:

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

plz stop insulting the very good and enlightened way that lua works by default. lol if you're shameful languages doesn't automatically yield null when accessing an undefined variable

Bloody
Mar 3, 2013

I'm a log10(x) programmer

redleader
Aug 18, 2005

Engage according to operational parameters

Bloody posted:

I'm a log10(x) programmer

where effort ∝ log10(figgies)

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
It's a mystery, maybe the sqlite developers have no idea what they are doing, because Rust is the successor to these defunct C/C++ languages in every regard. Rust compiler has much better and forced auto-update-enhancement with a 6-8 month dev cycle that breaks all code from previous versions when new ideologies roll around in the years to come: like Lambda calculus multi threading, goto-closure forloops, and Impotence mismatch disabling defunct structures like if and for, also Rust is plug and play with nosql ideologies such as MongoDB, which everyone agrees is much faster than traditional databases because of webscale enhancement libraries. Keep fighting the good fight and asking the real questions. You're a gentleman and a scholar.

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

redleader posted:

where effort ∝ log10(figgies)

Wait, log figgies is log log of the actual money

gonadic io
Feb 16, 2011

>>=

CRIP EATIN BREAD posted:

It's a mystery, maybe the sqlite developers have no idea what they are doing, because Rust is the successor to these defunct C/C++ languages in every regard. Rust compiler has much better and forced auto-update-enhancement with a 6-8 month dev cycle that breaks all code from previous versions when new ideologies roll around in the years to come: like Lambda calculus multi threading, goto-closure forloops, and Impotence mismatch disabling defunct structures like if and for, also Rust is plug and play with nosql ideologies such as MongoDB, which everyone agrees is much faster than traditional databases because of webscale enhancement libraries. Keep fighting the good fight and asking the real questions. You're a gentleman and a scholar.

lol somebody is sick of seeing this question
E: God told them not to

gonadic io fucked around with this message at 15:57 on Apr 18, 2019

Bloody
Mar 3, 2013

bob dobbs is dead posted:

Wait, log figgies is log log of the actual money

effort hardly ever changes. this checks out

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

someone give me more figgies

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
pretty sure effort actually goes down as figgies go up

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

Jabor posted:

pretty sure effort actually goes down as figgies go up

exponentially

MrMoo
Sep 14, 2000

Captain Foo posted:

someone give me more figgies

Invest in Pinterest IPO (PINS) today on NYSE, 500MM shares outstanding. Pricing currently $23.75, open around 11:30.

Been following all morning, the symbol still showing as *Paramount Life Ins Co Ark* for various terrible programmer reasons.

mystes
May 31, 2006

MrMoo posted:

Invest in Pinterest IPO (PINS) today on NYSE, 500MM shares outstanding. Pricing currently $23.75, open around 11:30.

Been following all morning, the symbol still showing as *Paramount Life Ins Co Ark* for various terrible programmer reasons.
My impression of pinterest years ago it was just companies trying to get free advertising through social media and there were no actual users, and it seemed like it only got less popular from that point. They're seriously having an IPO?

Slack Motherfucker
Aug 16, 2005



Pillbug

mystes posted:

My impression of pinterest years ago it was just companies trying to get free advertising through social media and there were no actual users, and it seemed like it only got less popular from that point. They're seriously having an IPO?

in my anecdotal / second hand experience pinterest is really big with women; my wife used it to plan our wedding and she told me tons of people use for that and more generally to create visual inspiration boards for stuff like fashion or events or whatever. as a bonus, people who make boards like that tend to be pretty interested in advertising about the topic of the board or the items that are featured.

The Fool
Oct 16, 2003


Slack Motherfucker posted:

in my anecdotal / second hand experience pinterest is really big with women; my wife used it to plan our wedding and she told me tons of people use for that and more generally to create visual inspiration boards for stuff like fashion or events or whatever. as a bonus, people who make boards like that tend to be pretty interested in advertising about the topic of the board or the items that are featured.

my anecdotal experience mirrors yours


Now we have two data points!

animist
Aug 28, 2018
(painting of a laptop)

cest n'est pas une turing machine

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

MrMoo posted:

Invest in Pinterest IPO (PINS) today on NYSE, 500MM shares outstanding. Pricing currently $23.75, open around 11:30.

Been following all morning, the symbol still showing as *Paramount Life Ins Co Ark* for various terrible programmer reasons.

Haven't all the tech IPOs been universally garbage though?

CPColin
Sep 9, 2003

Big ol' smile.

CPColin posted:

That's certainly an interesting way to sort by access time descending, then name ascending. But wait, why isn't the page showing results in that order?

Right, of course. The only page that calls the above code re-sorts the data it returns.

Bonus: Just got the classic "Comparison method violates its general contract!" error because the comparison repeatedly invokes System.currentTimeMillis() instead of just calling it once and reusing the value.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



The Fool posted:

my anecdotal experience mirrors yours


Now we have two data points!

three! my sister uses it for her arts/crafts stuff

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Krankenstyle posted:

three! my sister uses it for her arts/crafts stuff

four! one of my ex-gfs uses it to keep track of beauty products she likes

Powerful Two-Hander
Mar 10, 2004

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


I've been reading the terrible students thread and found this gem I'd like to share...

Solus M.D. posted:

Super long time no post! A couple of complaints/pieces of humor, one specific, one general. For background, I TA for a computer science course that's basically Software Engineering 101. Pretty much the entire class is teaching students about object oriented design principles and applications, using an object oriented language. We recently had a quiz about design and refactoring.

Question: How would you improve the design of (object-oriented program we gave them as basis for their class project)?

Student answer: "Stop using object oriented design and put all your code in one file"


one of us poor fuckers is going to have to deal with that poo poo irl! I already did when someone put an entire active directory search into the raw controller instead of a static function! It sucks!

HoboMan
Nov 4, 2010

aaaaaaand im fired

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

HoboMan posted:

aaaaaaand im fired

😔

FlapYoJacks
Feb 12, 2009

HoboMan posted:

aaaaaaand im fired

Don’t let a lovely company that doesn’t give you enough time to learn their architecture and processes bring you down. gently caress them and collect unemployment for a bit.

Powerful Two-Hander
Mar 10, 2004

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


HoboMan posted:

aaaaaaand im fired

that sucks

appropriate avatar though so that's a...plus?

edit: also it's basically the weekend so you can super drunk with no fear

Space Whale
Nov 6, 2014
So I'm facing a particular sort of horror right now, to the point that I must share it. But first, I will share some context.

Due to really loving hating contracting in all forms and wanting to learn first hand - also gaining valuable experience :yotj: - I didn't leave job with deadboss and lots of bullshit. The usual "one guy had it all in his head at a startup and he's gone for reasons" (☠) poo poo happened, but it wasn't just tech debt. Our deployments are a mess of half finished this and that with a tangle of dependencies that, if mapped, would look like a dream catcher or something.

Basically, we were dead but didn't know it yet.

So, now we have a huge moonshot of a deployment we're trying to do with some 18 interconnected (and BADLY architected - if it could be said to be at all) services with difference versions of what they in turn depend on including dlls that do calculations for "airplane poo poo" and it's stressing everyone out. On top of it, it was basically a man year of work done by, you guessed it, one guy who is so burned out he's starting to snap at people. We have a new manager who is trying to get a handle on it all but he's having to wrangle old attitudes in a way that respects why people are so defensive while also making a point of things like "We should know what depends on what and what goes where, and it should be written down."

So now, the coding horror:

We have a service that is given batches of calculations to do. It's a web service ran in IIS (.NET shop) that, I poo poo you not, spawns a thread for every request, and doesn't actually keep track of what it does with the thread. Also, for some things, like where we'd have to iterate over a family of things like settings or temperatures or whatever, more threads. Naturally, if we use small batches, poo poo's fine, if we send a big batch to it, it takes 90 minutes to complete it. This is the "job runner"

THEN IT GETS BETTER

Sometimes you go through a "service" that calls the job runner, and that service itself just spawns threads. So you have something spewing threads like a golf ball cut open making something else spew threads like a fake can of peanut brittle spewing spring snakes or whatever and it goes down periodically since it's just poo poo.

After I get buttmad over this I just go through both codebases and rip out the thread bullshit, check it in to a separate branch, and ask if we can just test this as part of our stupid rear end release, since this is a fundamental flaw I'm trying to fix. "Only if we have to, let's try to just change timeouts in config files!"

:q: THEN IT GETS BETTER!!!

The "service" has code that checks if the job runner is 500-ing or out of memory or in some way choking due to the thread spew. If it detects this is the case, it just waits, then tries again. But how does it check?

It "loops" over a try catch with a goto in the body of the catch. I repeat, it "loops" over a try catch with a goto in the body of the catch. It also uses the weirdest caching I've ever seen. I included it so y'all can see this poo poo.

code:
            RetryRequest:
            try
            {
                jsonResponse = serviceWorker.SendServiceRequest<GenerateAnalysisRequest, GenerateAnalysisResponse>(Config.JOBRUNNERServiceUrl, JsonRequest, "GenerateAnalysis", timeout, false);
                //Update server cache
            }
            catch (Exception ex)
            {
                //If failure is due to no capacity, loop back 10 times, unless the job has been made to fail by the calling job queue.

                if ((ex.Message.ToLower().Contains("timed out") ||
                    ex.Message.ToLower().Contains("outofmemory") ||
                    ex.Message.Contains("503") ||
                    ex.Message.Contains("504") ||
                    ex.Message.ToLower().Contains("responding")) && loopCount < Config.JobRunnerAnalysisServiceRetryCount)
                {
                    timeout = 5000; //reduce to 5 seconds on subsequent calls
                    loopCount = loopCount + 1;

                    //Wait a few seconds
                    new System.Threading.ManualResetEvent(false).WaitOne(ServiceContext.RunAnalysisInBackground ? Config.JobRunnerAnalysisServiceRetryWaitTimeQueued : Config.JobRunnerAnalysisServiceRetryWaitTimeDirect);
                    goto RetryRequest;
                }

               
            }

           //* WHY IS THIS HERE? WHY ARE WE USING THIS CACHE? This is a spacewhale comment *//
            HttpRuntime.Cache.Insert(
                $"{JsonRequest.JobId}_Analysis",
                jsonResponse,
                null,
                DateTime.UtcNow.AddMinutes(Config.MaxJobQueueTime >= Config.MaxJobDirectTime ? Config.MaxJobQueueTime : Config.MaxJobDirectTime),
                System.Web.Caching.Cache.NoSlidingExpiration,
                System.Web.Caching.CacheItemPriority.High,
                null);

            JOBLOLContext.LogWriter.WriteLogLine("Parallel web request duration: " + (DateTime.UtcNow - startDate).ToString(@"mm\:ss\.fff"));```
So, after this, a question for the knowing:

How does IIS "Scale" for you if you're on a multicore server and you get a lot of requests at the same time to a service. Does there exist multiple instances (as processes or whatever, please clarify my terminology here if I'm misusing it) of each controller that took the request in the service (or, well, whatever, what if it's asmx?) or is it queued up and one at a time is done? How WOULD you code things to take advantage of multiple cores?

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
as a person who knows nothing about c# but I have to use it for my job all the time, i make my webapi controller actions into async methods that return tasks and call await butt.peepeeAsync() in them. I don't do airplane related calculations in these async method though. I hope this is helpful and this response finds you well

Bloody
Mar 3, 2013

i have always assumed that whichever microsoft framework im using just magically handles it all for me

Space Whale
Nov 6, 2014

Bloody posted:

i have always assumed that whichever microsoft framework im using just magically handles it all for me

Basically it does from my reading but I'd rather talk to someone who knows and get a conversation started.


Flat Daddy posted:

as a person who knows nothing about c# but I have to use it for my job all the time, i make my webapi controller actions into async methods that return tasks and call await butt.peepeeAsync() in them. I don't do airplane related calculations in these async method though. I hope this is helpful and this response finds you well

We're flight planning poo poo, not in-flight. I'm still kinda mad at Boeing being ran by loving morons but that's another topic and not one I can speak to except through friends at Boeing.

I'm also still just in awe that we have, in production, try/catch/gotos.

Adbot
ADBOT LOVES YOU

Asleep Style
Oct 20, 2010

Space Whale posted:


:q: THEN IT GETS BETTER!!!


Great googly moogly

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