/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1559697672898.jpg (829x1200, 151K)

Other urls found in this thread:

quora.com/Is-it-feasible-to-study-the-SICP-using-Clojure-instead-of-Scheme
raw.githubusercontent.com/matthiasgoergens/Div7/master/regex7
runestone.academy/runestone/static/thinkcspy/index.html
github.com/fdehau/tui-rs
github.com/yaronn/blessed-contrib
github.com/gizak/termui
en.wikipedia.org/wiki/Comparison_of_programming_languages
twitter.com/NSFWRedditImage

trying to sleep

Attached: 1494800626199.jpg (482x549, 57K)

Nth for Nim 1.0RC!

how do i learn c?
reading k&r and doing the book's exercises are not cutting it
i want to make something bigger than one fizzbuzz c file
a project with a header file and a makefile

Attached: +_a47acbb1f1e89f1faa66e791c0c28ba0.jpg (588x823, 75K)

dont learn C

I find it enjoyable to write programs that transform sensable data as a way of learning. For example, write a visualizer for your computers microphone, or write a digital audio synthesizer.

/* HTTP and websocket events. void *ev_data is described in a comment. */
#define MG_EV_HTTP_REQUEST 100 /* struct http_message * */
#define MG_EV_HTTP_REPLY 101 /* struct http_message * */
#define MG_EV_HTTP_CHUNK 102 /* struct http_message * */
#define MG_EV_SSI_CALL 105 /* char * */
#define MG_EV_SSI_CALL_CTX 106 /* struct mg_ssi_call_ctx * */

Why would someone possibly do this instead of using an enum?
Can you do the exercises in the book?

Is there anything worse than not being respected?

Someone says something wrong (like "C has classes"), I correct him, he says okay, then less than a minute later he repeats it again
Or people double guessing your opinion or your work, because ooo user said it, so it must be stupid and dumb

Attached: 1552446394823.jpg (634x457, 52K)

Did you remember to check all your code for places where you could use const? it's good for you

Pitch shifter

Haskell doesn't have this problem.

Respect is something you earn
Just correcting people won't get them to respect you

dont listen to C is the best language

Wrong, it's about good looks and not having autism

Autism and not knowing how to work with people go hand in hand, seems like he has a superiority complex too
I'm not surprised he feels that way after seeing his post
I have a friend who acts the same way and is diagnosed with autism

Lisp is the most powerful programming language.

Let stupid people be stupid. Only help people who want to be helped

>I realize this could be a bad question but I think I would get way better answers here than if I google.
See also quora.com/Is-it-feasible-to-study-the-SICP-using-Clojure-instead-of-Scheme

Why doesn't the whole string match?

Attached: 1556602282307.png (261x113, 4K)

Why would it? There is no c between b* and a

How do I compile GCC when I don't have GCC?

by hand

Oof, thanks. I've been looking at too much RegEx today.

That's a joke right?

nope, you translate the source code to machine code
you'll probably need a book

Is kivy any good? I want to make something that i can use cross platform

I want to get a moving average from a data stream that is an np array.
I'm using a solution I found online:
def running_mean(x, N):
cumsum = np.cumsum(np.insert(x, 0, 0))
return (cumsum[N:] - cumsum[:-N]) / float(N)

And then I call this function and throw a list in it, and the list is filled with values from the data stream. My issue here is that what is returned from the function is an ever-growing list of calculated moving avgs, like this:
[mov_avg_1]
[mov_avg_1 mov_avg_2]
mov_avg_1 mov_avg_2 mov_avg_3]

How do I clear it / prevent it from growing?

Attached: 1558576417538.jpg (682x533, 379K)

C is hell. Look at this diagram. Find C, made in 1972. Do you see all those languages made after it? People made those languages to avoid writing C.

Attached: programming languages timeline.png (4912x3050, 1.02M)

take the 10pt verdana pill

post favorite regex

>to avoid writing C
and yet most have the same syntax. The only reason why those languages exist is because they built off of C and added features to C. kys

raw.githubusercontent.com/matthiasgoergens/Div7/master/regex7

solved it by only sending the last N elements of the list into the running means function per calculation

Check out edx.org courses on C. I found them quite helpful.

Use Haskell and Lisp.

learn manners

your argument is tangential to the issue

what a beauty

C is the most powerful programming language.

i think you mean C++

>caring about normies

Use Lisp flavored erlang.

1. learn x86 assembly
2. replace the instructions with other """simpler""" code lines
Now you can C!

He just needs gcc's source

>COBOL stops in 1998
lol

git service, running into problems with there being no SSH lib for rust, and openssh not allowing me to let any user log on. Thinking about making a PAM module.

also no idea how to market my stuff :c

gcc is infected, you gotta write a compiler in ASM and then you will still run into issues with the processor being raped by the glow in the darks

this.

Reccomendations for just beginning to get into programming and have pretty much zero previous experience?

Preferably some kind of small video series or something. Have a harder time learning from books and shit.

>Preferably some kind of small video
Don't use videos.
>Have a harder time learning from books and shit.
Not gonna make it then

rip.

you should learn programming from a text, you'll be programming by writing after all

Well what book would you reccomend? I'll give it a go

>small video series
Videos are a waste of time.
>have a hard time learning from books
Better start now then.

Teaches python in an interactive manner.
runestone.academy/runestone/static/thinkcspy/index.html

and before I get any dumb questions:
no your first language doesn't matter.
by the time you get used to it and move on to a second and a third, they'll all start blending together and then you'll reach enlightenment.

I AM READING LDD3 HOW OUTDATED IS IT

thank you

What's the patrician choice for accurately describing a numerical dataset?

>no your first language doesn't matter.
good, i just looked up this language called Brainfuck. I think I start with that.

Stop being autistic. He probably meant C++ or C#

>looking back at old code you wrote
>wtf is this shit
>wtf is going on

accurate in what way? are you asking if you should use floating point?

Creating a good tui/gui purely from code is a pain. Anyone know of any good tui builders or frameworks to make this less miserable?? Any language is welcome

for web or desktop?

>desktop
I meant native

Desktop. Ideally a tui like ncurses or urwid

After a long time of being mostly a student, wageslave and also administrating some of my older projects, I've finally started to work on a new pet project.

It's a JRPG-combat-style RPG that is mostly item based. JRPG-style here means in each battle there will be two sides
with multiple characters facing off against each other (the right side being generally AI monsters).

I'm mostly done writing the central engine now, which has features like:

> "Stack based" state changes, allowing rollbacks to previous states. This is useful for letting AI explore multiple possible moves and pick the best one.
> Detecting when variables a particular effect used changed, so they only get recomputed as needed.
> It's easily programmable through a mix of markdown and JS, pic related (just an example file I use for testing).
> It can fully serialize its state, stack and computed modifiers. This allows for remote clients while the actual logic remains on a central server. I fully intend to implement multiplayer, both co-op and player vs. player.
> It precisely keeps track of which item/unit/effect influenced which variable, and it is easy to provide human-readable explanations of how a particular value came to be.
> It's pretty damn fast and able to compute thousands of effects in scenes with thousands of units and items within milliseconds.

Right now I'm mostly refactoring and cleaning up what I have so far while testing and benchmarking. Tomorrow I will start working on the actual game.

This likely means whipping up some basic browser page that talks to a server on which the engine and stuff is running. After that I need to get some basic account system up and running, as well storing player and character data somehow. Next is giving players pre-battle inventory management and some way to launch themselves into battle. Then I need a GUI to the engine - likely I'll just draw a scene on a HTML5 canvas based on the engine state, and animations based on what happened on the stack.

Attached: 5414.png (1918x1079, 187K)

These look pretty good.
github.com/fdehau/tui-rs Rust
github.com/yaronn/blessed-contrib Javascript
github.com/gizak/termui Go

What's a regular expression for determining if a string has the format of C function prototype?
e.g.
"type function_name(type arg1, type * arg2)"

Notice the *, pointers can also be part of it.

Some more example templates.

Note that stuff like "property.modify(...)" has different meaning depending on whether it's a verb or an effect.
In an effect it would be something temporary that is applied on the actual value, while in a verb it's something that is done to the base value (on the stack).

Attached: 5415.png (1917x1079, 150K)

You can't because it isn't regular grammar.

And the engine itself is just a few thousand lines of TypeScript.

Attached: 5418.png (1889x897, 147K)

If he meant C++ or C#, he should have said C++ or C#. C is a completely different language, which should be apparent to anyone who has used those languages.

Literal autism.

How could I train myself to solve problems in an effective way? I recently started coding and after learning about complexity and some other stuff, I feel like I'm a brute when it comes to solving simple stuff.

> Chart says "Appeals to a wide audience: C..."
> "People made those languages to avoid writing C."

Stop embarrassing yourself, retard.

Because clearly humans invented cars to avoid driving boats.

You absolute mongoloid.

Attached: animu slightly retarded smile.jpg (699x575, 34K)

cute, and actually something to be proud of, but don't misrepresent yourself

you're not writing an engine
you're writing a web framework for jrpgs
you have no experience with actual engine development topics like rendering, or low level concurrency
you're just handing it all off to some browser

en.wikipedia.org/wiki/Comparison_of_programming_languages
Daily remainder that if your language of choice isn't standardized (or only has a "de-facto" standard) then you probably shouldn't be using it.

an engine is whatever you want it to be

Wat. That engine is not even browser based. It's running in node right now.

Also nowhere did I say it is a graphics engine.

Not all engines have shit to do with rendering, graphics or even games.

Attached: 1399191625.jpg (400x400, 46K)

they invented cars to avoid driving with horses

To explain further:

I called it an engine because you plug in a lot of values (templates, instances, actions, etc.), then wait for it to come up with some results. Also it's inherently stateful.

Fits the definition of an engine quite well.

Somehow the fact that I was alluding to, that not all languages are even trying to solve the same problem as C must've gone straight over your head.

If they wanted to write C then they would have. Is this hard to grasp?

reasoning checks out

Very

>1983, 2005, 2012, ANSI, ISO, GOST 27831-88[7]

I win again

>learn programming to software dev and webdev
>parent keeps calling me a failure
>succeeded in making me feel like shit
I want to kill myself sometimes but then all this hard work would go to waste. Stay strong anons

When I'm going to do some low level shit or kernel development, I'm damn well gonna use C.

But I'm not gonna use C as a shell instead of bash or whatever.

Is it hard to grasp that some things are purpose-built?

You're probably retarded enough to roll to the beach in your fucking bagger, because shoveling sand with your hands is so last century.

Attached: 1447662237933.jpg (1920x1080, 816K)

imagine caring what your parents think of you in 2019

>When I'm going to do some low level shit or kernel development, I'm damn well gonna use C.
well that's dumb you should be using C++

C can do everything though. Why use anything else?

>C++

are you fucking mental

what's the standard for determining if something is standardized?

If there's an ISO standard I'd say.

>you have no experience with actual engine development topics like rendering, or low level concurrency

Also I kekked hard at this. Is this what it feels like when someone assumes your gender.

ISO, ECMA and ANSI are good in my book

I believe in you, user. You keep doing your thing.

Does having a standard serve any purpose before there are multiple compiler implementations?

What sepples features do you like the most?

Yes, to encourage development of more compilers and future-proofing the language.