/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/vhf/free-programming-books/blob/master/free-programming-books.md#android
learnopengl.com/
en.wikipedia.org/wiki/ANSI_C
twitter.com/SFWRedditVideos

I wanted to do a very dumbed down discord clone just has a learning experience, what libraries should I use? I know c, java, c++ and python

Working on permissions in my VOIP protocol.

Learning C via the best book but I turned the assignment around because here in superior Europe we use Celsius instead of Fahrenheit.

i will accept that you're a domain expert, however i feel that you haven't in any way been able to try disprove my base analysis of the economic incentives of the khronos group, and what have you.

>What are you working on, Sup Forums?
I'm making a reference counting garbage collector in C++ with multithread support

I have two classes working with each other. One the garbage collector class, one the abstracted primitive type. Constructor is set to increment its pointer in the garbage collector. Destructor is set to decrement its pointer. Assignment to another abstracted primitive type is set to decrement its previous pointer and increment its new pointer.

Garbage collector has a "new" function that makes the abstracted primitive type

I need this because multithread support is a bitch in C++

Anyone know any decent Android tutorials/books?

I'm trying to get into Android dev, but there's tons of confusing shit going on in Android.

You would parameterize the process type over what it returns.

Which programming language should I learn if I want to become a barista?

Haskell

github.com/vhf/free-programming-books/blob/master/free-programming-books.md#android

There's quite a few. Witch is the best to start off with?

Not that guy btw.

Sup Forums removed (You)s

here's the css to get them back

put this in your Sup Forums css
a.quotelink.ql-tracked:after {
content: " (You)";
}

how many languages do I have to know efficiently in order to evolve into wizardry?

11

Which*

And how would you prove that two such parameterized types are identical or not?

Functional programming thread:

In[1]:= f = "R", "b.py" -> "S", "c.txt" -> "R"|>;

In[2]:= Keys /@ GroupBy[f, Identity]

Out[2]= {a.txt, c.txt}, S -> {b.py}|>

Process(A) = Process(B) iff A = B

Really, a process is just a function anyways.

IN PYTHON FAGGOT

Android application to share info about cultural events. Right now I'm having trouble with connecting server to this app and uploading pictures with Android, because I have no idea how to do it.

It's my engineer thesis.

What networking library (Volley, Retrofit) do you use? Most of them support file upload.

Are you dense or just retarded?
> A = B
This is what's not possible in general (Rice's Theorem)

Of course coming up with a proof automatically is undecidable in general but the proofs don't have to be automatic.

>but the proofs don't have to be automatic.
Of course they do, otherwise you could only run a fixed set of processes (and even that would be an extremely tall task to manually provide proofs for all those, it would be practically infeasible for any non-trivial process).

Hence: Trying to encode process + input as a dependent type is undecidable.

It doesn't matter what the process is beyond its type. Even then, proving that two coinductive processes are identical/equivalent is possible with bisimulation or more generally function extensionality if the processes are just modelled as functions (which is how you can model coinductive data).

Fix your indentation, and write in ANSI C.

Urocza nazwa, zuchu.

I still don't understand what defines ANSI C.

Volley. I'm still figuring out how to store picked photo in some variable and send it to server.
D-dzięki. Mój promotor jest podobnego zdania.

#include
#include

int main()
{
int c;
float f;
printf("print c to f loop in for loop\n");
for (c=0; c

>It doesn't matter what the process is beyond its type
The value of a process very much depends on what it is.
> Even then, proving that two coinductive processes are identical/equivalent is possible with bisimulation or more generally function extensionality if the processes are just modelled as functions (which is how you can model coinductive data).
It's not possible in general (as in a general process with general input, which is what an OS would be loading and executing).

You can supply a path to the Intent you use to start the camera app. Use that path to write the body of the multipart/form-data request in Volley.

>as in a general process with general input, which is what an OS would be loading and executing
Why would this be the case? The processes would be precisely typed and you wouldn't even think of them as anything different from a regular term.

Functional programming thread:

Thank you, though I still don't understand what defines ANSI C.

>write in ANSI C
Why the fuck would you do this without a good reason?
C99 and C11 are both supported by the only relevant compilers, GCC and Clang, and they even default to C11.
They also add a lot of useful quality of life features, especially C99.

Limiting yourself to C89 is just fucking stupid.

not the same guy but here you go
foo = lambda f: (lambda y,g,i:y(y,g,i))(lambda y,g,i: g if len(i)==0 else (g.setdefault(i[0][1],[]).append(i[0][0]),y(y,g,i[1:]))[1],{},list(f.items()))

how did you do that?

only reason to target c90 is for garbage embedded compilers which is a surprisingly common c use case

Did that user indicate that he was writing for an embedded system with a shitty compiler?

Implementing raw audio streams in my decentralized TV protocol.

>garbage embedded
wew
we're talking about new levels of dealing with garbage

i wasn't correcting him, just stating what i feel was an important injection
not everything needs to be an argument

>raw audio streams
no compression? :O)

Threadly reminder

BLEGH

foo = lambda dict: {val : [key for key in dict.keys() if dict[key] == val] for val in set(dict.values())}

Other reason is supporting ancient platforms. Seems to be the reason why Vim still forbids ANSI C in their code base.

Not enough lambda.

>C89
Anything else is totally useless.

...

rate my clusterfuck

I'm reading learnopengl.com/ and experimenting with OpenGL and gamepad in Rust. Thanks to user, I realized I need to convert my raw colors from sRGB to get them right, it took me like 3 minutes to find a crate that does that. Documentation for Piston/Gfx definitely could be better, something other than simple API docs would be nice.

>i wasn't correcting him
You were pretty clearly trying to correct him. Even if that's not what you intended, that's how it came across.
>important injection
Why? It's extremely unlikely that he's targeting an embedded system, or will be in the near future.
>not everything needs to be an argument
If you're not going to defend what you say, why even say it at all?

I'm sure that someone new to C is targeting ancient platforms.
There are plenty of "modern" C programs that aren't fussed about ancient shit like mpv and wayland (off the top of my head) that use C99.
A don't think a lot of people have moved to C11 yet, because you still have distros like Ubuntu and Debian who ship ancient versions of GCC that don't have complete C11 support yet.

Just for testing. Opus is going to be the default format once everything works.

pls someone

wow i hope i will never have to work with you

> Rust

You may as well kill yourself now.

Don't worry, user, he's clearly a lifelong NEET.

>Opus is going to be the default format once everything works.
that's what i like to hear :3
what are you using for video compression?
h264 is probably the best bet right now due to hardware support but im excited for AV1

rust ain't bad though
i'd wait for couple more years before bringing it into production, but it doesn't seem half that bad for whats its trying to be, i.e. a modern c with more sensible semantics

>Goes on Sup Forums
>Doesn't expect an argument/debate
You're a fucking idiot.

Way too much syntax highlighting.

>he doesn't like his code to look like a bunch of skittles

this is a way brutal self own

I generally agree. Rust is very immature as a platform and finding libraries will be hard for several more years, but the language is quite good for what it tries to be. And you don't have to participate in the cancer that is Mozilla just because you use the language. They can get deported to the Moon for all I care, as long as more libraries are created.

en.wikipedia.org/wiki/ANSI_C

ANSI defines ANSI C

Many of those later standard libraries seem quite important? Does this mean I'll have to rewrite threads.h in my application just to want to use it while still being ANSI C?

>I'll have to rewrite threads.h
no, you use OS specific non-cross platform libraries. like a real man

threads.h is an optional C11 feature that doesn't have wide support yet.
C99 is the standard version that adds all of the interesting shit.

VP9 because of licensing and it is on par with h264

I look at rust, and it seems nice, and I want to try it again, but my first experience with it was so horrible I really don't.

Also, the Opus and VP9 is what WebM uses (at least the newer versions).

right, though?
its as if wasn't c was controlled by (now nokia) bell labs beyond a few nascent years,
and the the systems and near systems programming paradigm hadn't far evolved since the era of early unix.
the cpu has evolved quite a lot since 70s and you can't, while it is excellent by every mean, plug anymore holes in c, especially considering the shit standards adaption of even 17 year old standards.

I want to be my applications to be as portable as possible.

I guess my question still stands then.
So I have to basically copy and paste those libraries into my project just to be able to use them while still writing my code in C89?
Seems like a bit of a hassle.
What about sockets?

It does not get any more portable than ansi C

>I want my applications to be as portable as possible
What platforms are you going to be running on that prevent you from either using an external library or using #if macros?

i'm trying to write the normal version, but without success
def foo(dict):
d = {}
for val in set(dict.values()):
d[val] = [key for key in dict.keys() if dict[key] == val]
return d


how to write the line 4 in a normal way??

>copy and paste those libraries
That's not how it works. It requires the C standard library to have those functions implemented.
A lot of it is shit that the programmer generally can't do themselves, at least not portably.
>What about sockets?
Standard C does not have sockets.
Use POSIX C if you want that, as well as pthreads.

What is the difference in size between an XZ compressed raw audio stream and FLAC?

def foo(dict):
return {val : [key for key in dict.keys() if dict[key] == val] for val in set(dict.values())}


There's nothing abnormal about dictionary comprehensions.

yeah that was my first step

but how do i write in a normal way without list comprehensions?

Why don't you test it?

I've no idea, I just want my programs to be able to run on any platform. I think it's more of a revenge of not being able to run certain windows programs that I liked, even through wine.
OSS and portability is just very important to me.

I'm not sure what you meant by your first line, but I guess I'd rather use POSIX C then.

Why would you?

fuck you

i'll wait for someone to reply

lmao retard.

OH I know because the homework assignment said not to use them.

about to write a C++ library that reads from a certain file format and export relevant data from it as it is somewhat of a container format and I want to allow the user to specify things such as using SIMD for speedups and so on. What are some examples of some good well-designed libraries that you have used in C or C++ and what are some key practices I should take that makes you, the user, admire a libraries' interface.

Should the file be "mounted" and locked in or should the entire file just be loaded into memory? Should a prototype "visitor" object be used so the user just inherits from your ___visitor class and the entire file is just streamed in and calles the VisitFoo(...) VisitBar(...) functions of the user-provided visitor object?

Should there be some FooReader object that takes a "Foovisitor" object and reads/iterates the entire file once. Basically a callback system so it just reads through a file once with a minimal buffer and it runs these callbacks for the appropriate data type.

It's just going to Read and never write so I figure this would be a good way to organize things but how about configuring compile-time stuff? Template trait-types that configure the FooReader? This is a lot of questions at once so id rather ask "what minimal libraries are organized the best to you" so I can just collect reference.

Policy-based through templates, using the conventions of STL.

I'm not crazy, I swear, I'm just misunderstood.

>What are some examples of some good well-designed libraries that you have used in C or C++
FFmpeg

are you schizo?

is there a neater multi-platform way to do integer rotation.

Like some multiplatform _rotl

what the hell am i looking at
why is that video playing in a terminal?

Can I watch porno over ssh now?

Not him, but he's an user who posts here about his terminal emulator written in Rust.
He was going on about sixel support, which is a not-widely-supported way to draw images to terminals.

Not the insane kind.

Video being decoded with FFmpeg and encoded in true color sixels, then the terminal renders the sixels.

Profiled it a bit and it's being slow as fuck because I'm using Lanczos to do downscaling, like 40% of the time is spent in __sinf from libm.so.

Yes.