/dpt/ - Daily Programming Thread

Old thread What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=rX0ItVEVjHc
youtube.com/playlist?list=PLAzGjvl9ybvcth67nXMmYqKhHmXwvKr7-
demonstrations.wolfram.com/AnEfficientTestForAPointToBeInAConvexPolygon/
github.com/ivanfratric/polypartition
ramiro.org/vis/hn-most-linked-books-unique-users/
twitter.com/AnonBabble

me too thanks

>he uses java

mine:
>11/27/16(Sun)09:23:29
you'res:
>11/27/16(Sun)09:28:55
sage

Doesn't matter you posted way before the bump limit. Also I posted first in the previous thread.

>no anime in OP
fuck off

>way before the bump limit.
No, I did not. Posted it at around ~305posts

GTFO you fat weeb

Bump limit is 310. Try again next time.

you didn't even link the thread fucktard

>le ebin drole

It's amazing how passionate you are about this. Kind of funny.

Has anyone here used Theano and/or other similar numerical computation libraries? I've been trying out Theano and it's been pretty great.

Automatic differentiation is awesome. Symbolic autodiff is just amazing.

Unemployed at the moment. Learning angular by rewriting an app. Putting off interviews.

Feels highly engineered -- but in a good way, so far. Cut out about 75% of the lines? I wonder how much overhead is going on behind the scenes.

JavaScript's philosophy seems to be "fuck it", right? Fuck it and hope the dev isn't a dumbass. Very loose.

hiroshimoot changed it to 310

...

Nothing. Because I am working on my masters in computer science and I may as well be a fucking English major now.

I don't care 'bout that nigger. Nothing's gonna change here!

...

...

Yep, JavaScript doesn't really force any philosophy on its users (comes with the same sorts of benefits and pains of C++), but some architectures work better and others worse with its object model. It's about compatibility, you could say.

You can get a pretty good salary if you don't do stupid shit with your life if you're pursuing an MS in CS.

...

...

> t. NEET Haskell programmer

...

Good post.

>he uses the highest earning language ever
Everyone else are just being hipsters

...

mods

...

...

I decided to try and get SFML.NET working on .NET core. I've made a little progress. System and Window modules compile, Window can at least display, but it's pretty dead.

...

...

...

How do I write a data structure for a particle system where each particle gets deleted when its Time To Live expires?
Should I just iterate through it, or sort it once in a while?
Or is there a way to somehow delete elements without even checking their contents?
Maybe store TTLs in a separate, sorted-by-default data structure?

If you're looping through them anyway, you probably don't have any use for priority queues, (which would allow you to find the element with smallest TTL, choose whether to delete it if TTL is negative, and then delete it, in log(n) time).

If particles get inserted and deleted at different times, then under these assumptions your best choice would be a queue (as you iterate through your particles to update/possibly render them, delete any with negative TTL in constant time).

If you add a new particle the instant the old one vanishes, then just use an array and iterate through it - when your TTL goes negative, replace that element with your new one.

Can a non-animefag answer my question please?

Can I find questions from people who aren't ingrates?

I mean, I take the time to contribute to the thread, and this is what you care about? It's a really disgusting mindset. Do you think I'm a NEET just because I watch anime? If I was a NEET, would it even matter?

People in Sup Forums who can actually answer your questions are a finite resource, you know.

(You)

...

Relax, it was a joke.

This is why I don't like animefags, they can't take a joke.

...

Your answer was shit anyway, I'm going to stackoverwlow.

;-)

>weebs are better at programming than me
>throw a fit because the majority of /dpt/ literally gives no shits if it's a weeb image

You would be a much better troll if you actually contributed to /dpt/ in the process of trolling - not that I'm sure you're able.

xD

>You would be a much better troll if you actually contributed to /dpt/ in the process of trolling - not that I'm sure you're able.
okay. Still saging though.

var elements = document.getElementsByClassName('postContainer');
var com = document.getElementsByName('com');
var str = com[0].value;


for(var i=0; i < elements.length; i++) {
if(elements[i].getAttribute('id')[elements[i].getAttribute('id').length-1] == elements[i].getAttribute('id')[elements[i].getAttribute('id').length-2])
str += '>>' + elements[i].getAttribute('id').substring(2) + '\n';

}
str += 'checked :^)';
console.log(str);
com[0].value = str;
checked :^)

>He cares about "contributing" to an anonymous imageboard
Your beta mentality is why you don't have a girldfriend.
Real alpha males take what they want and then spit in the faces of those who gave it to them.

*spit*

:^)

kek that's pretty neat
You should go back to >>/wdg/ though

...

it kinda depends. if you have a huge array it could be beneficial to sort it so you don't have to loop through the entire thing (because you know the index of the last live element/first dead element) and so you get fewer branch mispredictions (because you know all the first ones are live)

i believe this guy talks about the same thing here, i don't remember exactly what he said though

youtube.com/watch?v=rX0ItVEVjHc

If I have a grid represented by an array, is there a prettier way to check all points touching it or do I have to do
arr[x+1,y]
arr[x-1,y]
arr[x,y+1]
arr[x,y-1]

are you a gril gamer?

quality thread guys

what's the most efficient way to split a concave polygon into several convex ones? I just split the shape into several shapes by the lines where a point intersects two more horizontally, then do the same again with the shapes vertically. Could I just do this in 'one step' with diagonal lines?

top fucking kek this spider poster nigger is so assblasted that no one is going to his thread
are you 5 user? wtf

I don't know tbqh

So what do you guys listen to when you code?

Pic is pretty gud.

thats legit how nintendo did it with the super nintendo. you could have a second thread reading in locations of the surrounding indices and holding them so that your array, as a scope, is smaller.

...

this
youtube.com/playlist?list=PLAzGjvl9ybvcth67nXMmYqKhHmXwvKr7-

I had an idea that might be retarded or I dunno.
Since I know the frame during which a particle expires, and I also know the indexes at which I placed the particles, can't I use that data to predict where to search for a particle in an array.
In that sense, the TTL sort of becomes the index, since there can't be multiple particles added during the exact same frame by definition.

maybe iterate through the vertices like this and if the next vertex is on the wrong side of the last line then you've detected a concave part

demonstrations.wolfram.com/AnEfficientTestForAPointToBeInAConvexPolygon/

sure, that sounds like it will work. like keep the frame number together with the particle index. then when you delete the particle you could add the freed index to another array. the array of free indices could be sorted in order to keep the particles packed compactly at the start of the particle array (or maybe the array isn't so huge that it matters if they're sorted)

If programmers are so smart why don't they translate their code to machine code themselves instead of using a compiler?

pfft, programmers are garbage.

Try this:

github.com/ivanfratric/polypartition

The Hertel-Mehlhorn algorithm seems to be what you're looking for.

Because programmers are smart enough to know that time has value.

I actually implemented an algorithm that split any simple polygon into multiple triangles.
That's not what you want tho but you might be interested

Yeah sure, that's why they waste all that time instead of just using an IDE :^)

If Sup Forums is so smart why are you still a virgin?

antilopen gang
Nein.
;-)
Nie wieder Wald!
xDLOL!
thats nice, thanks
i fuck sometimes
no.
WAS

no thanks

thanks

Wait, how do I use a quad tree algorithm on an array with an odd number of indexes?

>no thanks

o-ok..

no you didnt
no you dont
no, (you)

>Concrete Mathematics: A Foundation for Computer Science (2nd Edition)
ramiro.org/vis/hn-most-linked-books-unique-users/

its theviacom!

that's pretty nice user, thanks. will try this when i wake up

Say I have a matrix and if I find a number 2 I change all surrounding spots to a 2. But I don't want this to happen in a cascade like
int[] grid = int[10,10]
The grid is randomly populated by 0,1s and grid[0,0-9] is filled with 2.

for i=0;i

ye boi dat multiples of 8 my nigga

IDEs are a pain in the ass to work with. Compiling is easier if you know how your compiler works.

cache a list of changes to be made, and process them at the end of the search.

My guess is any logic checking if things are equal to one before assigning would be slower than simply setting it to 2. You add conditional branching and reading in return for somewhat less writes. Your processor will already have this spot in memory in your cache anyway, so my bet is that branching is just going to cost too much compared to the gain from reading instead.

IDEs can use any decent compiler

use two grids, one that you read from and another that you write to

Using IDEs is easier if you know how the IDE works :^)

You should look at it and see why it took such a long time.

Well it's a lot more of a pain in the ass to learn an IDE.

I originally had a linked list to hold the coordinates of things I would change to 2 on the next iteration but the last thread posted about linked lists being bad so I tried to change it.

I don't quite understand what you're saying I should do

I guess that could work too

I'm saying that I think the naive way is probably the fastest way worth your time. Maybe there's some tricks with SIMD extensions that the compiler doesn't know to do for you that could be applied to this.

Aaand, I just realized you were actually asking about how to make a particular algorithm correct, not fast. Oops.

Anyway, for your real question, you have a few options, but the easiest one is to make a second matrix to write to and replace it, as said. If you want to save memory, and have an extra bit for each int you're not using (for example, maybe none of your data can be negative, or your data is small), there's some tricks I could show you to basically store a boolean of "is this a new 2 we just created" with each element.

Quad trees fucking suck.

elaborate? how else should you keep track of local objects in a 2d environment?

Quadtrees are awesome. What do you have against them?

I self-learned Java up to some data structures and algorithms, but I'm getting bored of it already. What's a good programming language that's actually practical? Currently eyeing Python. (or I might just learn Web Design, maybe some CSS or something to keep things interesting)

If I want to write a 3D RTL implementation, how do I find the largest square inside an arbitrary raster blob?
Is it an np problem or something, because I can't think of a solution that doesn't take like a quajillion checks to iterate the whole possibility space for each instance of all the possible positions and sizes and numbers of squares there can be in an arbitrary data set.

>I self-learned Java
you fucked up user

ruby, i have a hardware question for you.
its the hi ruby guy that drew a pic of you recently.


if you compile a program with the vectorized option on does that make the time betweens calls like arr[4][7] = 7 and arr[5][7] = 7 shorter than if it weren't compiled with the vectorized option on? i know the vectorized option on hardware is quite common, it may not have been too common before but it is now, so I've got to wonder if this is something people know about.

Like, I would imagine this would place the data table in a spreadsheet format and make calls between particular dimensions in an array contiguous through the use of two iterators or maybe a threading of them ( since calls to the table would be a "vertical" iterator, maybe "horizontal" if the array were to not be modeled as a physical graph, and the second iterator would move to model movement in the opposite direction. The original issue being collisions in the stream. ).

Have you worked with the vectorized option before?

This is how i assumed they always worked but some of the latest posts about grids have me second guessing that understanding...

my computer is kaput right now so im brainstorming as much as i can

It's fine, I had fun anyways.

What's a RTL?

What's a "Raster blob"?

err not in the opposite direction but more like the other latice.

"your life is a latice...ermm lettuce"

I mean RL.
Run length encoding.

"Raster blob" means a set of continuous identical data in 2D space.
Like a red circle.

r/a/dio, Shibayan or Alstroemeria Records.

oh, i had to solve that problem once. I just brute forced the whole thing. You can at least do it in parallel.

You could also break the whole bitmap up into a quadtree of all the sections that are completely black. After that it's much faster to compute the biggest rectangle you can fit inside.