/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

en.wikipedia.org/wiki/Zermelo–Fraenkel_set_theory#3._Axiom_schema_of_specification_(also_called_the_axiom_schema_of_separation_or_of_restricted_comprehension)
en.wikipedia.org/wiki/Axiom_schema_of_specification
stackoverflow.com/questions/563198/whats-the-most-efficent-way-to-calculate-where-two-line-segments-intersect
en.wikipedia.org/wiki/Chan's_algorithm
discord.gg/4TuhPhr
lmgtfy.com/?q=go current time millisecond
pastebin.com/dfKwAeQn
twitter.com/AnonBabble

fags are gay

This thread is pathetic. It is not about programming. It's just a bunch of computers illiterates and freshmen memeing about whatever they just learned.

A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.

The only real programming questions I have seen so far are from beginners(it's fine to be a beginner btw).

This entire site is shit and I don't know why anyone would regularly come here.

anyone who doesn't realize this is extra special

A set P contains a set Q if every element of Q is also an element of P.
Evidently, every element of P is also an element of P. Therefore P contains itself.

reply to this post or your mother will die

en.wikipedia.org/wiki/Zermelo–Fraenkel_set_theory#3._Axiom_schema_of_specification_(also_called_the_axiom_schema_of_separation_or_of_restricted_comprehension)
You fucking retard.

not sure which one he meant so ill reply to both

...

>The only real programming questions I have seen so far are from beginners
That's because the vast majority of the people who post on here have no clue how to answer anything beyond first year CS student tier questions.

I need help from any programmers.

My boss has a database in mysql, I think he wants to integrate it into either a website design (html) or app in c#... he also wants it to be designed so that the database functions better, such as if a product is being created from raw material based of our inventory list, that it deducts from this material listing. Would is be better for it to be written in the SQL based on the database, or could I do it with html or c# using the information from the database based of mysql?

Any ideas on where to start. I really need this, I'm feeling so lost and I'm a complete noob trying to get by.

Some mathematicians call it the axiom schema of comprehension, although others use that term for unrestricted comprehension, discussed below.

Because restricting comprehension solved Russell's paradox, several mathematicians including Zermelo, Fraenkel, and Gödel considered it the most important axiom of set theory.[1]

en.wikipedia.org/wiki/Axiom_schema_of_specification

God I can't believe I'm wasting my time with this.

The axiom of comprehension you are talking about is not the same in ZFC.

>A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.
welcome to Sup Forums, enjoy your stay :^)

Use an ORM for C# that will generate all the SQL for you where necessary. Doing is SQL is always faster.

I know, I know. I haven't come here in months. I knew that doing it today was going to be a mistake.
Fuck.

...

Do you think mathematics and more specifically, set theory, has nothing to do with technology and programming? Are you special?

So sets are one-dimensional?
Also, I thought the term "subset" was used, in which case it makes sense that a set is a subset of itself.
What I thought was that the set was inside itself.

too much maths for the average dptard

Actually, since you have the exact points AB which form a line, it would probably be simpler to calculate the intersection points of each line to form a corner lel
stackoverflow.com/questions/563198/whats-the-most-efficent-way-to-calculate-where-two-line-segments-intersect

You still have to do some of the other crap to make sure that it's actually a closed shape, and it's still not reasonable to do anything other than a convex hull
In this method you'd use Chan's Algorithm to get the convex hull for the set of corners.
en.wikipedia.org/wiki/Chan's_algorithm

kd-trees are a reasonable choice if you're worried about memory usage.I'd just keep it stupid for now and just use a grid with lists of units. If memory becomes a concern then you can switch over to kd-trees. For video games on modern systems ram is cheap but pointer dereferences are not so cheap.

Sets do not have shells. They are just collections of things. Yes, a set is always a subset of itself.

When you encounter this kind of problem, where there seems to lie a contradiction, it is always useful to carefully re-read the definitions of everything you are dealing with. You can of course use wikipedia for that but wolfram alpha and encyclopediaofmath.org are also very useful.

This kind of foundational mathematics, for set theory is the foundation on which all modern math rests, is very important for computer science. Some people erroneously mistake it for "basic" and think they don't need to study or are ashamed to do so. This is a grave mistake, what makes a good computer scientist is good grasp of the foundations of mathematics.

Yeah, it's two different meanings of "contains" (as a subset or as an element). Took you a while to notice it.

>So sets are one-dimensional?
I don't think dimensions can be applied to sets like that.

Oh, shit. You're serious? I thought you were fucking with him. I remove my endorsement. You are also a brainlet

>two different meanings of "contains" (as a subset or as an element). Took you a while to notice it.
don't blame him
mathheads are retarded like that when it comes to sane naming

>Took you a while to notice it.
+1 smugness
This is why you deserved to be bullied as a kid, nerd.
Didn't seem to work well enough, though.

To make it more clear:
P = {1, 2, 3, 4}
Q = {1, 2, 3}
Q is a subset of p, since every element of Q is also an element of P.

Now:
T = {1, 2, {1, 2, 3, 4}}
Q is NOT a subset of T. Not every element of Q is an element of T, even though P is a *element* of T.

Elaborate.

It doesn't even matter, though. You're still fucking dumb if you think screeching "nuh uh! It doesn't make sense for a set to be an element of itself, because it's like, infinite, bro" is a mathematical proof of anything.

At least he didn't blindly accepted what he was being told.

If you look at his example:
>(1 2 3 (1 2 3 (1 2 3 (1 2 3 (1 2 3 (1 2 3 ...
Clearly he was talking about "contains" in the Russel's paradox sense, as in the set being an element of itself.

>You're still fucking dumb if you think [...]
Who said I did?
I'm just an unbiased bystander commenting on people falling into stereotypes.

so you get a 10000x10000 grid and your array alone will eat up a couple 100 megabytes?

>At least he didn't blindly accepted what he was being told.
It's actually much worse. Blindly trusting your math teacher is just naivete. Being unable to reason even when you try is plain stupidity.

Hey guys, can someone please help me figure out how to get a millisecond timestamp in go? I'm trying to use the binance API to get account details but I need to provide the current time in milliseconds.

Discord
Join
discord.gg/4TuhPhr

RAM's cheap bruh
>inb4 use a hashmap, dumbass

I wasn't part of the discussion at the point when this example was used. And this is not the Russell's paradox

>I wasn't part of the discussion at the point
Fair enough.

>And this is not the Russell's paradox
I didn't say it was. I said it's the same sense of "contains".

using linked lists when using an implicit grid doesnt sound like blazing speed to me

I see. In this case we use the word "belongs".

lmgtfy.com/?q=go current time millisecond
first result, no?

How large are these fucking maps? If your map is 80,000 space marines wide and tall, you're basically building an open world map and you'd be using a couple hundred megs for the tile data alone.

then why do that?
>doesnt sound like blazing speed to me
oblig: profiling often reveals surprising results

Honestly I woulda used arrays but I bet linked lists are actually faster if you use a custom allocator.

But how did you get linked list when I later mention
>ram is cheap but pointer dereferences are not so cheap.

/diversity quota/

preferred the one with the bulge teebeeheich

this might belong in sqt

in python how do i make something execute in a script right before return or break or whatever

I have a while true statement, when I break the script with ctrl+c I need it to clean some shit up before it fully returns is there a way to do this?

doesnt even really need to be that big. the cells need to be at a size that the most common AABB cant overlap more than 4 for max remove/insert speed and that you dont get hogged down by clustering. so if you have decent map size and small units you can get that kind of size

every cell bucked can hold multiple actors/ units. you need to store them somehow so why not link them together?

google 'python finally'

>not sure which one he meant so ill reply to both

Don't forget you're here forever.

try:
while True:
#things

except KeyboardInterrupt: #you can use "Exception" to catch anything.
print("traps are not gay")

return

post dragon dildo

I know.

important to note:
- except is for handling the exception
- finally is for doing shit regardless of whether an exception happens or not

just can't help yourself, can you
you like that, huh
just admit it

Damn, girl(male), programming socks on your arms and legs. I bet you hacked the CIA at least twice.

Yes, yes.
If you want to clean things regardless of whether the user interrupted or the program crashed it would be better to use finally instead of exception.

ty

It's my first time since October. I though I was recovering. This is hell.

>implying this gay programming socks shit is not a CIA psyop

don't feed the attention ho's
roasties get 'tits or gtfo'
traps, iunno, 'dildo up boipucci or gtfo'?

's like herpes, or sissy/BBC addiction
should be alright when taken care of, but will have outbreaks every once in a while

I setup a auto-recorder/scheduler thing with python that calls FFMPEG at a certain time.
Some shows are broadcast multiple times a day.
How would you prevent recording duplicates?
I mean, how would you. Not being lazy. I know how but I'm curious how anyone else would do it.

What I do right now is write to a text file and read it every time the program tries to record something.

>sissy/BBC addiction
I also relapsed on that today. And I'm not really into that, it's just the porn fucking my mind.

How is the schedule determined?

You're not going to create a 20,000 by 20,000 tile map. That's 400,000,000 tiles. If we say that a space marine is 1 tile, that's about the size of Kalimdor in vanilla wow. You won't approach anywhere near that size.

I still recommend the dumb solution before the smart one. Might not need to upgrade if you do.

will go with open hashed grid. that should do the trick

pastebin.com/dfKwAeQn

>if show['title'] in shows_to_get or show['title'] not in do_not_want:
Your whitelist is useless given this code, no?
Unless a show is in both the whitelist and the blacklist, but that's just sloppy.

It grabs the show I want, excludes shows I don't, grabs shows I don't know about.

Which simplifies to "grabs all shows except the ones in the blacklist", no?

...

Employed Haskell programmer here :)

field?

Burger flippung.

i'm writing a scraper with python that needs to put a string into a search bar on a certain website and return the result. I've been using the request module previously but that has been mostly to just fetch html and search it, never actually use site functions like a search bar.

does anyone know what i should use for such a task?

anything that can chuck the appropriate post method at the server
e.g. shell + httpie

Do it in your browser and look at the network monitor. requests can POST
it depends on what you're doing, though
if you want to interact with a bunch of javascript you might need to use something like headless firefox

i checked under network and found it uses a simple /&search=""

thanks!

I'm currently working on a redesign of my chatbot/assistant that I use for group messages in Signal and iMessage. It's currently written in python2 with MongoDB as a datastore.

I'm hoping to migrate it to Python3, with Cassandra as a datastore, and potentially have an internal web front-end that I can monitor logs/performance on, maybe even full-text search of conversations with elasticsearch at a later date.

I haven't ever done any async python though... Any recommendations for ways to do it? I was also considering doing the backend in Elixir, and spawning python workers to handle messages, but that might have to wait for v3, as I only know a little bit of Erlang.

I'm wanting this to be rock solid, as I plan on applying for an internship at Apple in the coming months (for summer 2019), and it's really the only project I have that is relevant to their ecosystem.

thanks in advance :)

c++ is the greatest language of all time

>this synthesizes correctly
if (in) begin
count = 0;
end else begin
count = 1;
end

>this doesn't
count = !in;


#verilog

I'm trying to emulate a finite-state machine in C using function pointers.
Each pointer function holds take a struct as the argument.
My problem is that different states use different data from the struct and the struct is getting quite large already.
I want to split the struct up into separate structs, but with the nature of function pointers, I would have to include the unnecessary structs in the function's parameters.

Here's an example of what I'm talking about.
typedef void state_fn(struct a_data *, struct b_data *, struct c_data *);
state_fn a_fn, b_fn, c_fn;
/*skip a bit*/
while(1)
fn_pt(struct a_data a, struct b_data b, struct c_data c);

where a_fn only uses a_data, b_fn only uses b_data, and so on.

It feels like I'm doing something wrong.
Should I worry about having to pass unused data even if it's by reference?

Technically impossible if you're not in a real-time operating system.

This begs the question of whether we can raise the bar somehow. Don't get me wrong, I like some aspects of the Sup Forums format but at the same time I know it rewards low effort posts and blatant shitposts. This is probably because everyone is user and there is no way to put anyone in their place for making really retarded posts.

I think that if /DPT/ had only quality posters, the thread would crawl to a halt, and if thats the case then its probably better to browse a traditional programming forum.

durrrrrr

Can you use unions? Also since when does a finite state machine have state outside of the machine state? The only mutable state of your program should be a single number or function pointer or something representing the state. Are you actually making a register machine emulator?

You aren't passing a large struct around, the struct's data is on the heap. Only the pointer is being put on the call stack, the cost of which does not scale with the size of the struct

You're assuming that people who make good posts don't also shitpost. I shitpost AND make good posts. Gotta keep it mixed up.

But in reality that user is probably the fag who was upset that dpt doesn't know set axioms very well.

if(a & 0x20)
a -= 0x20
How can I do this with the teranary operator( ?: )?

a -= a & 0x20 ? 0x20 : 0;

that's not very attractive though, please don't do it

This seems like a strange way to do it. I'd just do
a = a & (~0x20);

I don't see the problem with it.
I don't see why user would have a preference for the ternary operator here though.

hey crypto friend
I've added most of the manual trading features to my GDAX program
working on doing backtests for some trading strategies that it will use for automatic trading next

Duh! This just for my hobbist needs. Also, I shameless love obscurity. T. Hanks.

well, in the second case you're making it boolean i suppose, which is not what you do in the first snippet

i've defined it as a reg so i'd hope in either case it would only be assigned a value on edges. or maybe i'm misunderstanding you?

always block, part of debounce code in a cpld:
reg count;
always @ (posedge clk or posedge in) begin
if (in) begin
count = 0;
end else begin
count = 1;
end
end

>Muh nigga
This looks much better. Couldn't this be condensed to
a &= (~0x20)

I unironically find it aesthetically pleasing. The less redundancy, the better.