|
we finally got our own office
|
# ¿ Aug 10, 2018 12:38 |
|
|
# ¿ Sep 17, 2024 13:07 |
|
raminasi posted:The Art Of Unit Testing is really, really good i skimmed it. it's probably a decent introduction if you've never heard of unit testing at all. but otherwise, it's yet another loving unit testing book that tells me in excruciating detail how to test string parsers and arithmetic operations. yawn. assert.equals(two.plus(two), 4)? thanks dude, would never have figured out how to write that. wait, why are you talking to me about mocks and stubs and testing stubs against mocks now*? what do i need those things for? here's a real life scenario: products have VAT rates. those VAT rates can occasionally change over time, meaning both that a product can be moved to a different VAT rate, or that a VAT rate can be increased or decreased by a percentage point or two (let's keep it simple and say it's one VAT rate per product (it's not)). is there a unit testing book that will teach me how to structure an invoicing system in such a way that I can test that it won't apply the wrong VAT rate when an invoice is created, edited, modified, or duplicated, even if the VAT rate for a product changes at some point? (btw, at one point TAoUT literally shows a test that defines a mock, tells the mock what a certain method should return, then asserts that the method returns that value. no non-mock code appears in the test at all.)
|
# ¿ Aug 13, 2018 20:10 |
|
MononcQc posted:Can you define what you mean by "wrong rate", like basically the VAT should be denormalized and stored at the time of the invoice rather than mutating with the current rate the entire way through? Mostly. When you create an invoice, but haven't yet published it (= sent it to the client or other third parties), then every time you open it the VAT rates should update to the current values. Once you publish it, VAT rates are locked at the date of publication, so if you open it (you can still make some changes after publication, like adding notes) it shouldn't update the VAT rates anymore. But, if you make a duplicate of the invoice, it should act like a newly-created one, with up-to-date rates. Oh, and if you make a credit note from the invoice, the credit note has the current date but it must keep the old VAT rates. One can see that every sentence in the above paragraph can be expressed quite straightforwardly as a test or two, but if I've never tested anything more complicated than string parsers so far, I'm likely to make those tests brittle or vacuous or just way more work to write and maintain than they need to be. MononcQc posted:<stuff> Yes, I'd really love to see or read someone take this outline you've written and go through all the nitty-gritty details and complications that arise. How should the test invoices look like? Should it just use the current date, or fuzz values, or explicitly test 'dangerous' dates around New Year's (when invoice numbering resets)? Would it be a good idea to write a list of test invoices covering every corner case you can think of, and then share them between all tests? Customers can be set to 'VAT exempt', how do I set up the tests so they run for both exempt and non-exempt customers (and I don't want to read another loving "oh, you're testing the behavior of *two* classes, well technically it's an *integration* test now, sorry, this book is only for unit tests" evasion). quote:But yeah, having mostly finished writing a testing book, a big problem is that interesting tests require interesting codebases to demonstrate stuff, and having to introduce an interesting system just to test it after the fact is a hell of a lot of work (both for reader and author), and it's hard to make it interesting to the reader. You've got to dump a bunch of code going "this is not actually relevant to the lesson in this chapter but you have to go through it anyway, sorry!" See, this is exactly what I think a book should be *for*: a well structured tutorial that can afford to take the time to properly set up the stuff it's trying to teach. If it's complicated stuff and it takes a hundred pages to do it justice, then it takes a hundred pages, and critically, *only* a book can do that. I won't find it anywhere else, short of hiring an experienced engineer to do pair programming. If I wanted a bunch of rapid tutorials with simple examples that are more preoccupied with being interesting than useful, then I'd look for a series of articles on a blog, not a book. NihilCredo fucked around with this message at 09:44 on Aug 14, 2018 |
# ¿ Aug 14, 2018 09:40 |
|
MALE SHOEGAZE posted:no such thing works fine in starcraft 2 actually
|
# ¿ Aug 23, 2018 14:51 |
|
tinaun posted:with enough syntax you can make Result based error handling look like exceptions problem: writing "Ok(foo)" in a function that might fail is cumbersome, it would be much better to write "foo" and make you look at the signature to figure out that it's a Result solution: replace "Result<T, E>" with "T throws E" to trigger the above behaviour, also add a macro "throw!(foo)" which is obviously much shorter than "Err(foo)?"
|
# ¿ Aug 25, 2018 11:42 |
|
Spime Wrangler posted:my understanding is that is literally what happened having tangentially worked with the metrology world, i'm not *that* surprised. nothing quite like spending billions of dollars and tens of thousands of man-hours to write impressive-sounding certifications to prevent grocery stores from sneakily shaving off a 0.5% weight margin on apples, only to be foiled by an ordinary thumb i guess this is what always happens when you add modern tech to a centuries-old entrenched business environment
|
# ¿ Aug 29, 2018 11:39 |
|
redleader posted:low level langs are great for all the pearl-clutching about "ownership" they bring out. just let your gc take care of memory, and let finalizers take care of any other resources. ez and objectively, inarguably correct big big big disclaimer: don't forget to make your objs immutable, otherwise the ez correctness goes out of the window
|
# ¿ Sep 3, 2018 14:18 |
|
https://medium.com/@PaulDJohnston/serverless-best-practices-b3c97d551535 i see 3 possibilities a) this blag is awful b) ~~~serverless~~~ is awful c) both (a) and (b) honestly can't figure out which tho
|
# ¿ Sep 3, 2018 14:19 |
|
powershell has the right philosophy, unfortunately it also has a pretty ugly implementation
|
# ¿ Sep 5, 2018 05:48 |
|
Shaggar posted:powershell is c# hosed up by pseudo-linux script syntax. yeah, we have f# and c# script files (actually f# scripting predates powershell by a year), they're way better than pshell for writing scripts longer than two lines. all they really need is a decent sysdamin / web client / file munching library to be imported by default, and the c# / f# interpreters to be shipped by default with the runtime and imported into PATH by default pshell should have focused entirely on being a modern replacement for cmd.exe with a focus on discoverability (check), consistency (meh) and usability (bleah)
|
# ¿ Sep 5, 2018 15:13 |
|
mystes posted:Finding the total size of the most recent 5 files in powershell and turtle (admittedly I suck at haskell so the haskell version is probably not the best solution). for comparison, this is its cousin f# interactive: quote:> open System.IO;; and c# interactive quote:> using System.IO; sure would be nice if we didn't need the boilerplate imports or the double semicolons, and had a few basic aliases like ls and run oh, and didn't need to pay attention to case NihilCredo fucked around with this message at 15:48 on Sep 6, 2018 |
# ¿ Sep 6, 2018 15:30 |
|
mystes posted:Oh another haskell thing: there's a new "Simple GHC (Haskell) Integration" plugin for vscode that has no dependencies (it just uses ghc). It's a little bit buggy but I can at least get it to work mostly which is more than I can say about the older pugins that use intero, etc. i deactivated every haskell plugin i had and activated that one. it does absolutely nothing for me, it doesn't even seem to recognize .hs files (they say 'Plain text' in the bottom right and when i searched the marketplace for extensions supporting it, simple ghc did not show up). adding the ghci folder to PATH didn't seem to help either
|
# ¿ Sep 6, 2018 17:34 |
|
mystes posted:I think you also need to have the haskell syntax highlighting plugin installed even though it isn't included as a dependency. installed that plugin, the syntax highlighting works but no type integration yet i'm in the folder of a stack project that builds (stack new HelloWorld yesod-sqlite). fake edit: ok, i found a 'GHC' entry under terminals where the following lines appear when I open a new .hs file: quote:-> :set prompt "" i'm guessing the hspec dependency is being a problem? any idea how i can fix that?
|
# ¿ Sep 6, 2018 18:02 |
|
mystes posted:I don't understand the haskell tooling well enough to say why this is happening, but it looks like you can fix this by forcing stack to get some additional dependencies: thank you! did you find the solution on google? after i fixed the hspec dep, it did indeed require yesod-test as well, but i hadn't posted that no type lens yet but at least errors and completions work
|
# ¿ Sep 6, 2018 19:03 |
|
HoboMan posted:my code as it stands Task.ContinueWith should be what you want
|
# ¿ Oct 11, 2018 23:07 |
|
c tp s: when i grow up i want to marry System.Collections.Concurrent.ConcurrentQueue<T>
|
# ¿ Oct 25, 2018 13:55 |
|
prisoner of waffles posted:attributes are guaranteed to have 0 or 1 cardinality and their order is insignificant tho xsd can enforce both requirements though, and xsd is one of the best reasons to use xml anyway without an xsd, an automatic checker can only tell you "i don't have the slightest clue which elements appear in this documents and which attributes they may or may not have, but by God you can rest assured none of them appear more than once" which isn't terribly useful with an xsd, it's a completely redundant feature that introduces an entirely parallel system of syntax/grammar/parsing/navigating NihilCredo fucked around with this message at 18:59 on Oct 25, 2018 |
# ¿ Oct 25, 2018 18:56 |
|
Kevin Mitnick P.E. posted:realistically, as someone who consumes XML, there are three cases case 2 means being able to say 'hey, we have objective evidence that the problem isn't on our side and it wasn't a case of miscommunication, it's *your* software that is not respecting the specs' which saves a crazy amount of time and therefore money
|
# ¿ Oct 25, 2018 19:38 |
|
Doom Mathematic posted:The problem is that just because a problem is objectively caused by someone else, doesn't mean that you're not the one who has to "fix" it. No, but it often means you can bill the time spent fixing it.
|
# ¿ Oct 25, 2018 21:37 |
|
white sauce posted:In java, what does this statement mean when you're creating a class? what part is giving you trouble? implementing an interface, having a generic interface, or the interface Comparable<T> specifically?
|
# ¿ Oct 28, 2018 21:00 |
|
cinci zoo sniper posted:i do recommend options other than postgre only to people who don’t need rdbms recommendations can you rephrase cuz i'm tired and can't understand if you're saying postgres is the default or only for experts or what
|
# ¿ Oct 30, 2018 18:39 |
|
A Docker container does two basic things: 1) It isolates an application's filesystem calls and shows it a virtual filesystem with just whatever you put in the container 2) It isolates an application's network communication by acting like a proxy + reverse proxy towards the rest of the local network That's the core functionality as I see it. I think it's a useful way to grok how it differs from a VM (eg why you still need to putz with the host's kernel settings when running Elasticsearch in a container - a VM would have its own). The rest of the Docker ecosystem is """just""" support for building such containers in a manageable way (Dockerfiles which define Docker images which are instantiated into Docker containers) and for deploying, connecting and monitoring them. That ecosystem can get hilariously Rube Goldberg-esque when you have thousands of containers replicated on servers across the world, or when you read too much HackerNews and think you're running a Fortune 500 infrastructure from your basement.
|
# ¿ Dec 13, 2018 07:54 |
|
can i call myself an architect yet?code:
|
# ¿ Dec 18, 2018 16:50 |
|
animist posted:google cache invalidation. you'll thank me later oh i have that, it's called alt-f4
|
# ¿ Dec 18, 2018 17:04 |
|
for the sake of discussion, let's assume that we actually needed a complicated priority system (otherwise the whole thing is trivial as you noted) seems like the right approach would have been to separate the priority scoring from the actual job queue for the former, you can run that overly-complicated query at the READ UNCOMMITTED transaction isolation level so it doesn't acquire any locks. it's not displaying data to the customer or anything, so dirty reads aren't a problem then, with the job_id in hand from the query, you can set the isolation level back to highest make full use of every locking feature your database provides to actually update that job to "processing" status and ensure that it gets run one and only one time. you're only touching the job table at this point so it doesn't affect the rest of the program
|
# ¿ Dec 21, 2018 16:26 |
|
Powerful Two-Hander posted:that would leave open the case of "job got set to processing and never finished because it halted half way" though which yeah i guess you could solve via a time out or whatever or through a db transaction or something buutttt why not just have you queue read by a single process dispatcher that passes the jobs to workers that do the actual thing and write success when they're done using the job id directly ? when you set it to processing, also set a column with the unique ID of the dispatcher. if that ID is the same between restarts, then a dispatcher that crashes can pick up its own jobs when it restarts. failing that, have a way to get the IDs of all active dispatchers (can be just a time with last_seen time updated every minute) and treat as free any job marked as 'processing' by an absentee dispatcher Shaggar posted:read uncommitted (aka nolock) wont work for that since multiple processes performing the same query will get the same dirty data and then all attempt to pull the same row for processing. you need to use readpast and updlock which will read past locked rows and then lock only your row you intend to process. you use read uncommitted when selecting the job_id to process you use for update skip locked (or the mssql equivalent) when you actually update the job_id you found and set it to 'processing' if the update fails, you assume someone who read your same data beat you to the job and goto step 1. you may have to run the heavy query multiple times but this way you never actually locks the non-job queue tables
|
# ¿ Dec 21, 2018 17:00 |
|
cinci zoo sniper posted:eh, for testing maybe, for production im not a fan db.t2.xlarge or db.t2.2xlarge because they are postgresql 9.x. for you 10 is more or less needed, 11 is desired (which is only on rds preview right now i think) if you want to do partitions, rather than brin indexing. i think he's a perfect fit for https://www.timescale.com/how-it-works
|
# ¿ Dec 21, 2018 17:05 |
|
Shaggar posted:wouldn't this cause a race condition wrt the update? like if 2 processes have selected the same job id and then theres a delay between when one attempts to update and its selection of job id, you run the risk of the faster process successfully updating and committing before the later tries its update. so when the second does its update the first process's lock will be gone so the update will work. each dispatcherruns something like "update jobs set processing = true, owner = @my_id where job_id = @chosen_id and processing = false" I'm on phone so pretend i added the various id columns and skip locked clauses first dispatcher will see 1 row affected and do the job. second one will see 0 rows and go look for another chosen_id
|
# ¿ Dec 21, 2018 20:19 |
|
Shaggar posted:same. also they can then standardize on a .net runtime and every browser will ship with it and eventually javascript can be abandoned forget "every browser", just within msft it's gonna take a few more years for netcore to become a full replacement for netfx, and probably decades for it to become a full replacement for mono you'd think that ms buying xamarin would have put the pedal to the metal on bringing netcore to mobile and deprecating mono, instead mono is apparently getting indipendently developed even further with stuff like aot compilation which would have been a real nice addition to netcore
|
# ¿ Jan 16, 2019 13:54 |
|
CRIP EATIN BREAD posted:also make an AI that sends groups of enemies in a formation spelling out "YOSPOS", tia *spinning newspaper headline* TERRORISTS EVADE ECHELONSA USING SECRET "LOST TEMPLE" CHANNEL
|
# ¿ Jan 16, 2019 20:23 |
|
is there an idiomatic name for a two-way lookup data structure (i.e. a bijective function)? and/or a more clever design than a wrapper around two hashmaps, maybe
|
# ¿ Jan 17, 2019 11:56 |
|
"bimap" is a pretty good name, thanks
|
# ¿ Jan 17, 2019 14:58 |
|
Finster Dexter posted:saunas are supposed to be really good for you, too would one of those mil-spec ruggeredized laptops be able to work in a sauna? assuming you didn't do anything stressful like launching atom, ofc
|
# ¿ Jan 22, 2019 10:18 |
|
gonadic io posted:Can you use a docker container as a host for its own set of containers? One of the requirements is to be able to have a function of type Docker<Docker<Butt>> to Docker<Butt> https://hub.docker.com/_/docker
|
# ¿ Jan 29, 2019 15:32 |
|
hackbunny posted:a good deal of voip calls are routed through a 30000+ line C source file C code:
|
# ¿ Jan 30, 2019 22:27 |
|
maybe private speech is talking post-tax figures?
|
# ¿ Feb 1, 2019 15:49 |
|
that's great, but uh, what is the service you're selling, again?
|
# ¿ Feb 4, 2019 08:03 |
|
ts does some stupidly advanced compile-time magic that I'm not sure would be at all straightforward to map to a different runtime with a different representation of objects like look at this poo poo: https://www.typescriptlang.org/docs/handbook/advanced-types.html posted:Mapped types
|
# ¿ Feb 5, 2019 14:37 |
|
DELETE CASCADE posted:why does javascript, an interpreted language whose linkage model is "everything in one global scope as though it were a single file", have a build system hey you can totally skip the build system if you don't want compile-time checks or dependency management turns out those two things are kinda important for projects bigger than 'punch the monkey'
|
# ¿ Feb 6, 2019 19:36 |
|
|
# ¿ Sep 17, 2024 13:07 |
|
CRIP EATIN BREAD posted:that's basically what npm does, since it's copying a dependency to every project. and those dependencies can change between runs of "npm install" because the entire js ecosystem is a broke mess. nobody sane will claim that npm is good nobody honest will claim that it's "basically" the same as "manually maintaining every single dependency by copying and pasting js files around"
|
# ¿ Feb 6, 2019 21:11 |