/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread: Functional programming thread:

Other urls found in this thread:

hero.handmade.network/episodes
twitter.com/AnonBabble

bitches delete this it's upside down

I see you didn't bother checking to see if there was another thread
Retard

Do people actually go the the functional programming thread?
I like the idea. It's more detached from most other programming.

I'm honestly not sure I follow.

Why would any of that need classes with objects?
Just make a module for it. $_POST whatever is needed, and then depending on certain POST criteria, switch between your modules and only load the modules related to the POSTed data.

if it's credit card info, name, etc. whatever, you would just need to send the (serialized if AJAX) array, ofc with some form of encryption, and... idk...
switch($_POST['PAGE_LOAD']){
case 'NEW_PAYMENT':
require_once('modules/paymentProcessor.php');
//and then other options
}
//This time, I didn't forget the brackets


I just see no need for classes in features like this

Don't change the OP format, idiot.
You don't need to link other stupid threads.

why this image every time
there are several images in the world

Check the last thread, it was good

Because it doesn't distract from discussion generally.
It's good to have a standard.
Like how Dwight is for /sqt/

last thread was way better than this one

A tech startup is difficult.

I have my plan and everything but what's the point?

Why not just generate revenue first then start a company?

Do I need something groundbreaking before finding investors like y-combinator?

To live comfortably I would need about 2.5 mil ad views per month which would be about 300k uniques. At that point whats even the point of seeking investors for seed?

>Just make a module for it.

The modules would need modules, and that maze would eventually become unwieldy.

OOP would be more elegant when you show orders to the user and to the fulfillment people, and to the auditing tools, etc.

OOP is scoped modules.

Imagine trying to process hundreds of orders in a loop with your modules. Global state? Side effects? It's an accident waiting to happen. Objects data-hide keeping scope clean.

Well. If you throw away others money you're risking less than when you throw away your own money.

investors == advertising

that's the mystery.

ycombinator doesn't give you a whole lot of money. it seems to be more about connections than anything else

A valid point. Fortunately it cost me 5 dollars a year for the domain, servers will scale, 100 ios dev fee.

200 a year isn't really harmful to a person funding theirself.

halp!

Working on a terminfo/termcap handling library for Rust.

The one available in the term crate doesn't even support extended capabilities, which makes it useless for anything modern.

in b4
>terminals
>modern

Sounds to me like it'd make sense to just not bother with funding and see if you run into troubles rather than worrying so much.

I'm sure investors would prefer to see a more mature project than an immature one either way.

I suppose that makes sense.

I mean, I WRITE PHP, but I'm not 100% sure how it operates under the hood.
Aren't POST requests handled procedurally, so even if a million came in at once, it still follows a FIFO processing structure?
In other words, as long as the array is the only data to be processed, how would it cross requests if they're not time-based?

Here's some progress on a little neural net I whipped up to play my simple console hurdle game. I'm using Encog and it's actually really straightforward.

The net is feedforward and is trained using resilient propogation. It's got three inputs (tiles until the nearest hurdle, tiles until the second nearest hurdle, " " third nearest hurdle), a hidden layer with two neurons, and two outputs (the preference for a long jump and the preference for a high jump). I also have a midair dash feature that's available in the regular version but I'll have to adjust the net in order to use it (right now it doesn't process the net to determine input when it's jumping).

Anybody worked on similar stuff before? I'm trying to optimize the design of my net. The ultimate goal is a simple RTS/Total War-style game in Unity that plays itself against hard-coded AI as well as against human players.

This is my experience with a lot of Rust libraries.

They're functional, but often pretty limited.

There are four /dpt/-related pictures: one with upside down girl and SICP, the same one but with K&R C, Ritsuko and Misato pictures.

at cursory glance, your makefile looks reasonable but you should add a default target

We need to host a technical blog and some guidelines, and possibly other documentation. Where is/are the best place/places for this?

Except winapi. That's a good one. Very complete.

Hi guys. On the phone, can't type much. Just here to say you are the best programming community outta here and the best subreddit of Sup Forums by far. Hope you all got a nice year programming wise. See you on christmas at midnight to exchange our cheers in our favorite programming language.

github lets you host static pages for free, you could also just make a wordpress

We're not on github, this is for private code.

to be clear: you don't want people outside of your organization to see any of this?

Yes.

Except winapi is just raw bindings to the Windows API, it doesn't implement anything by itself.

For all the COM interfaces he's implemented Deref for superclasses.

>best place
Some paid hosting service/self hosted
>free
Bitbucket has been ok in my experience.

That still falls under the same thing, it's just wrapping things up, it's not an implementation of anything.

It's on the same tier as the objc and friends crates.

Or nix.

It's still really thorough for something that hasn't been autogenerated.

So we've concluded SCIP as the only book to even mention procedural programming?
Someone need to get on writing a book.

I'll give you that, but we were talking about something else, something on the line "here's a mail parser, oh wait, you need to extract attachments? not done yet! (issue opened 8 months ago)".

But isn't structured programming is much about procedural programming?

That's definitely how most Rust libraries go.

Well its like if I were asking for OOP and you gave me procedural.

When I learned VB.NET after VB6, I felt no difference.

Y-y-you are nice too.

If I were to make a modem emulator, what should I take into consideration?

The noise it makes is really important.

I'd like to create a program for 8-bit microcontroller (AVR) to control the traffic lights for a T-junction with pedestrian crossing. I'm planning to use some LEDs as traffic lights and two pushbuttons.

How should I get started with it?

I currently have this shift register IC and some LEDs on the breadboard. It's just a test circuit to see if everything works. The microcontroller model is AT90S2313.

Guys, need a nickcame for my programming team

Name my C framework for TCP and UDP servers that can be used to make online chats, games, and so on.

Computer Wizards

Name it UGSP - Unprotected Gay Sex Protocol.

It's not a protocol though

It is now.

I didn't really know what I was looking for, I was looking for a static site generator. I'm going with Jekyll.

how do i prevent multiple people from opening up the same form and over writing each other with the data they input? i'm using php

That's pretty retarded my dude. You should be using reinforcement learning for this.

Use some sort of unique ID? What are you doing exactly? And why are you using PHP?

Give an example of how this would happen.

i'm over my mind

idk just decided on php/pdo. My app will be used by a small team to CRUD to a database. Each has their own computer. If person A opens one of the forms that will write to the DB and before they submit it person B opens up the same form and inputs data and submits, the db will keep only the data the last person entered. Hopefully i'm explaining clearly

idk thats why im asking

basically is there anyway i can "lock" the form from being submitted if the form is already opened by someone else? it's just a form in a new window/tab

Yes. Check and see if there is data in the database. If there is then print out "Form has already been submitted." Instead of the form.

the form populates data whens its opened and each user might change some of it if they have to, so i dont really know how checking if there's data or not would work. There's always some data.

So then you want people to be able to submit over other people submissions...

Oh..

Add column boolean "edit". Set true when form in focus or on document load, set false after submission or hitting cancel button. If edit is true then disable form inputs and say "someone is already editing this document."

Why would want to lock a row just for displaying a form?

If the person simply closes the window instead of clicking cancel the row will be locked forever.

print('{:b}'.format(5))[/code[

why does the number 101 appear?

i dont. I want to say something like "hey you have this form open and its order number 123, this order number is currently under edit, you can't save under this order number until the other user is done"

OR i was thinking if a user saves, then somehow the other user will see the form update immediately if they have it open?

b is binary
101 is 5 in binary
101 = 4 + 1

OH nevermind, :b was binary

excuse my retardism

>i dont. I want to say something like "hey you have this form open and its order number 123, this order number is currently under edit, you can't save under this order number until the other user is done"
That is bad practice. One user can lock the system. Save both changes and apply only the most recent one.

You may optionally offer a merge option for someone.

>OR i was thinking if a user saves, then somehow the other user will see the form update immediately if they have it open?
That is also bad practice. But you can do with JS.


Do you want to do a distributed document editing system? If so it's better to just use git.

yeah right now its set to only save the most recent one. I guess it's really tough to prevent. Even if 2 people are logged onto the same facebook account or something and they change their profile picture, the last persons will only count. I think...

>best programming community outta here and the best subreddit of Sup Forums
>subreddit of Sup Forums
>subreddit

Smcreate aan update column then with TIMESTAMP.

If x minutes passes then reset edit to false.

Your alternative is using sockets for live editing. You wont get much better solutions with PHP. Create it first, then solve the problems that arise like "what if they hit the x"

Now the user has only x minutes to edit the document. Which might be too long and still lock the row or too short and don't allow for editing properly.

>Your alternative is using sockets for live editing
Just timestamp each edit and use the later.

>Create it first, then solve the problems that arise like "what if they hit the x"
Stop posting.

Second part meant to (You)

lol im just gonna leave it as is. The chances of multiple users having the form opened for the same order number and updating that info are low. Just something I thought of that worried me a little bit

i've been learning python but also interested in game development. what lower-level language should i learn?

C. Ignore C++ fags. C++ is a disgrace. Your C code will still be compatible with C++ code and libraries.

CCCC
C
C
CCCC

C is awful for games because it has almost no abstraction and misses many libraries. Unless you're alright with starting from a very low level like Handmade Hero, C would be a terrible choice.

It would still be worse than C++, Rust, etc. if all you're using is C libraries.

C cannot use C++ libraries unless they have a C API.

hero.handmade.network/episodes

C++

>because it has almost no abstraction
Only if you're incapable of thinking outside the confines of OOP.
>and misses many libraries
You can write C code and compile it with a CPP compiler. Just use things like methods when you need it for one of the libraries you're using.

C has no:
templates
lambdas
overloading
type inference
To name a few things that aren't OO.

>C cannot use C++ libraries unless they have a C API.
Just use a search engine for fucks sake.

So?
If you had just those, and not the means of abstraction that C has, you'd be completely fucked.

Search engines magically allow C to call functions with C++ name mangling?

C has no means of abstraction that C++ lacks.

>templates
meme
>lambdas
slightly useful
>overloading
Just use an array.
>type inference
meme

>Search engines magically allow C to call functions with C++ name mangling?
Yes.

>C has no means of abstraction that C++ lacks.
C++ has nothing over C that is actually useful.

Sure. And I'm telling you that isn't anywhere near as big of a deal as you seem to think.

Also, nice tactical retreat. From "C has literally no abstraction" to "C has fewer means of abstraction than C++".

what about C#?

I said almost no abstraction. It has functions and opaque pointers and that's really it.

C# is not very low level but it is very good for gamedev using a framework like MonoGame.

>got a copy of K&R ANSI C
>struggling through the first chapter's exercises
it'll get easier right?

it's not cheating if I look up the answers from time to time if it helps me understand where I'm going wrong, right?

Never used it but if you want something more high level might as well use something more portable and that actually works well. Java.

C# is cancerous and OSGTP must be eliminated.

C# isn't really much lower level than Python.
That said, I do like it and the fact that microsoft is open sourcing a lot of it is encouraging.

Unity (scripted with C#) is a pretty good game engine for your purposes.

>it'll get easier right?
No.

>it's not cheating if I look up the answers from time to time if it helps me understand where I'm going wrong, right?
No, it's meant for people that already know how to program. Looking the solutions is probably the best way.

by "lower level" in i just mean lower than python, being a very high-level language.

sorry i'm not very knowledgeable.

thanks anons. so do you think C++ is necessary? i'm discounting C posters as trolling unless they are actually serious?

i do have a copy of the c programming language i have yet to read, so i cant say i havent thought about it

Depends on what your goal is. You can certainly make games in C#, but that's not C#'s primary domain. You want to learn C++ at some point if you are interested in professional game development.

C++ is better than C# if you're interested in making a game from "scratch" (i.e. platform APIs).