/dpt/ - Daily Programming Thread

Prev:What are you wasting your time on Any Forums

Attached: Shokuhou best girl .jpg (1000x1415, 623.86K)

Other urls found in this thread:

galileo.phys.virginia.edu/classes/551.jvn.fall01/primer.htm#intro
twitter.com/SFWRedditImages

I had a project that I needed to submit. sentiment analysis in Python but I haven't even scratched the surface. Maybe I'll just copy some pajeet's code from github.

repostin hopefully properly formatted this time

I need help of a protobuf wizard
I am trying to do something that I thought oneof would be right for, but I think maybe I didn't understand what it was doing
I need to be able to marshal/unmarshal a structure that looks something like
{
name: "stringname",
value: "stringvalue"
}

{
name: "intname",
value: 1234
}

I want a field that can take a string or an integer in place of a single field with a common name
I do not want a nested object, but it seems protobuf is expecting something like
{
name: "stringname",
value: { string_value: "stringvalue" }
}Get Captcha


do I have to use Any instead of oneof?
I only want it to be able to be a string or an integer, so Any seemed incorrect for this scenario

Can someone answer this little question for me? Please, just this one

Write pseudocode to display the contents of an array of 10 elements

>Get Captcha
what the FUCK

Attached: just.png (688x578, 31.67K)

You already received the answer.

I'm working on a touchscreen-enabled PoS system in Python.

Here is the relevant proto in question
Currently
message Value {
string name = 1;
oneof value {
string string_value = 2;
int32 int_value = 3;
}
}


I'm guessing I'll have to change it to
message Value {
string name = 1;
google.protobuf.Any value = 2;
}

Is there a way to do that so I can still maintain some level of type enforcement?

see

for each element in array
print element

> hey if the instructor didn't bother coming up with their own problem no reason to come up with your own solution

You can probably feed at this point 99% of your university exam questions and other tasks to a GPT and it will shit you out the correct answer.

Education as such is a scam; its only for networking and social environment you actually pay for.

Attached: 1655639894389.jpg (1080x910, 100.04K)

I wasted my time writing a downloader for Any Forums images in Haskell (picrel.)
I don't really see the point of programming in Haskell. Maybe I'm a brainlet, but it seems like you can't avoid doing most of your programming in the IO monad. Haskell is also full of warts, like records polluting your namespace, the Text versus String shit, and a large number of partial functions in the prelude. The stdlib is abysmal, and builds are painfully slow on new hardware.
But the Haskell version is ~1.6x faster than the Go version. I also found Haskell's concurrency support nice.

Attached: carbon (1).png (2048x5076, 1.34M)

>uses haskell for an i/o heavy problem
>you can't avoid doing most of your programming in the i/o monad
????

haskell is one of those langs you have to stay with for years and continually evolve how you use it.
As first year haskell is completely different than 5th year and so on. It does have its issues though, being a research lang. Which is probably why a lot of people rightfully use it as a C-like "foundation" lang, to build better iterations.

>being a research lang
That's what intrigues me about Haskell. I see that many features that are baked-into other programming languages (e.g., async/await) are implemented as libraries in Haskell. As a recovering Lisper, I think that's pretty cool. But it seems like you need to know uncommon things to be able to understand those implementations.

Working on the raytracing in one weekend books

Attached: Box.png (512x512, 369.78K)

>recovering lisper
why did you quit? another interesting language somewhat similar to lisp is FORTH (has lisp-like macros)
galileo.phys.virginia.edu/classes/551.jvn.fall01/primer.htm#intro

Any good resources for HTML/CSS or are the YouTube videos are good enough?

Haskell, and FP in general, on it's own isn't suited for "normal" application programming, IMO. That said, there are subsets of programs which FP is useful for, and just understanding it will make you a better programmer in general. Lots of procedural languages have a bit of a functional flavor nowadays, which you can use when needed, but not be forced into exclusively using pure functions, or exclusively immutable data, which can easily end up being hindrances.

async/await's implemented with a library in Nim as well. That's an impressive feat until you remember that async/await itself is radioactive garbage and not a good way to do anything but act as a waitgroup on a batch of http requests in client-side code.