/dpt/ - Daily Programming Thread

Old Thread: What are you working on, Sup Forums?

Other urls found in this thread:

hastebin.com/ebubewoziw.cpp
myanimelist.net/character/13701/Mikoto_Misaka
vrscout.com/news/japanese-ar-girlfriend-cafe/
bittorrent.org/beps/bep_0003.html
github.com/rakshasa/rtorrent/
awwwards.org/brain-food-firstborn.pdf
twitter.com/donasarkar/status/843461968358907905
twitter.com/AnonBabble

...

first for trips

Sup fags. It's been so long since the last thread.

>917
nice trips asshole

>I have redefined re-declaration to be something other than mutation
guess = (guess + x / guess) / 2

Not mutation! Amazing!!!!

haskell!

I think she was referring to OP.

>What are you working on, Sup Forums?
I'm working on getting myself motivated to do literally anything.

who is this cute?

I'm thinking about implementing a neural network from scratch in C++. I'd like to work threads into this somehow as well as a learning exercise, but I don't know how relevant it is. Any thoughts?

why won't my code work :/
hastebin.com/ebubewoziw.cpp
when i hit enter it just moves me to the next line

Nothing because I'm new to programming and can barely understand Python.

EOF is different from a newline.

I think EOF is Control D.

Yep, that's what it's supposed to do.

Why the fuck is there SML implementation with native threads support?

Press CTRL + D

>inb4 "pajeet" jokes
Reminder that not pooing in loo is not our choice and you should not make fun of us for it or assume it means we are categorically bad at programming. Indians of the inferior caste must respect the sovereign rights of the superiors. We cannot use loo, the white man put it there for the people who are better than us, not for us. We get to continue starving and shitting in street like animal. That's just the way of the world, not our fault, I suppose you could hold us responsible by some ridiculous troll logic by saying we ought to fight for our right to poo but first of all why would we disrupt the social order that is dictated by vishnu secondly even if it were bad why would we risk our lives to disrupt it if the benefit of doing so (a higher standard of hygiene) would not be worth such a risk.

Oh, well I want it to count the number of characters of input. why is it not doing that?

thank you

myanimelist.net/character/13701/Mikoto_Misaka

Is that a question, or what?

>she

You need to terminate the input (send EOF) with ctrl+D

we're all qt girls here user ~

How would you change to code to make the loop terminate when it hits an "Enter"?

I will totally ignore your code and bitch and whine about how this site you linked doesn't work with JavaScript disabled.
It's a fucking pastebin, wtf does it need JavaScript for?

Check for a newline character instead of EOF.

Did you disable javascript? lmao you're done for kiddo

just tried and all it does is print ^D

'\n' is the end of line character

try ctrl+alt+d

Well, I for one am a dude. And not necessarily a qt one.

dumb pedofile poster

So all men are pedophiles to you?
I'm not the one with pictures of underage animes on my computer.

that did nothing :(

here is what the text says, including their example program

If you're on Windows, EOF is Ctrl+Z.

#include

main(void)
{
int count = 0;

while(getchar() != '\n')
count++;

printf("%d\n", count);
}

research how to input an EOF character into your system's terminal. it is ctrl d on most but yours is different obviously

ah yes, sorry, i should have mentioned i am on windows

>Check out “C Programming: A Modern Approach” by K. N. King, and “C in a Nutshell” by Peter Prinz and Tony Crawford.
Also “Practical C” by Steve Oualline.

how do i check if video file has an audio stream in c++? ffmpeg is too big for this, im looking for some one line function

oh, i would also like to ask another question. i am learning c from The C Programming Language 2e. i'm assuming they assume the OS the reader is using is unix, since that is what they were going on about in the preface and introduction. would it be better if i learned it on that OS?

C programming a modern approach is the gold standard imo but I couldn't find a free version when I looked years ago, and with k&R as the best reference.

Programming in C is a very slow book but easy to find a free pdf.

I'm reading: Programming in Scala Third Edition. It's a good book.

How long will emacs lisp take to learn and is it worth the investment? My config file is getting large and it's all just copy paste shit.

Is there a way in stack to check the GHC and stack version? It seems if you have GHC 8 then you need to have a newer version of stack than some distros provide. Can I do something in my stack setup like

if (GHC_VERSION >= 8.0.0 && STACK_VERSION < 1.0.0)
{
error: You need a newer version of stack, run stack update --git
}

I dunno what the stack version when it was fixed was, would have to find that out

if you know common lisp or scheme, you already kind of know it.
It's pretty easy to learn if you are already using emacs because it's basically just clorified elisp interpreter and compiler.

>How long will emacs lisp take to learn
Not too long if you are already used to programming.
>is it worth the investment? My config file is getting large and it's all just copy paste shit.
Just to configure the editor? The *absolute* basics are no more complicated than configuring any other advanced program.

BBCode and Scheme are the ultimate languagees.

class KGELIB_API CmpMesh : public Component
{
public:

//! Default constructor
CmpMesh(): strMeshName(""), m_pStaticMesh(NULL) {}

//! Clone a component
virtual Component* Clone();

those comments...

>KGELIB_API
Thanks, Microsoft.

what would i need to read before starting on writing a bittorrent client?

static typing is for cucks

vrscout.com/news/japanese-ar-girlfriend-cafe/

Now this is something I can get behind

I guess the spec, rest seems pretty basic. Honestly you might get away with only reading libtorrent's doc if you don't want to write your own backend.

dynamic typing is for niggers

dynamic typing is immoral

i can get behind you

dynamic niggers are for static cucks

This: bittorrent.org/beps/bep_0003.html
And this will come in handy too: github.com/rakshasa/rtorrent/

programming noob here

i need something to take a list of file names replace certain parts of another file,

basically its a website that needs video links replaces, so i need to replace the title, filename and link to the video.

what would be the easiest way to do this?

with Haskell!

This is trivial in literally any modern language.

New sorting algorithm for my minecraft clone. Old version was just qsort. Highly unoptimized proof of concept:
int newstarts[region_num + 1];
memset(newstarts, 0, sizeof(newstarts));
for(int i = 0; i < d->vbo_size; i++) {
int n = 0;
while(model_instance_comp(d->raw_minsts + i, region_templates + n) != 0)
n++;
newstarts[n+1]++;
}
for(int n = 0; n < region_num; n++) {
newstarts[n+1]+=newstarts[n];
}
memcpy(d->region_starts, newstarts, region_num * sizeof(int));
model_instance * target = model_instance_map + d->vbo_offset;
for(int i = 0; i < d->vbo_size; i++) {
int n = 0;
while(model_instance_comp(d->raw_minsts + i, region_templates + n) != 0)
n++;
memcpy(target + newstarts[n], d->raw_minsts + i, sizeof(model_instance));
newstarts[n]++;
}

The basic concept works which is good. The first optimization I'm going to take is to make it copy entire runs of "identical" data. After that I'm going to merge the loops into one loop.

what's wrong with qsort
what's wrong with the standard sorting algorith min our language

sed.

too slow. O(nlogn) is bleh for an array of 4096 elements. This algorithm is O(n).

Do you use anything 3rd party faam?

You mean libraries?

SDL
SDL_image
pthread
glew
opengl (of course)
linmath.h
xoroshiro128+

chicken
srfi-1
srfi-4
srfi-26
srfi-69
bind
memoize

>array of 4096 elements
shit programmer spotted

How do you figure sempai?

HTML SUCKS!
webgl / canvas based GUI library for webpages when?

...

awwwards.org/brain-food-firstborn.pdf

Check out this case study

Actually most of the time developers prefer to use anything but WebGL to render text because you need to do signed distance field rendering.

It doesn't belong to wdg if it doesn't use jquery.

You don't "need" to use distance fields to render text. It just looks worse and has worse memory usage without it.

I am having a mysterious segfault at a "continue" statement on the last run of a loop, in C++. The loop is very simple, literally (i = 0; i < 5; ++i). It is not the next statement causing it. All the information it's using in the loop is correct. Other datasets make it through fine.

Do not understand.

why don't you post the loop body nigger?

maybe i is declared as a pointer or something

>loop

inb4 "it's not relevant"

Why don't you post a minimal example that reproduces the problem? How do you expect anyone to help you? Or are you just blogposting?
Also learn to gdb.

Compile with the debug flag (-g) and then run the binary through valgrind

So what libraries do people here use for a window and some graphics? All I know is SDL plus OpenGL. Is there any single library that handles simple stuff?

Try GLFW

for (uint32_t num = 0; num < total; ++num) {
size_t best = SIZE_MAX;
for (uint8_t subset = 0; subset < 5; ++subset) {
size_t sum = 0;
for (uint8_t *end = array[subset] + chunk_size; array[subset] < end; ++array[subset])
sum += (*array[subset] < 128 ? *array[subset] : 256 - *array[subset]);
if (sum >= best)
continue;
best = sum;
best_subset = subset;
}
final[num] = best_subset;
}
}

But that is the simple stuff. Gives you a window and an opengl context. Even has input event handling.

If you need more you want Unity or some shit.

GTK+ is pretty standard, and also free software
Qt is also pretty standard but is proprietary

>He doesn't debug windows kernel with pajeets
step up, famlam
twitter.com/donasarkar/status/843461968358907905

I see why you chose not to post the body at first

i want to bit bang that bitch

Explain.

>pajeets
see:

Bros I got a summer job in my local governments IT department, they have a software section, last months student employee helped them out and did some small apps. I haven't actually developed any REAL applications yet just shitty stuff for assignments and I'm shy about asking to help out there + I've forgotten all the C++ syntax over summer. Should I sack up? Whats the easiest way to refresh my memory. MUH PORTFOLIO.

*poos in your loo*

kek

>poo
>loo
see:

Looks clean and simple, will try out.

I wanted something lightweight to make a simple GUI, GLFW looks like it.

I will check out GTK+.

What is a kernel debugger??

Is this valid as far as whitespace goes for Scheme? I'm working through SICP on my own and this is Exercise 1.3. Parentheses can get a little overwhelming so I wanted to make it clearer, but I'm not quite sure if it's valid.

(define (square x) (* x x))
(define (sum-two-largest-squared a b c)
(+
(square ((if (> a b) a b)))
(square (cond
((or (> c a) (> c b)) c)
(else (if (> a b) b a))
)
)
)
)

>:O