/dpt/ - Daily Programming Thread

What are you working on, mon frère?

Previous thread:

Other urls found in this thread:

youtube.com/watch?v=D7Sd8A6_fYU
dba.stackexchange.com/questions/134335/is-it-worth-making-a-separate-date-table-or-not
twitter.com/SFWRedditImages

first for indexed monads

Orthodox C++ > C > Modern C++

Working on a Reddit client thing in Rust...
eventually

what about indexed comonads

*coindexed

nani the fuck are you talking about

>orthodox sepples
The worst kind of faggots there is. They claim they write sepples like C but then they still end up abusing templates and all the new sepples features but in fucked up way.
C or just stop programming.

>every few hours refresh the github page
>see the star counter increment
that's all the endorphin i need

Today I made a C program that solves any triangle you give it as long as you input the bare minimum requirements to solve a triangle.
I am very happy with it, this is the 2nd program I made that left me satisfied.
Should be around 250 lines after I optimize it, there is something I did inefficiently.

speaking inner hasklel cabal tongues

Nice! Tell us your secret.

be very sad about your life so that even meaningless numbers give you a sense of fulfillment, even though you realize how empty it actually is

I don't care about your pathetic life. Tell us the art of shilling a project.

oh, i don't have any advice for that

As a programmer, how can you make money online? What can you do?

Write a bot which trades memecoins.

>tfw someone forked my toy language compiler repo

a few people forked my thing too, and i'm not really sure why. to keep a "local" copy, albeit an outdated one?

Shut the fuck up and answer seriously.

porting a shit from a shit to another shit
fixing various shit in the process of doing so

>answer seriously
>Sup Forums
lurk more faggot

Learning react-native. Playing around for fun, exploring an idea for a social outcast, r9k kind of dating app.

If i google it, all i get is some bullshit articles on how to do surveys.

I made... this?

A coworker of mine makes plenty of money with his bot. Enough to pay for his holidays at least.
IIRC the bot only trades in obscure coins. It buys when the coins are crashing and sells when the coins are rapidly rising. The bot basically rides the wave of coins getting boosted.

I think I got it in the wrong order. The bot buys when the coins are rapidly increasing in price and sells when they're crashing.

but how could you ever detect or predict a crash or price increase in time? it drops more than 1% and you sell? wouldn't you always be too late?

I heard you can get a really good job at a real trading firms if you find a way to figure that out with more than 65% accuracy

Correct, you're always too late. But you're still on time to make a small profit.

whats that

>Have task struct
>Need to append it to various task queues, such as those in a mutex
>Requires allocation, for the node
>can't allocate inside a mutex because that mutex could be a mutex inside the allocator itself, resulting in a deadlock if I called into it again
How the fuck does Linux do it? I looked at it's task struct and it uses something called a list_head, which is just a struct of two pointers (next, prev) but no fucking pointer to data? the fuck?
And it must have to kmalloc that list_head, there's nowhere else it could pull it from.

bots are faster than humans

sure, I get that, but bots respond to human trading. they can't predict the future, and they can't guarantee that a market dominated by both humans and bots will respond in a certain way. it's basically gambling by algorithm.

I mean, it sounds interesting. would love to see some stats on the success rate. but considering the fees you pay on most exchanges, you'd have to presumably trade a lot of volume to make it worthwhile

A fuckhuge amount of crooked lines being drawn in the Processing language which is bascially just
>Java

Trying out different programming libraries for "digital arts"

>and they can't guarantee that a market dominated by both humans and bots will respond in a certain way.
nor can humans
>it's basically gambling by algorithm.
yes, if your lucky
no, if you just respond to the market to either make a small profit, or decrease as much as possible your losses.

how would you design a relational db to store this dataset once every day?
what would be primary key?

I have no insight in the project, so I don't have any statistics. To be honest, I don't give a fuck about the cryptocurrency thing.
Trading with 1k USD should be enough to get you going.

use a timeseries db like kdb

just have an auto-increment id column as your primary key, then create a unique index on the combination of date+currency columns.

I'm stuck with MS SqlServer

I like that. So...

Columns: id, date, currency, rate

yes? and what would be the purpose of the date+currency combination?

How do people write C++ without exceptions?

Or rather, how is RAII possible without exceptions?

Simple. I don't write C++ and use a sane language like D.

Daily reminder that both exceptions and RAII are cancer.

The same question applies to D.
How is RAII (and the idea that if the object cannot be created the constructor should fail, thereby avoiding zombie objects) possible if the only way to create objects is with constructors and constructors are unable to return error codes?

You can't. Exceptions are baked deep into the standard library.
RAII is fuckton better than manual allocation

Stop harassing me.

>what would be the purpose of the date+currency combination?
a unique index will enforce the integrity, i.e. prevent more than one value being registered for a currency per day

it'll also speed up specific lookups, because it seems reasonable that you'll be wanting to ask "what was the value of currency X on day Y"

This is not related to the standard library.

I'm thinking of learning a language. What would Sup Forums suggest I learn? What makes good freelance work? Whats the future hold?

I was thinking Python.

Haskell

The C++ standard library is related to Programming in C++

Typed Racket

Racket

I said a language.

Python's a good choice. Simple to get started with and demand is quite high. I definitely recommend it.

Concering REQUEST ID's in a web server / client situation:

Should the client ever be able to determine it's own request ID? Request ID's are used for logging in my context, but if the client is allowed to determine it's own request ID, then malicious clients could potentially spoof their request ID.
The benefits of letting the client determine the request ID, is that you could potentially grab the logs and error message from the client, push it to a logging server, and then later when we analyze an error incident, we get the whole context of what the user did to produce the error.

In other words, the client cannot choose an arbitrary request ID. It would be necessary to base all request ID's on a common secret, that only the client and server knows, but it would also be necessary to not force this request ID to be unique every time.

Consider more concretely, a javascript front-end in a browser that's out on the open wide web. As far as I know (and I may be wrong) there's no way of achieving this.

Am I worrying about nothing, here?

Why do you like Haskell? Do you think its going to be in high demand or use in the future?

What appeals to you two about Racket?

They're memeing. You cannot build a career out of those languages.

Interesting. But what *is* this index? Is it a column of its own?

are we talking:
id | date | currency | datecurrency | rate

?

>What appeals to you two about Racket?
I have a wife and 10 concubine thanks to Racket.
I am the CTO of a big banking firm thanks to Racket.

I am one of user's buttboys and I can confirm this is true.

The most important lesson in client-server communication is always this: you can never trust the client in any way whatsoever.

If you have a shared secret, someone can still reverse-engineer the client to extract that secret. Additionally, the request ID could overlap if the client is in charge like you said.

The basic answer is this: There is no way to do anything safely if the client is in charge of anything. The only question you have to ask yourself how important that request ID is, and what practical concerns there are if they were badly formatted or duplicated (and what's the reasonable risk of a potential attacker even caring?).

...

An index can span multiple columns, so you don't need the separate "datecurrency" column.

...

Cool. Thanks for sharing your wisdom.

>Columns: id, date, currency, rate
>date not in a separate table
do you even normalization breh

Since it'll only be used for logging, at most it'll make things a pain in the ass for developers debugging production environments for errors that happened.

I don't think a potential attacker would really care about that. I wonder how protonmail does things.

t. never ran a db in production

t. premature optimizer
no sense in denormalizing if the perf ain't an issue mate

What's the best way to convert sepples to C?
If there's some inheritance hierarchy should I make big union with type field that covers all subclasses or something else?

>What's the best way to convert sepples to C?
realizing that there's no good reason to use C instead of C++
see also
youtube.com/watch?v=D7Sd8A6_fYU

I hope there's a good reason you have to do this, because there is no good way.

You could try nesting structs:
>Shape struct, has integers x and y for position
>Square struct, has Shape struct inside of it and additional members like side length
>to pass Square to functions that work on Shapes you just pass square->shape

i'm not an expert, but that's basically how I heard Jai does it (except much better)

By date I assume the guy means a timestamp.

Why the fuck would timestamps be in their own table? Are you literally retarded or something?

???

why? do you enjoy hurting yourself?
I hope you're trolling

use cfront or some modern alternative

>C on rise
>sepples declining
Seems like there's no reason to use sepples.

>javascript on rise
>sane language declining
>seems like there's no reason to not use javascript

Electron apps are a crime against the humanity. The amount electricity gets waste is way too much. People making and using this technology should be imprisoned for environmental destruction and never let out.

js is on same level as sepples on retardeness

remove all normalfags from programming desu. all the problems will be solved.

t. Cnile

because he thinks two rows might have the same date, but said he's going to store currency data once per day, so date could work as a primary key for that table

parroting SO, but "Normalizing "continuous" values, such as DATE, DATETIME, FLOAT, etc, is generally a mistake"
dba.stackexchange.com/questions/134335/is-it-worth-making-a-separate-date-table-or-not

Dynamic typelets BTFO forever.

While code autists are stuck in /dpt/ discussing how static typing is love and life, dynamic typing fags are out there in the world earning money hacking together some shit in javascript and python earning six figures in silicon valley.

This, seriously don't fucking create a Date table unless you have a very good reason to.

Yeah, I've never seen a real db normalizing datetimes. I guess user just finished a db class and saw it done in some "theory" book.

>six figures in silicon valley.
Hope they like dumpster diving for scraps.

It's a Sunday, of course I'm not working today. Dynamic typelets earning low six figures in silicon valley? Hahahaha, enjoy that absurdly high cost of living. Meanwhile static typists can command mid six figures in less expensive parts of the country.

lambda?
more like lambad

fuck you

was meant for

>optimizing a program that solves triangles

I'm trying to use unix domain sockets.
Process P1 binds the socket and spawn P2, P2 should just receive stuff from P1. What are the necessary steps to set up a socket on P2?
I can't find good tutorials and I'm too stupid to know what to do by just reading from documentations. What do?

Maybe he shouldn't have married a dumb cunt who spends all of his money. 160k is more than enough to live near the Bay area and work there even with a family.

set up a google cloud servers and use that to pipe data between processes using mongodb as a message queue

So all you have to do in order to not live in poverty on $160k in the Bay Area is to be forever alone? I dunno, that sounds kinda shit

Or just keep your finances separate and at most give your wife an allowance.