/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

strawpoll.me/13845606
youtube.com/watch?v=O-1zEo7DD8w
wandbox.org/permlink/HZVocw6OXd5GmK0K
youtube.com/watch?v=GWMcla-I-_Y&list=PLd3UqWTnYXOniKfYRNY___weULTRd9Co0
twitter.com/NSFWRedditImage

This is pretty cool. But not exactly what I was looking for.

Employed Haskell programmer here

I'm working on programming an algorythm for a robot that finds where people who post anime are and kills them.

big chin!

Keep telling yourself that maybe it'll be true one day

...

upgraded gochumon!

...

main = putStrLn "Haskell!"

there are no male posters in /dpt/

Any game programming related projects I can do that's more on the tech side than game? I thought about making screensavers in openGL to showoff graphics but screensavers aren't really related,unless I make a interactive as a game.

strawpoll.me/13845606

How do I add/do math with two elements of a table together in Lua?
like
[2] + [3]

Just put the focus on the physics engine.

beats me dude

thanks anyway brother

Pretty cool

What exactly are you trying to do? You can add table elements easily like t[1]+t[2]

the line with issue is

sum= baptist[i] + baptist[i-1]

why the fuck is std::chrono is such a massive pile of shit lmao

God bless boost

As far as I can tell that is syntactically correct. The only issue you might encounter is if Baptist[i-1] doesn't exist or isn't a number. Make sure to test that.

template
constexpr int argument_count( Types ...)
{
return sizeof...(Types);
}

template
struct Array_Base
{
int size = I;
T array[I];
};

template
struct Array : Array_Base
{

template
void create(int i, T t=T(), SArgs... args)
{
if(i < Array_Base::size)
{
Array_Base::array[i] = t;
create(i+1, args...);
}
}
Array()
{
create(0,Args...);
}

T& operator[] (int x) {
return Array_Base::array[x];
}
};


int main()
{
Array array;
}

use std::initializer_list, fuccboi

D has such nice datetime library!

recursive mergesort in MIPS assembly

i should not have taken this goddamn class

My issue was that I used input=io.stdin:read'*l' instead of input=io.stdin:read'*n' (even though that the program im trying to write is supposed to understand when a user input is a number or a string and react different and I can't figure out how to manage that)


it looks like
sum=baptist[i]+baptist[i-1]
baptist[i]=sum

The goal is to add the last thing in the table to the second to last thing, and then have the sum be the new last thing in the table

You need to give more context to your code so we know what your intent is

Well there we go. Your problem is that writing to baptist[i] affects your read of baptist[i-1] later.

Just do sum=0 at the beginning and sum = sum + i

Then return sum or do baptist[#baptist] = sum (I think that's how lua works to set the last value)

Er, sorry, sum = sum + baptist[i]

you can write your own version of std::make_array()

template
constexpr auto make_array(Args&&... args)
{
return std::array{
std::forward(args)...
};
}


or with C++17 you can even just add a deduction guide to std::array

namespace std
{
template
array(Args&&...) -> array;
}


which allows you do use std::array like

std::array a { 1, 2, 3 };
auto b = std::array { 1, 2, 3 };

Is that variadic function argument? Straight to trash.

I import Japanese MMD models into blender. The object/armature is often in Japanese. I got tired of manually translating all the bones, so I tried seeing if a plugin existed to do this all in one shot.

To my surprise, it did, and uses Microsoft's Translator API. However the script is outdated and the API has since changed.

My tiny bit of Python knowledge came in handy and I just fixed it so it translates all japanese names in Blender to English.

knowing how to program is a life saver

Maybe change your search terms from game programming to computer graphics or something like that. What I can think of on the spot is maybe pathfinding with neural networks, maybe some grass/ vegetation shaders, procedurally generated trees and shit like that.

had a quick question Sup Forums

im learning java and im wondering exactly what this line of code does

>System.out.println(" " + i);

what are the " " for exactly? just so whatever i equals is spaced?

Yes. They are trying to print i as a string with a space in front of it.

it casts the i int to string for printing

ahh i see now
so if i had
>System.out.println("blah" + i);

it would essentially print out blah and whatever int or double i is.

>Is that variadic function argument? Straight to trash.
uh... why?

yeah. like blah2.

it's just shorthand for

"blah" + new String(i)
or
"blah" + Integer.ToString(i)

or whatever

thanks!

can anyone explain to me why this prints out to be 66?

int i = 1
int sum = 0
while (i

>broken english
>java

Try to be less obvious, Pajeet.

>tfw finally get code to do something useful without breaking even if it's only a tiny fraction of the features I'm trying to implement

Are you trying to print the sum of a string and ask integer

im wondering why the int sum prints out to be 66. for while statements does it keep plugging the new numbers for sum into it until the integer i hits 12?

How should I fix this so that modulo gets integer values instead of floats?

I need a float value for division, and integer for modulo, but I'm not sure how to change the type within a switch.

why dont u println in ur loop ur nigger then u can see what it prints every iteration

didnt know i could do that. sorry im still learning

what's a good language to learn ?

Why not use fmod?

If you ever have an issue with a variable not being what you expected then you should just put some
print (variable)
In the middle of the process so you can see exactly what's going on

nim has been mentioned out of fucking nowhere for no reasonlike 10 times today on Sup Forums so go learn that

would it be bad to cast it when it enters processData?
int intCastX = static_cast(x);
int intCastY = static_cast(y);

those are bad variable names

focking cats on your keyboard ?

...

nevermind I figured it out

>Any game programming related projects I can do that's more on the tech side than game? I thought about making screensavers in openGL to showoff graphics but screensavers aren't really related,unless I make a interactive as a game.

try procedural shader programming

(an example)

youtube.com/watch?v=O-1zEo7DD8w

>Enter an INTEGER
Why not just use ints, then?

What's next after SICP?

GEB

Then I'd have to change the division to float; it doesn't really matter much either way.

fuck you're here again

ACP

>t. didn't read ACP

Jeb

you should read it user

what's the full name?
I might one day, just rather read something different right now

what kind of book do you want to read?

More programming related, similar to SICP (but covers other topics)

Design Patterns: Elements of Reusable Object-Oriented Software

any cute anime girls in this thread?

nope
only neckbeards

Thanks, I'll look into it

what is the best python graphics library out there,

Java is the pinnacle of OOP programming; Haskell is the pinnacle of functional programming; C is the pinnacle of imperative programming. Together they make the triad of language design excellence.

And Scheme is the pinnacle of programming

Dynamic typing is immoral.

>still feeling a sense of achievement when your code works
cute

You're cute

>java

This won't compile in C++14 without optimizations, but will with optimizations (O2): wandbox.org/permlink/HZVocw6OXd5GmK0K

#include

struct TestChildStruct {
TestChildStruct(const int _int) {
classInt = _int;
}
int classInt;
};

struct TestParentStruct {
void doThing() {
testPtr = std::make_unique(structInt); // undefined reference
testPtr = std::make_unique(structInt+0); // works
const int reassignedInt = structInt;
testPtr = std::make_unique(reassignedInt); // works
}
static constexpr int structInt = 10;
std::unique_ptr testPtr;
};


int main() {
TestParentStruct parentStruct;
parentStruct.doThing();
return 1;
}

I agree that it is in most languages but in Lisp languages it just werks

I have never met a C programmer that wasn't a girl

thx user, i think i need a hug, i used to love programming, i'd program all day, i'd spend 8 hours at work programming then get home and just keep programming but i'm feeling a bit burn out lately, like the only thing i find interesting are the really difficult problems and the more i program the less difficult problems i get to solve, work has just devolved into mundane 'coding' that is always the same, i cant find any motivation to work on my personal projects because i know as soon as i solve all the problems i'll get bored and drop the project
what can i do to refresh myself here

maybe go to uni?

Maybe just burnt out and need to take a break?

Could read some books or watch a movie or just sleep.

Maybe read a programming book

Best online site to learn java data structures?

nigga u gay

done uni, compsci, it was fun, if i really get sick of work i'll go back
tried all this, at this point i'm just doing dumb shit to keep myself sane like writing an http server for a 72mhz arm processor or decompiling and re-writing vidyagammes
m8 boi hugs are 100% not gay

How do I emacs?

maybe :3

>take a look at haskell
>the core container type is a list instead of an array

Is this language just a meme or something? How is this considered acceptable?

Here you go
youtube.com/watch?v=GWMcla-I-_Y&list=PLd3UqWTnYXOniKfYRNY___weULTRd9Co0

Learning lisp

you evil-mode

i only noticed this recently but most microsoft tech talks are taken by indians
i thought micorosoft pajeets was a meme.. like just 5 years ago microsoft had actual intelligent humans working for it, what happened

what did he mean by this?

Middle management optimizing for low personnel expenses.

Can you do explicit threading and forking in lua