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
brap
Aug 23, 2004

Grimey Drawer

Careful Drums posted:

so i need to make a dead simple api. it has only one endpoint, and the result is going to be a json object with a name and a date and a time. it will accomplish this by querying some database table full of datetimes and names and returning the next closest one in the future.

I would say .NET but I don't want to pay for azure for it. What is the most :effort: way to accomplish this with a p-lang? I was thinking Rails but idk.

if its honestly that simple who cares just pick the language you know and host it in my butt (the cloud). you can host .NET shits on not-azure.

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

GrumpyDoctor posted:

when did "api" start meaning "rest api"

Well "rest api" now means "api that returns JSON over HTTP"

Bloody
Mar 3, 2013

fleshweasel posted:

if its honestly that simple who cares just pick the language you know and host it in my butt (my butt). you can host .NET shits on not-azure.

you could, but why would you? azure is so staggeringly trivial

tef
May 30, 2004

-> some l-system crap ->

MononcQc posted:

Well "rest api" now means "api that returns JSON over HTTP"

same

Series DD Funding
Nov 25, 2014

by exmarx

Subjunctive posted:

writing lock-free code is for people who think doing exception safety in C++ was for casuals and make strict-aliasing jokes at dinner parties.

on basically every team I've ever managed, once performance work gets to a certain point someone will demand to jump down the rabbit hole in search of lock-free bliss. I've learned that there's nothing to be done but let them do it and pull them up when the tugs on the rope become frantic. (exception: deploying read-copy-update, if the stars align and you can meet the scheduler requirements without detonating the architecture of your code.)

go channels

Subjunctive
Sep 12, 2006

✨sparkle and shine✨


are they lock-free? I thought they were just a traditional message queue. neat.

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

Subjunctive posted:

are they lock-free? I thought they were just a traditional message queue. neat.

the whole point of go is concurrency so i dont know why you would think that

b0lt
Apr 29, 2005

necrotic posted:

the whole point of go is concurrency so i dont know why you would think that

lock free does not mean "you don't have to use mutexes directly in your code", it means a malicious thread scheduler can't stop the progress of your code

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

necrotic posted:

the whole point of go is concurrency so i dont know why you would think that

because you can have lots of concurrency without lock-free structures? why couldn't go's channels have a lock protecting the queue, with the channel flows racing freely other than manipulation of the queue itself? is there a semantic element to the channel model that requires lock-free implementation?

e: in fact, if I'm following this golang-dev thread correctly, they abandoned the lock-free implementation of channels because the complexity didn't pay for itself; that certainly matches my experience!

Subjunctive fucked around with this message at 11:34 on Nov 29, 2014

Captain Foo
May 11, 2004

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

b0lt posted:

lock free does not mean "you don't have to use mutexes directly in your code", it means a malicious thread scheduler can't stop the progress of your code

If the thread scheduler is malicious isn't your OS completely hosed and compromised anyway

pseudorandom name
May 6, 2007

I think that may be an obtuse way of saying that there is no time that the thread scheduler can halt one thread in order to cause all other threads to also halt

pseudorandom name
May 6, 2007

And that's just an obtuse way of saying there are no critical sections

Captain Foo
May 11, 2004

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

that is, no global locks? or am I confused

pseudorandom name
May 6, 2007

Or local locks.

You know, lock free.

Captain Foo
May 11, 2004

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

pseudorandom name posted:

Or local locks.

You know, lock free.

Ayy

pseudorandom name
May 6, 2007

Oh, I get what you're asking -- when I said "all other threads" I meant all other threads participating in your lock free algorithm, not all threads in general

Captain Foo
May 11, 2004

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

pseudorandom name posted:

Oh, I get what you're asking -- when I said "all other threads" I meant all other threads participating in your lock free algorithm, not all threads in general

I think I get it; though this is not my area of expertise at all

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

MononcQc posted:

Well "rest api" now means "api that returns JSON over HTTP"

tef
May 30, 2004

-> some l-system crap ->

MononcQc posted:

Well "rest api" now means "api that returns JSON over HTTP"

Same as agile means "ad-hoc planning of no particular structure"

tef
May 30, 2004

-> some l-system crap ->

necrotic posted:

the whole point of go is concurrency so i dont know why you would think that

locks are hard to get right, amusingly enough lock free code is even harder to write than locks

edit: https://view.officeapps.live.com/op/view.aspx?src=http://twvideo01.ubm-us.net/o1/vault/gdc09/slides/GDC09_Dawson_Lockless_Programming.ppt this is :toot:

sarehu
Apr 20, 2007

(call/cc call/cc)
I don't get how lock-free message queues could really help. If your thread's doing nothing, it's going to be waiting for a wake-up so you've got to do a system call anyway. If you're under load, the thread's doing a lot of stuff so you're probably not going to contend anyway (because you'd send messages in batches). And I think you'd use a spin-lock just under the principle of things.

Or is the idea of lock-free message queues that there's less latency under load (when sending messages across different threads, of course) because you're pushing messages to the other thread immediately instead of queuing them locally and sending them in a batch?

MrMoo
Sep 14, 2000

sarehu posted:

I don't get how lock-free message queues could really help. If your thread's doing nothing, it's going to be waiting for a wake-up so you've got to do a system call anyway. If you're under load, the thread's doing a lot of stuff so you're probably not going to contend anyway (because you'd send messages in batches). And I think you'd use a spin-lock just under the principle of things.

That sums up LMAX Disruptor pattern. The "common problem" of too many cores to use, so lets have some spinning waiting for a message.

I actually heard my boss suggest adding a verb to a REST interface so that "different things could be requested". Using directories or just the name of the item was too obvious apparently.

tef
May 30, 2004

-> some l-system crap ->
The simplest way to solve such a problem is to use a consensus algorithm such as Paxos or Raft, and this was the direction I was going to take. However implementing consensus algorithms is hard. Actually it is so hard that often years are needed for implementations to stabilize.

At some point I noticed something that makes the work of Redis Cluster nodes simpler, that is, information about hash slots is always idempotent. If hash slot 5 is served by A, and later because the configuration changes hash slot 5 is served by B, nodes don't need to know what happened, everything they need is that the configuration for an hash slot was updated.

This changes everything basically: agreement protocols are able to take a state machine synchronized by running the same sequence of operations in every node. If the state machine is deterministic, then the internal state will be the same in all the nodes eventually. However all the state Redis Cluster needs, for a given slot, can be embedded into a single packet.

Because of this we don't need a log of operations stored on disk, nor a way to make sure to fetch all the operations still not fetched, or to figure out what should be applied and what not, all the state can be copied in a single message. In short Redis Cluster does not require a full agreement protocol so I stolen just what I needed from Raft, and tried to figure out the rest.

tef
May 30, 2004

-> some l-system crap ->
- the simplest way is to use something that works
- but things that work are really hard to implement
- and these tested methods take a while to shake out edge cases

- so i copied what i could take and improvised the rest because who cares

suffix
Jul 27, 2013

Wheeee!
so redis is a perfectly adequate memcached alternative, and antirez is a better C programmer than i am, but drat he's adorable when he writes about distributed systems and persistence

MononcQc
May 29, 2007

goddamn it antirez, quorum systems and eventually consistent stuff don't have the same semantics at all :argh:

sarehu
Apr 20, 2007

(call/cc call/cc)

MrMoo posted:

That sums up LMAX Disruptor pattern. The "common problem" of too many cores to use, so lets have some spinning waiting for a message.

Oh, so it spins when idle instead of waiting for a pipe or eventfd notification? Or god forbid, a POSIX condition variable? Rad.

e: Incidentally back in barebones multi-core memcache persistence days of RethinkDB, we'd they'd get a 15% increase in throughput (just making up a number -- it was something between 10-50%) just by running some background processes, one per core, that spun in a while loop, which worked because it prevented the kernel from going into some kind of cpu-idle state.

sarehu fucked around with this message at 04:16 on Nov 30, 2014

Notorious b.s.d.
Jan 25, 2003

by Reene

sarehu posted:

e: Incidentally back in barebones multi-core memcache persistence days of RethinkDB, we'd they'd get a 15% increase in throughput (just making up a number -- it was something between 10-50%) just by running some background processes, one per core, that spun in a while loop, which worked because it prevented the kernel from going into some kind of cpu-idle state.

this is either a really, really serious kernel bug, or you were using ubuntu

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Notorious b.s.d. posted:

this is either a really, really serious kernel bug, or you were using ubuntu

we used to have the same issue doing JS benchmarking in the browser: the CPU would step down during load of the next phase, and screw up the numbers.

similarly, if the GPU stalls out the CPU in the Rift's rendering model, we can see step-down leading to the next frame being missed and things getting nauseating.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
wpf folks: i'm doing an app that has to output currency and i want to be able to change textbox formatting based on the currency selected.

my thought was to use a converter and somehow bind the combobox value (which is bound to a property in my viewmodel) where the user selects the currency to the window culture and pass that to the converter so i can get the correct currency symbol and put it in the textbox.

is this the right way to do it? if so, uh, how do i actually do it?

sarehu
Apr 20, 2007

(call/cc call/cc)

Blinkz0rz posted:

wpf folks: i'm doing an app that has to output currency and i want to be able to change textbox formatting based on the currency selected.

my thought was to use a converter and somehow bind the combobox value (which is bound to a property in my viewmodel) where the user selects the currency to the window culture and pass that to the converter so i can get the correct currency symbol and put it in the textbox.

is this the right way to do it? if so, uh, how do i actually do it?

Use Haskell.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

sarehu posted:

Use Haskell.

:2bong:

ahmeni
May 1, 2005

It's one continuous form where hardware and software function in perfect unison, creating a new generation of iPhone that's better by any measure.
Grimey Drawer
my coworkers have started up a lunchtime thing for us to learn us some Golang. im excite

Bloody
Mar 3, 2013

terrible way to waste your lunch time

sarehu
Apr 20, 2007

(call/cc call/cc)

Notorious b.s.d. posted:

this is either a really, really serious kernel bug, or you were using ubuntu

It was Ubuntu.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

sarehu posted:

RethinkDB, [...] we'd they'd

congrats

tef
May 30, 2004

-> some l-system crap ->

sarehu posted:

we'd they'd

sounds like you were having a poo poo time so congrats :toot:

raminasi
Jan 25, 2005

a last drink with no ice

Blinkz0rz posted:

wpf folks: i'm doing an app that has to output currency and i want to be able to change textbox formatting based on the currency selected.

my thought was to use a converter and somehow bind the combobox value (which is bound to a property in my viewmodel) where the user selects the currency to the window culture and pass that to the converter so i can get the correct currency symbol and put it in the textbox.

is this the right way to do it? if so, uh, how do i actually do it?

you could use an IMultiValueConverter to do it that way but this might be a question for the grey thread

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Was wondering why people were congratulating shrughes until I realized it wasn't shrughes.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

Suspicious Dish posted:

Was wondering why people were congratulating shrughes until I realized it wasn't shrughes.

http://forums.somethingawful.com/showthread.php?threadid=2773485&pagenumber=392&perpage=40#post426637272 :toot:

edit: fwiw i have been through too many terrible jobs which have broken me as a person, and i do not wish this upon other people, even if they're a more-rational-than-thou jerk

tef fucked around with this message at 04:42 on Dec 1, 2014

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