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
Bloody
Mar 3, 2013

cis autodrag posted:

so, uh, does anybody have any "do this programming interview question as a mumps horror" requests before i lose access to a mumps runtime forever? feeling bored :)

mumps interpreter in mumps

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Elysiume posted:

is this like a code golf thing where you try to write something in as few bytes as possible or is this just how mumps looks

its obtuse in purpose. i get off on really obtuse abuse of the x command. all the keywords can be written as one letter or full words but general style is to use the single letters since other mumps programmer cam read it.

raminasi
Jan 25, 2005

a last drink with no ice

Share Bear posted:

i both don't understand what problem it is solving (generic objects? not using interfaces?), nor the solution itself (PortletApplicationContext.HelpController1), mainly because I have never had to solve that problem

have you ever done a sort with a custom comparer

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

cis autodrag posted:

its obtuse in purpose. i get off on really obtuse abuse of the x command. all the keywords can be written as one letter or full words but general style is to use the single letters since other mumps programmer cam read it.

does it have to be the correct word, or just start with the letter?

Bloody
Mar 3, 2013


where did i do this as an interview question. dropbox?

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

leper khan posted:

does it have to be the correct word, or just start with the letter?

it's specific letters. here's a list:
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_COMMANDS

keep in mind that a bunch of those (like try and catch) aren't mumps but cache specific language extensions so a lot of shops dont use them for portability reasons.

for example the console print command is either "write" or "w" and also note that you can do that keywords are case insensitive. "x" is the "xecute" command, which as you might guess from my code snippet is akin to eval in p-langs. the @ operator you see in the second string is the indirection command, which substitutes the @varName for whatever code is in varName, so basically a different flavor of eval-ish behavior. each has its own quirks and in modern code it is generally frowned upon to use them unless there's no other way.

an example of a thing that is just stuck using @ is a job queue. a queue in mumps is just gonna b a 1-d b-tree with a list of jobs to run and since there's no such thing as a function pointer or the like, you'd do something like this for your queue:

code:
;This is some application code that needs to put something on the queue
thingToQueue() n args
	s args("arg1")=foo
	s args("arg2")=bar
	d stickInSomeQueueGlob("myJob^JOBROU",.args)
	q

stickInSomeQueueGlob(tag,args)
	n curNode
	s curNode=^QGLOB(0)+1
	s ^QGLOB(curNode,"tag")=tag
	m ^QGLOB(curNode,"args")=args
	q

;this tag gets run in a background process and grabs jobs from the queue each time it's called
nextJob()
	n curJob
	s curJob=^QGLOB("jobNum")+1
	;some voodoo to work out what parts of the args subscript go in what order in the job
	;this part's the secret sauce so i can't share. also sanitize args here
	n job
	s job=^QGLOB("tag")_"("_arg1_","_arg2_")"
	d @job
	q

this is for a queue that must do things one-at-a-time. if you're good with your queue spawning off more background jobs you can use the J(JOB) command to spawn it off instead.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Are you expected to do this on a white board or what?

VikingofRock
Aug 24, 2008




Wheany posted:

Are you expected to do this on a white board or what?

No idea. I've never actually had a programming interview, since I'm still in grad school (for astrophysics). Mostly I've just seen this problem because of this tweet https://mobile.twitter.com/paf31/status/805951805293088768 and its associated gist which are collectively very cool.

Soricidus
Oct 21, 2010
freedom-hating statist shill

VikingofRock posted:

No idea. I've never actually had a programming interview, since I'm still in grad school (for astrophysics). Mostly I've just seen this problem because of this tweet https://mobile.twitter.com/paf31/status/805951805293088768 and its associated gist which are collectively very cool.

VikingofRock posted:

No idea. I've never actually had a programming interview, since I'm still in grad school (for astrophysics). Mostly I've just seen this problem because of this tweet https://mobile.twitter.com/paf31/status/805951805293088768 and its associated gist which are collectively very cool.

nice seven-line "one liner"

Share Bear
Apr 27, 2004

Asymmetrikon posted:

all dependency injection is is "passing dependencies through the constructor/properties instead of constructing them inside the object." spring is a lot more than dependency injection, and you don't need a framework to do DI

e: also, DI often heavily relies on interfaces, so it definitely isn't about not using interfaces or generics

raminasi posted:

have you ever done a sort with a custom comparer

OK I understand the first part, the second part is "I'm not sure why you would do this versus declaring an interface", because I assume that anything that gets set as a dependency at runtime still has to adhere to an object type or interface

I get that it is like a lambda, but the object instance should still expect an interface which is defined, rather than just a function? Or that lambdas also have types and the type would be the object instance and that's it?

Shaggar
Apr 26, 2006
w/ spring you can intercept a call to a method on an interface and handle it with whatever code you want. so instead of an object that fully implements an interface, you could have an object for each method in the interface and spring creates a proxy that acts like the interface, but behind the scenes redirects to the object responsible for each method.

this is very useful for things like mybatis-spring which allows you to create a proxy for an interface that sends the method calls to a mybatis translation layer which calls a sql statement using the inputs of the method and then returns the results of the statement as the return type defined in the interface method.

raminasi
Jan 25, 2005

a last drink with no ice

Share Bear posted:

OK I understand the first part, the second part is "I'm not sure why you would do this versus declaring an interface", because I assume that anything that gets set as a dependency at runtime still has to adhere to an object type or interface

I get that it is like a lambda, but the object instance should still expect an interface which is defined, rather than just a function? Or that lambdas also have types and the type would be the object instance and that's it?

there's no "versus declaring an interface," capital letter DI as such relies heavily on interfaces. if a lambda is a single anonymous function, an interface is a named collection of one or more functions. and if you always want to pass the same set of functions in (outside of e.g. a testing environment) you do it at object construction. and if you don't want to do all the boilerplate yourself you do it with a framework.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Shaggar posted:

w/ spring you can intercept a call to a method on an interface and handle it with whatever code you want. so instead of an object that fully implements an interface, you could have an object for each method in the interface and spring creates a proxy that acts like the interface, but behind the scenes redirects to the object responsible for each method.

this is very useful for things like mybatis-spring which allows you to create a proxy for an interface that sends the method calls to a mybatis translation layer which calls a sql statement using the inputs of the method and then returns the results of the statement as the return type defined in the interface method.

tfw you refuse to just write a loving method

Arcsech
Aug 5, 2008

Share Bear posted:

OK I understand the first part, the second part is "I'm not sure why you would do this versus declaring an interface", because I assume that anything that gets set as a dependency at runtime still has to adhere to an object type or interface

I get that it is like a lambda, but the object instance should still expect an interface which is defined, rather than just a function? Or that lambdas also have types and the type would be the object instance and that's it?

dependency injection is just a piece of code that calls all your constructors for you

you write all of your constructors to take interfaces, then your DI thinger figures out whether you want a real Butt for your IFartable or a FakeButt IFartable depending on whether you're in your test harness or not

JawnV6
Jul 4, 2004

So hot ...

VikingofRock posted:

No idea. I've never actually had a programming interview, since I'm still in grad school (for astrophysics). Mostly I've just seen this problem because of this tweet https://mobile.twitter.com/paf31/status/805951805293088768 and its associated gist which are collectively very cool.
does this meet the one-pass option/requirement though? like how could you even tell

Shaggar
Apr 26, 2006

Cocoa Crispies posted:

tfw you refuse to just write a loving method

mybatis spring is great and one of the few legitimate uses of that kind of spring voodoo

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Shaggar posted:

mybatis spring is great and one of the few legitimate uses of that kind of spring voodoo

mybating furiously

VikingofRock
Aug 24, 2008




JawnV6 posted:

does this meet the one-pass option/requirement though? like how could you even tell

My understanding is that this passes over the list once, but builds up an O(N^2) structure of thunks to evaluate the maxes in each direction. So it's not particularly efficient, but it is a neat use of the Tardis monad.

Share Bear
Apr 27, 2004

Shaggar posted:

w/ spring you can intercept a call to a method on an interface and handle it with whatever code you want. so instead of an object that fully implements an interface, you could have an object for each method in the interface and spring creates a proxy that acts like the interface, but behind the scenes redirects to the object responsible for each method.

this is very useful for things like mybatis-spring which allows you to create a proxy for an interface that sends the method calls to a mybatis translation layer which calls a sql statement using the inputs of the method and then returns the results of the statement as the return type defined in the interface method.

raminasi posted:

there's no "versus declaring an interface," capital letter DI as such relies heavily on interfaces. if a lambda is a single anonymous function, an interface is a named collection of one or more functions. and if you always want to pass the same set of functions in (outside of e.g. a testing environment) you do it at object construction. and if you don't want to do all the boilerplate yourself you do it with a framework.

Arcsech posted:

dependency injection is just a piece of code that calls all your constructors for you

you write all of your constructors to take interfaces, then your DI thinger figures out whether you want a real Butt for your IFartable or a FakeButt IFartable depending on whether you're in your test harness or not


Thank you all very much for your assistance with my very terrible programmer question, it has been extremely helpful for understanding this mess.

Sapozhnik
Jan 2, 2005

Nap Ghost
downloaded vscode and am playing around with reactjs, redux, babel, polyfills and all that fun stuff.

how do you do, fellow kids

Shaggar
Apr 26, 2006
you can get full vs community for free too if you're using it for personal stuff.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

i have no words

they programmed a chemistry set programmable in brainfuck into space station 13

how the gently caress did they do that with BYOND???

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?

Luigi Thirty posted:

i have no words

they programmed a chemistry set programmable in brainfuck into space station 13

how the gently caress did they do that with BYOND???

my first thought on seeing that was to figure out a DSL in Lisp or Scheme that could generate said brainfuck

Luigi Thirty
Apr 30, 2006

Emergency confection port.

eschaton posted:

my first thought on seeing that was to figure out a DSL in Lisp or Scheme that could generate said brainfuck

new project: write a lisp in the lovely BYOND scripting language?

I found the source for the brainfuck interpreter in their github

Powerful Two-Hander
Mar 10, 2004

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


terrible programmers: the horror from BYOND

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
ctps:

quote:

com.mongodb.MongoQueryException: Query failed with error code 96 and error message 'Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.

web scale

Arcsech
Aug 5, 2008

MALE SHOEGAZE posted:

ctps:


web scale

we have run into this exact problem

our solution was just to fetch the entire collection into memory and sort it in java

god mongo is such a piece of poo poo

Shaggar
Apr 26, 2006
how would you ever use that much ram in your hobby project?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
no one will ever want to sort more than 32 megs of data

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
this error is occurring when attempting to sort less than 1000 things

Shaggar
Apr 26, 2006
lmao

Shaggar
Apr 26, 2006

Jabor posted:

no one will ever want to sort more than 32 megs of data

I thought about reading the number more carefully but decided against it

jony neuemonic
Nov 13, 2009

today i learned that sql server will straight up tell you if you're missing an index. microsoft is good.

JewKiller 3000
Nov 28, 2006

by Lowtax
sure, but instead you could pay nothing for postgres, and hire me to tell you when you need an index. then the money goes to me, instead of microsoft! my rate is half what you're paying them. it's win win folks

ThePeavstenator
Dec 18, 2012

:burger::burger::burger::burger::burger:

Establish the Buns

:burger::burger::burger::burger::burger:

jony neuemonic posted:

today i learned that sql server will straight up tell you if you're missing an index. microsoft is good.

SQL is so good already and MS SQL is basically the real-life equivalent of the joke about how the only way to improve it would be if it rubbed your nipples and gave you a blowjob.

ThePeavstenator fucked around with this message at 15:00 on Jun 22, 2017

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
my company is using dynamodb for an internal CRUD app (w/ very low perf need, just manual users) that just associates one kind of id to many of another kind of id. for the reverse of that lookup there's an offline process to generate a 2nd collection

the lead architect said dynamo is a good choice because then we don't have to manage the db

this is a company that runs a bunch of mssql instances in house already btw

FAT32 SHAMER
Aug 16, 2012



I was doing some googling and



so thanks thread!

Captain Foo
May 11, 2004

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

Luigi Thirty posted:

i have no words

they programmed a chemistry set programmable in brainfuck into space station 13

how the gently caress did they do that with BYOND???

fuckin lmao that is amazing

Mao Zedong Thot
Oct 16, 2008


Flat Daddy posted:

the lead architect said dynamo is a good choice because then we don't have to manage the db

this is true tho

all things in moderation of course, but if i can assign 'be in charge of stateful thing' to a money motivated team of experts that seems p dece for me suddenly not having to do that

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

are you cool if i use one of the solutions in the comments as a basis for starting the mumps version? with all these house showings i most def don't have time to solve it from scratch since it's not a problem i've done before.

  • Locked thread