|
Pakistani Brad Pitt posted:Thanks for all of the very quick answers (and the detail, KillHour/Dominoes)! hashmap/dictionary with the face value as the key and the quantity remaining as the value. Objects only make sense if you're going to store information in them. The bill itself has no properties that you care about. Edit: Yes I know empty classes and structs are a thing but I'm trying to keep it simple. Double Edit: You might be thinking "But the bill does have a property - its value" and you could do that, but then you'd have to iterate through the entire array of bills every time you wanted to find one of a certain type. Which, I admit, is more true to the actual game, but it's really inefficient. KillHour fucked around with this message at 20:13 on May 25, 2020 |
# ? May 25, 2020 20:04 |
|
|
# ? Jun 1, 2024 15:44 |
|
Pakistani Brad Pitt posted:Thanks for all of the very quick answers (and the detail, KillHour/Dominoes)! Even in that case, rather that throw around bill objects, I would just make a MoneySupply object, with properties like num20, num100, etc. Then, you can write methods like totalMoney() or canMakeExactChange(). Then, give each player and the bank their own MoneySupply. The idea here is that all the code that cares about fiddling with money goes in the money class, and other classes only need to think about money in a broad sense. e: also, later, if you decide you need individual bill objects, you can just change the implementation of the MoneySupply class and not have to touch a bunch of different places. Dr. Stab fucked around with this message at 20:20 on May 25, 2020 |
# ? May 25, 2020 20:18 |
|
Dr. Stab posted:Even in that case, rather that throw around bill objects, I would just make a MoneySupply object, with properties like num20, num100, etc. Then, you can write methods like totalMoney() or canMakeExactChange(). Then, give each player and the bank their own MoneySupply. This is a good way to do it. You can also give MoneySupply a method to return the quantities of each bill for displaying on screen.
|
# ? May 25, 2020 20:22 |
|
Dr. Stab posted:Even in that case, rather that throw around bill objects, I would just make a MoneySupply object, with properties like num20, num100, etc. Then, you can write methods like totalMoney() or canMakeExactChange(). Then, give each player and the bank their own MoneySupply.
|
# ? May 25, 2020 20:59 |
|
Pakistani Brad Pitt posted:Thanks for all of the very quick answers (and the detail, KillHour/Dominoes)! Python code:
Dominoes fucked around with this message at 21:11 on May 25, 2020 |
# ? May 25, 2020 21:00 |
|
I'd use an enum if you got em because you get the lookup (Enum.values or whatever) and also the type safety (a hashmap can't guarantee it contains a given key, but you can always get a value from an enum instance)
|
# ? May 25, 2020 21:14 |
|
For make change, do y'all think we're looking at solving a linear system of equations? That's where I'd start, although you'd have to think about how you'd handle the under-constrained case, since this is what you'll hit most often. Depending on the language using, there may be a linear algebra lib that handles this concisely. Could use least squares as the closest match if unable to make exact change, or make it so you only overpay the bank, not under etc.
|
# ? May 25, 2020 21:30 |
|
The "optimal" strategy is to always take payment in solely one dollars until they run out, which is only limited by how much of a pain in the rear end it is to do that. Are you going to model the banker shifting bank money to their personal funds whenever they are called upon to make change?
|
# ? May 25, 2020 23:58 |
|
Jabor posted:The "optimal" strategy is to always take payment in solely one dollars until they run out, which is only limited by how much of a pain in the rear end it is to do that. Haha it’s a bad example, I just wanted to keep the analogy while broaching the concept of game pieces which are not unique (but are limited in quantity by the game rules). This has been helpful, thanks y’all.
|
# ? May 26, 2020 00:21 |
|
baka kaba posted:I'd use an enum if you got em because you get the lookup (Enum.values or whatever) and also the type safety (a hashmap can't guarantee it contains a given key, but you can always get a value from an enum instance)
|
# ? May 27, 2020 20:04 |
|
I agree with everybody that every note shouldn't be an object in this case but I want to commend you for having that thought. Most of the time, I'm dealing with new programmers that just want to cram everything into one giant function in a single file.
|
# ? May 28, 2020 01:44 |
|
When the OOP question came about, I was worried about the other side: Java or 90s C++ programmers trying to wrap everything in nested classes with private fields!
|
# ? May 28, 2020 01:47 |
|
surely we can use multiple inheritance more in this situation
|
# ? May 28, 2020 02:42 |
|
taqueso posted:surely we can use multiple inheritance more in this situation If you really think about it, a player is also kind of a house.
|
# ? May 28, 2020 02:56 |
|
Player 1 is a kind of player, which is a kind of money haver, which is a kind of thing haver, which is just another word for associative array.
|
# ? May 28, 2020 03:01 |
|
Please stop.
|
# ? May 28, 2020 03:13 |
|
We keep track of each bill individually:code:
|
# ? May 28, 2020 03:24 |
|
KillHour posted:If you really think about it, a player is also kind of a house. Both are just empty containers for garbage, just like my head and my career.
|
# ? May 28, 2020 05:02 |
|
Dominoes posted:Please stop. ever seen a typescript project featuring classes with seven levels of multiple inheritance, yet no type definitions, and all the private members of the class are typed "any"? i have. it's the only project i've seen that was actually made worse by the use of typescript.
|
# ? May 28, 2020 05:50 |
|
Rocko Bonaparte posted:Both are just empty containers for garbage, just like my head and my career. All encapsulated safely inside of you're posts
|
# ? May 28, 2020 07:06 |
|
Volmarias posted:All encapsulated safely inside of you're posts And that is what makes me a rock star developer!
|
# ? May 28, 2020 07:47 |
|
Bruegels Fuckbooks posted:ever seen a typescript project featuring classes with seven levels of multiple inheritance, yet no type definitions, and all the private members of the class are typed "any"? i have. it's the only project i've seen that was actually made worse by the use of typescript. I submitted a PR once to a Python dt library called Arrow to de-obfuscate excessive class wrappings. I think it involved classes existing solely for generating other classes. Didn't get anywhere. I later realized the library was pathologically designed from API to code. Turns out it based its API on an equally well-designed, and even more popular JS lib. Dominoes fucked around with this message at 14:30 on May 28, 2020 |
# ? May 28, 2020 14:26 |
|
Are there any US-based banks that provide an API where I can pull back my current balance amount
|
# ? May 28, 2020 22:24 |
|
Hadlock posted:Are there any US-based banks that provide an API where I can pull back my current balance amount Virtually all banks provide OFX Direct Connect protocol, but it seems to be described as "complex and archaic". Maybe you can piggyback off GnuCash or some other library/package though.
|
# ? May 28, 2020 22:26 |
|
On further inspection there's Plaid they have an API and the free tier would allow me to pull back the balance of one account, which is all I need Somewhat leery of handing my banking info over to a startup just to get my balance. Looks like Plaid is just literally screen scraping the website in most cases, which seems horribly inefficient but whatever Looking at gnucash they have support for it looks like us bank, most of the integrations are for bank's stock trading platforms, which I don't especially care about. US Bank ofers ofx support for $3.95/mo I think, based on the doco I saw
|
# ? May 28, 2020 22:56 |
|
Just curious if there's a dedicated machine learning thread in here. I scanned the thread titles and couldn't readily identify anything obvious. Or is all that sort of discussion happening in the Python thread?
|
# ? May 30, 2020 03:39 |
|
There are these two in SAL: #DataScience and Scientific/Math(s) Computing.
|
# ? May 30, 2020 12:41 |
|
Anyone here knows Visual Foxpro? I'm in a new position doing statistical stuff, and have to take over a bunch of Foxpro apps. I've been messing around with it, and there's already a bunch of puzzling things I can't find an answer to. For instance, the main irritating thing is that for some reason I can't instantiate a class into variables a to j. Doing this fails: code:
code:
Like what the gently caress? Also, any good resources to get up to date on this poo poo?
|
# ? May 30, 2020 22:00 |
|
"up to date" and "Visual Foxpro" don't really go together. Is there a reason why you can't switch to a technology that's been updated since 2007?
|
# ? May 30, 2020 22:11 |
|
My predecessor took over a bunch of Foxpro applications for statistical bullshit and pretty much stuck with it. He's now moving up in the department, I'm taking over that poo poo. The goal down the line is to start rewriting things in something modern. However meanwhile minor work is probably needed adding minute features to the existing stuff, and maintenance when IT is loving around with table and column names on their DB2 server. I don't even have a plan for how to proceed anyway. Been a while I actively coded. Since they're staying Microsoft centric (in regards to client computing anyway), I'm probably gonna go with C# and embedding a browser control to generate printable reports. Or some poo poo like that. Combat Pretzel fucked around with this message at 22:23 on May 30, 2020 |
# ? May 30, 2020 22:21 |
|
How do you go about converting random bits (like from a hardware RNG) into constrained results? For example if I want to randomly pick from [A-Za-z0-9] (62 values), using 6 bits of random data (64 values), do I have any options besides mod (which would bias the first two characters) or discarding out-of-range values (wasting muh precious entropy)?
|
# ? May 31, 2020 05:59 |
|
Visual FoxPro is just a warmed over version of FoxPro with some compatibility layer for running on Windows 2000 AFAIK FoxPro is the rebranding of something else, I think Microsoft bought them as part of their embrace extend extinghish campaign in the late 1990s. I worked at a place that put a foxpro system in place back in 1998 or so and even then it wasn't exactly cutting edge technology... good luck
|
# ? May 31, 2020 06:08 |
|
AgentCow007 posted:How do you go about converting random bits (like from a hardware RNG) into constrained results? For example if I want to randomly pick from [A-Za-z0-9] (62 values), using 6 bits of random data (64 values), do I have any options besides mod (which would bias the first two characters) or discarding out-of-range values (wasting muh precious entropy)? If you're just generating a single selection then not really, although the entropy in that case doesn't really matter. If you were really penny pinching then you can realize that if you got an out-of-range result, which of the two you got gives you back one bit of entropy. If you were generating a whole bunch of these then you could construct an elaborate scheme to harvest every bit of entropy from previous generations that didn't end up in the final value and use them to eventually use one fewer bit when generating a future value. It's almost certainly more work than just pulling the extra values from your source though.
|
# ? May 31, 2020 06:30 |
I've never taken a programming class since the days of Logowriter in grade school. I'm having trouble getting my brain around the syntax, logic, etc. of Powershell and JSON as they relate to Azure infrastructure-as-code. I can figure out how to get a Powershell cmdlet to do something, or how to sorta futz an existing ARM template to do what I need, but if it's anything more than that - e.g. adding an additional resource to an ARM template, properly nesting cmdlets in a script, etc., it just turns into me hurling copy/pasted code into something until it either works or I get frustrated, spend more time on it, and reach the point where I've spent too much time automating a task and I'm better off just doing it in the GUI. I was thinking of auditing a community college Intro to Computer Programs course since I learn really well in class environments, where there's feedback from a live teacher, someone to ask questions in real time, etc. The next offering my local CC has is in the fall semester, so I was wondering if there was a similar experience online somewhere. It doesn't have to be free, it doesn't have to be for credit, but it does need to have interaction between the faculty and students more than just emailing questions. e.g. something like a regularly scheduled chat session, Zoom call, etc. where people can work together and/or with the faculty. Does such a thing exist? I just need to start from the basics, how programming languages operate, how to turn a command and its switches into a proper script or program. It really needs to have that interpersonal part - I don't know enough of the basics to have the self-discipline to be able to learn from a book like I did when I was studying for Microsoft/VMware/Amazon exams.
|
|
# ? May 31, 2020 13:55 |
|
AgentCow007 posted:How do you go about converting random bits (like from a hardware RNG) into constrained results? For example if I want to randomly pick from [A-Za-z0-9] (62 values), using 6 bits of random data (64 values), do I have any options besides mod (which would bias the first two characters) or discarding out-of-range values (wasting muh precious entropy)? You are trying to construct a map from each of 64 possible inputs to one of 62 possible outputs. A simple application of the pigeonhole principle shows that you can’t do this without either (i) at least one output that multiple inputs map to, or (ii) some inputs that map to nothing. As you point out, doing (i) will bias the distribution of the output, so with a single input your only option is (ii) - if you get one of the unmapped values you throw it away and try again with a fresh rng call (this is known as ‘rejection sampling’) Alternatively you could do what the poster above suggested and consume additional inputs to generate a longer sequence of outputs - a quick calculation shows you’d need to consume 31 random 6-bit inputs to generate a sequence of 32 random symbols. The benefit of this is that you’re now making fewer calls per symbol to the (presumably expensive ) hardware rng. (Unless you’re doing something critical like generating cryptographic keys, worrying about ‘muh entropy’ is probably overthinking it and some flavour of prng will usually be fine for the vast majority of use cases )
|
# ? May 31, 2020 18:51 |
|
MJP posted:I've never taken a programming class since the days of Logowriter in grade school. I'm having trouble getting my brain around the syntax, logic, etc. of Powershell and JSON as they relate to Azure infrastructure-as-code. I can figure out how to get a Powershell cmdlet to do something, or how to sorta futz an existing ARM template to do what I need, but if it's anything more than that - e.g. adding an additional resource to an ARM template, properly nesting cmdlets in a script, etc., it just turns into me hurling copy/pasted code into something until it either works or I get frustrated, spend more time on it, and reach the point where I've spent too much time automating a task and I'm better off just doing it in the GUI.
|
# ? Jun 1, 2020 03:44 |
|
is there a free-standing open source product that handles event logging? I was thinking it would be nice if instead of a flat text log, we had a database type thing with customizable retention policies for various event types, etc. So we could do things like query by user, session, or the class that caused the exception, have it automatically purge low-level debug info after a week or two but hold onto errors longer, etc. Obviously would not be hard to build something like that with a regular old database and a log4j2 database appender but I seem to remember something like that existing off the shelf. Apache Kafka maybe?
|
# ? Jun 3, 2020 18:23 |
|
Take a look at OpenTelemetry.
|
# ? Jun 3, 2020 18:27 |
|
ultrafilter posted:Take a look at OpenTelemetry. Someone described this as the output of smooshing jaeger and... some competing open standard together, and it has a "driver" for Prometheus, is that about correct? Has anyone actually used this in prod yet? What were your experiences Looks interesting, and it's an official CNCF project, but seems new to me
|
# ? Jun 3, 2020 18:29 |
|
|
# ? Jun 1, 2024 15:44 |
|
Paul MaudDib posted:is there a free-standing open source product that handles event logging? I was thinking it would be nice if instead of a flat text log, we had a database type thing with customizable retention policies for various event types, etc. So we could do things like query by user, session, or the class that caused the exception, have it automatically purge low-level debug info after a week or two but hold onto errors longer, etc. This is the basic use case for an ELK stack
|
# ? Jun 3, 2020 22:55 |