/dpt/ Paily Throgramming Dread

What Satania you Satania on, /Satania/?

Old Satanina:

Attached: 72BEC746-FCF0-4772-B107-8E5CB972549D.jpg (468x468, 193K)

Other urls found in this thread:

androidhive.info/2014/06/android-streaming-live-camera-video-to-web-page/
pastebin.com/m35Txk90
pastebin.com/niXZTVHw
github.com/fyhertz/libstreaming
twitter.com/NSFWRedditImage

first for nim

Posting in incel thread

Attached: B4454612-77CA-4920-BF55-3CC5BFFFA69B.jpg (400x300, 22K)

3rd for C++

hooray, thanks again

Attached: 2019-05-04_04-57-41.webm (904x510, 554K)

That looks like some clean code, but you may be overdoing the comments

nah it's not mine, it's the example code provided, I was just testing the fmt lib
They're full of comments to show how their stuff works

Cute thread

Attached: 8B81306B-7DA3-4877-B3DC-5A4FA8DF6DA8.png (800x1131, 831K)

>What are you working on Jow Forums?
Still working on this android fuckery. Trying to encode camera data to h264 then send raw h264 packets over a tcp socket.

Found a way to get 24 callbacks a second from 15, which is cool. Still cannot get the video to play over the socket. I need to record the output to a file and analyze that but I am too lazy.

Attached: cam_server.png (1572x892, 118K)

are you turning your phone into an ip camera or something

Ya, it's a old phone, figured I might as well find some use for it. Thought of running it as some sort of server but with the built in camera it would make a nice IP camera.

I am looking to reinvent the wheel before you ask why I don't use an existing app.

Is it possible to read a programs entire address space including shared libraries in C? For example, if I wanted to hack a shared library at runtime, could I do this?

In Clojure, is it possible to get the source code for a user-defined function as data? source-fn only seems to work for core functions.

Attached: 1554785207726.jpg (560x542, 79K)

How long have you been on this project? I know technical difficulties can be a major roadblock sometimes... I've been stuck on issues for years sometimes. :/

androidhive.info/2014/06/android-streaming-live-camera-video-to-web-page/

how do i make a gui in java

(I accidentally posted this in /sqt/, lol.)

I'm doing an exercise in C to make a postfix calculator using an array as a stack. Basically you read the operands into the stack, then when you hit an operator your pop 'em out and do the arithmetic.

I've got + - and * just fine, but division is giving me trouble. Sure, I could load them up in another stack and then pop 'em back out again in the correct order for the / primitive to work, but I feel like there's got to be a better way. I googled for the math and saw some interesting stuff but not what I needed.

Isn't there some backwards way to do division? x / y = z but i'm reading y before x?

javafx

damnit, i forgot to post the picture I googled just for this question!

Attached: hwndu.png (1076x812, 496K)

Implement a swap operator that swaps the top two variables in the stack, a \ operator that is x/y = y\x, and then let / = swap \.

Are you making what's basically a Forth interpreter or am I misunderstanding? I don't see why you can't just do this how it is

About 4 days. I will probably try libstreaming, though.

Same. Like how does the ordering of the two variables matter. You still need to load the two variables somewhere, and you would just swap them to your preference when you lost the variables.

i dont understand why your interpreter has to read and operate on values in the order they are pushed

Oh shit, I just realized I was being retarded. I keep forgetting that I'm not reading the unmolested integers from a stack, I'm just using a stack to... uhm, I'm not sure. I kinda hate it when clever book writers abuse concepts just to try to get me to understand them.

This is a good idea. Unfortunately I don't think I need it anymore.

Well, because if I'm doing division they kinda gotta be in the right order.

OK folks, nothing to see here. Thanks for your help. It's kinda silly how much effort I put into trying to solve this non-existent problem.

Is this implementation of echo correct?
#include

int
main(int argc, char const *argv[])
{
for (int i = 1; i < argc; ++i) printf("%s ", argv[i]);
printf("\n");
return 0;
}

Attached: q.jpg (656x640, 231K)

Attached: ch2-samurai-divider.gif (400x330, 15K)

Is this golang?

For the non-NEET's: how do you guys find the passion to work on stuff outside your job? I can't be fucked these days. Maybe if I had a better imagination.

Yeah, if you don't count the abuse of UB.

There is no abuse of UB there.

If you aren't actually trying to fully implement echo, sure

Prove that your program does not have UB.

Like this user said
Fine for a very basic version that doesn't handle variable expansion, quote stripping or nested quotes.

It will print an extra space if there's one or more arguments

Why don't you point out the undefined behaviour you think is being abused? Also, I'm not even the poster.

Trailing space on the last argument.

>variable expansion, quote stripping or nested quotes
That is a feature of the shell, not a feature of echo.

>Why don't you point out the undefined behaviour you think is being abused?
The burden to prove that the program is a C program is on you.

That's not how burden of proof works.

Stop arguing with obvious trolls you retard

You're claiming that the program is an implementation of echo in C. So the burden of proof is on you to show that that source code defines a valid C program.

No, wait. I wasn't being retarded originally. I was being retarded in response the the confusion.

The problem is that I'm reading operands into a stack until I hit an operator. Then I pop the operands off the stack as i apply the operator. This is tricky to do with division. As in, like, you can't do division backwards. You can't subtract backwards either but that wasn't hard to figure out.

is basically right, but I don't think that this works if I have more than two operands. i guess i could make it work, but at that point i might as well resort to my initial idea of just using another stack to reverse them.

shit, guys, i'm tired. and i feel like i've been overusing /dpt/ today. sorry for my retardation. thanks for all your help. jah bless; we wuz.

>#include
>int main(int argc, char const argv[])
>C style for loop syntax
But it's totally not a C program

UB is not a syntactic property, but a semantic one. The burden of proof is on you to show that the source code is syntactically valid C and that the program it defines has no UB, thus making it a valid C program.

>Then I pop the operands off the stack as i apply the operator
So are you trying to do push(pop() / pop()) instead of int y = pop()
int x = pop()
push(x / y)? Because you really should be doing the latter. Why are you for some reason prohibited from using temporary variables? The values are getting copied into registers either way.

>The values are getting copied into registers either way.
I'm not using assembly though. I'm just allocating them onto the stack.

It doesn't matter if you're writing directly in assembly or not. The C compiler is going to copy them into registers so the CPU can actually operate on them. There's no reason for you to do this bullshit where they have to be read in the order that the C operator you're using takes them

STFU, you waste of oxygen. Unless you can prove where the UB is, you're just talking crap.

>copy them into registers
How is this even possible though without directly writing in machine code/assembly? I'm allocating them onto my C stack, not assembly's stack.

Wheee! pastebin.com/m35Txk90 hehe

You asked for help with a C program. It being a C program is a positive claim and entails having no UB, thus the burden of proof is on you to show that it has no UB.

UB can be system and OS dependent as well. It can only be completely mitigated by knowing what system you're gonna run your program on so you can account for it's particular quirks.

I've run into issues where certain built in functionality like fopen and fclose uses malloc/free on my Arch VM but doesn't do any memory allocation on other OSes so I end up with weird segfaults and memory leaks when I try to port my shit over.

Do you have any idea how computers work?

Should I give up on C? Is C a retard language?

You are the one who first asserted that it abuses UB, so the burden of proof is on you.

Good point. He should also specify his architecture and OS when he proves that his program has no UB with respect to his particular system.

Unless you're doing really low level systems or embedded work you'll get really sick of all the hacky niggerlicious bullshit you have to do in C just to get things done that are trivial in more modern languages.

Abusing UB is a negative claim, since "undefined" logically negates the entire expression. How did you learn C if you don't understand basic kid-level boolean logic?

Join the M$ masterrace of C#

If the book is covering the Shunting Algorithm for infix expression parsing then your stack may need to be records of symbol OR number. But if just calculating the operaters can be consumed immediately.

I don’t have a windows computer.

His program isn't abusing any common UB that I know of.

Yeah you could probably break it with trailing spaces or something but what do you expect from an echo implementation that's just a single for loop with no argument parsing?

A standard-compliant implementation only has UB where the standard does. That's the definition of UB (see what I did there?).

You're full of bullshit and you know it.

Is it true that C programmers need to abuse UB (at least on gcc) to even do simple stuff like adding two unsigned integers together? Does using UB make integer addition faster somehow?

Attached: 1556553138765.gif (170x170, 391K)

I already have a working solution. I could snip a lot of fat I feel like from the library later. I also need to figure out how to bypass some errors when trying to do 720p streaming, but I'll take a 30fps 640x480 rtsp stream.

Thanks a lot!

Attached: snip1.png (1118x892, 478K)

A lot of C is based on the calculated abuse of UB depending on the system.

UB often times isn't as random or nondeterministic as its name suggests and can end up being a shortcut in many cases.

C in general is hacks on top of hacks which is why it has a shit ton of security issues.

>A lot of C is based on the calculated abuse of UB depending on the system.

Umm... no. You're talking about implementation-defined behavior, which is an entirely different (and much better behaved) beast than undefined behavior.

What behaviors should I leave undefined in my language to fully reap the benefits of freeing my compiler to generate code with the greater speed that comes from abusing UB?

Attached: 1554592056040.png (310x320, 61K)

You can still write C# on linux although it isn't as simple.

And even then, the standard sets minimums that must be met.

Funny you mention it, this is what I finally landed on:

if (ch == '/') {
while (top > 1) {
int divisor = pop();
int numerator = pop();
push(numerator / divisor);
}
}

Problem is, you really can't do division with more than two operands. Order of operations FML. The only way is to reverse the stack and read it through doing / normally. As far as I can tell.

Who the fuck are you? Are you trying to be me? Who said anything about assembly?

Jesus, I really need to go to bed. I'm starting to hallucinate that there are people on 4-Chins trying to pretend their problems are mine.

>try to use regex in sepples
>end up wanting to an hero
this is the second time this has happened

Don't.

What the anons are talking about in this thread with UB in C is done out of necessity rather than good practice because it's a 40 year old language missing many modern features.

Not true. Most of the implementation defined shit is just UB that's common and repeatable enough to become convention.

There is still plenty of UB that really is random and always to be avoided but saying a program must have zero UB on any system to be valid is objectively wrong in the context of C.

Why not? Doesn't UB make languages faster?

I can't program for ass, every time I try, I just end up shitting numbers.

>you really can't do division with more than two operands
Of course not? If you want to do the infix 6 / (4 / 2), the equivalent postfix is 6 4 2 / /.
And why is there a while loop in your implementation?

Try targeting a better platform like windows or linux. Ass is as deader than Rust.

Oh, that's nice. Did you just whip that up? That's nice. I will work through this later, when I'm not so tired. Looks pretty, but employs lots of idioms I'm not yet real familiar with.

Here's mine so far:
pastebin.com/niXZTVHw

I think it mostly works, except division isn't right. The stack functions are all from the book, as per the exercise's instructions. I think they're pretty gay, but wut do I know.

Example of implementation-defined behavior:
> long may be 32-bit, but it may also be 64-bit

Example of undefined behavior:
> dereferencing an invalid pointer may literally bring Armageddon.

See the difference?

I've been told that Haskell is like the eye of sisters... and C was the angry as hell juice of first thing in the morning. What would Torvald think about this statement?

>And why is there a while loop in your implementation?
Because I was thinking the postfix for 8 / 4 / 2 would be 8 4 2 /. But I realize that's gay. You can't divide three things in a row like that. either it's (8/4)/2 or 8/(4/2). So in reality I only need to worry about two operands. Thanks for the insight.

>So in reality I only need to worry about two operands
I just read your code in , and saw that you've been implementing every operator as an n-ary stack-draining operator, which is not traditionally how this is done. Just like division, adding should be 1 2 3 + + or 1 2 + 3 +, which are equivalent.
1 2 3 + Should result in a stack containing 1 and 5. All of your binary operators should pop exactly two values off the stack.

+1 vote for Hillary Clinton, the best programmer on earth.

No, some of the UB is there because C lacks the runtime capabilities to deal with some types of errors. Other UB exists because the standard writers messed up or were just lazy.

I would rather torch a blood than program in Jquery. Everyone knows Pascal is king.

Moving the goalposts there but fine.

I'm not talking about things that are concretely defined by the system or C implementation.

I'm talking about certain quirks and bugs that are well known to manifest in certain ways on certain platforms and shit that's truly undefined.

burden of proof works however the true sceptic(TM) wants it to at the time

Woot, 720p works great once library was modified to disable some tests for newer phones. I can even get a high framerate which I couldn't do with any apps I downloaded before.

Attached: 720p_30fps.png (1282x847, 1.52M)

is this using your socket code or a off the shelf library?

Using a library that user-kun suggested. github.com/fyhertz/libstreaming

It seems like one big difference with this library versus what I was trying is that a local socket is used to trick the MediaRecorder into encoding the stream. RTSP is nice but I think I will end up stripping that away and trying to steal the MediaRecorder trick.

Attached: snip2.png (1257x847, 425K)

are you writing it yourself for learning purposes or to make something more efficient?

How do devs contribute to open source projects such as virtualbox and blender. I dont know what the fuck is going inside any big repo.

For conformity with my other devices, which sling raw h264 packets through TCP. I understand the appeal of using UDP for video data if there is enough time for out of sync packets to be synced back up. Over wifi I'd rather just send the packets through TCP.

Attached: snip_3.png (1062x876, 68K)

Just like with any other project. You start with easy tasks to get acquainted with the project. Usually there are issues marked as "good first issue" or "for beginner". Then gradually switch to more complex tasks.

Programming is all about telling fortunes in the end. ass, Just ask Santa.

Sup g, got a c++ data structures assignment and I can't get past running a depth first search on a directed graph. I'm able to do a breadth first search just fine, but the depth first search output is incorrect. I've tried many different things and they all have the same problem. It has the same numbers as the expected test output, but just the order is incorrect. For eg the test output is:

{ 13, 0, 4, 8, 10, 14, 15, 1, 5, 7, 11, 12, 16, 2, 3, 9, 6 } != { 13, 0, 2, 1, 4, 6, 5, 7, 3, 8, 11, 10, 12, 15, 14, 9, 16 } where the left side is my output vs the expected.

No matter what I do, sometimes the answer is marked correct, and other times it is incorrect like in the case above, based on the random test numbers used. Pic related is the code I have for the depth first search function. Note that the only difference between the function for depth first and breadth first is using a stack instead of a queue. Appreciate any help.

Attached: Capture.png (1495x694, 91K)

nibba just use recursion

Yeah tried that, but I keep getting segfault. I'll post up my implementation in a sec.

Here is how I've tried doing it recursively. This is pretty much exactly how they had it in the slides as pseudocode

Attached: Capture.png (1486x384, 58K)

They probably have a ton of experience professionally developing a similar commercials apps tbqh. One doesn't simply contribute to shit out of nowhere.

alright /dpt/
I really need money, like really bad
what's a good freelancing platform I could use?