[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 330
Thread images: 33

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Old Thread: >>61656577

What are you working on, /g/?
>>
File: 1467570941060.jpg (517KB, 1521x1076px) Image search: [Google]
1467570941060.jpg
517KB, 1521x1076px
>>
first for trips
>>
Sup fags. It's been so long since the last thread.
>>
>>61662917
>917
nice trips asshole
>>
>>61662866
>I have redefined re-declaration to be something other than mutation
guess = (guess + x / guess) / 2

Not mutation! Amazing!!!!
>>
haskell!
>>
>>61662932
I think she was referring to OP.

>>61662888
>What are you working on, /g/?
I'm working on getting myself motivated to do literally anything.
>>
>>61662911
who is this cute?
>>
>>61662888
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?
>>
>>61662888
why won't my code work :/
https://hastebin.com/ebubewoziw.cpp
when i hit enter it just moves me to the next line
>>
>>61662888
Nothing because I'm new to programming and can barely understand Python.
>>
>>61662995
EOF is different from a newline.

I think EOF is Control D.
>>
>>61662995
Yep, that's what it's supposed to do.
>>
Why the fuck is there SML implementation with native threads support?
>>
>>61662995
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.
>>
>>61663022
Oh, well I want it to count the number of characters of input. why is it not doing that?
>>
>>61663021
>>61663045
thank you
>>
>>61662976
https://myanimelist.net/character/13701/Mikoto_Misaka

>>61662963
Is that a question, or what?
>>
>>61662964
>she
>>
>>61663057
You need to terminate the input (send EOF) with ctrl+D
>>
File: 1496861010896.jpg (116KB, 1280x720px) Image search: [Google]
1496861010896.jpg
116KB, 1280x720px
>>61663085
we're all qt girls here anon ~
>>
>>61663095
How would you change to code to make the loop terminate when it hits an "Enter"?
>>
>>61662995
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?
>>
>>61663106
Check for a newline character instead of EOF.
>>
>>61663122
Did you disable javascript? lmao you're done for kiddo
>>
>>61663095
just tried and all it does is print ^D
>>
>>61663106
'\n' is the end of line character
>>
>>61663141
try ctrl+alt+d
>>
>>61663104
Well, I for one am a dude. And not necessarily a qt one.
>>
>>61663172
dumb pedofile poster
>>
>>61663184
So all men are pedophiles to you?
I'm not the one with pictures of underage animes on my computer.
>>
File: Untitled.png (232KB, 3470x2841px) Image search: [Google]
Untitled.png
232KB, 3470x2841px
>>61663166
that did nothing :(

here is what the text says, including their example program
>>
>>61663215
If you're on Windows, EOF is Ctrl+Z.
>>
>>61663106
#include <stdio.h>

main(void)
{
int count = 0;

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

printf("%d\n", count);
}
>>
>>61663215
research how to input an EOF character into your system's terminal. it is ctrl d on most but yours is different obviously
>>
>>61663233
>>61663245
ah yes, sorry, i should have mentioned i am on windows
>>
>>61663039
>>61662760
>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.
>>
File: 1501189312672.jpg (15KB, 532x320px) Image search: [Google]
1501189312672.jpg
15KB, 532x320px
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
>>
>>61663233
>>61663245
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?
>>
>>61662760

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.
>>
>>61662888

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
>>
>>61663371
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.
>>
>>61663371
>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...
>>
>>61663547
>KGELIB_API
Thanks, Microsoft.
>>
what would i need to read before starting on writing a bittorrent client?
>>
static typing is for cucks
>>
File: 1495791456170.jpg (53KB, 650x448px) Image search: [Google]
1495791456170.jpg
53KB, 650x448px
https://vrscout.com/news/japanese-ar-girlfriend-cafe/

Now this is something I can get behind
>>
>>61663558
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.
>>
>>61663559
dynamic typing is for niggers
>>
dynamic typing is immoral
>>
>>61663572
i can get behind you
>>
>>61663589
>>61663559
dynamic niggers are for static cucks
>>
>>61663558
This: http://www.bittorrent.org/beps/bep_0003.html
And this will come in handy too: https://github.com/rakshasa/rtorrent/
>>
File: JoNHc6K.jpg (503KB, 1920x1200px) Image search: [Google]
JoNHc6K.jpg
503KB, 1920x1200px
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?
>>
>>61663692
with Haskell!
>>
>>61663692
This is trivial in literally any modern language.
>>
>>61662888
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.
>>
>>61663807
what's wrong with qsort
what's wrong with the standard sorting algorith min our language
>>
>>61663692
sed.
>>
>>61663842
too slow. O(nlogn) is bleh for an array of 4096 elements. This algorithm is O(n).
>>
>>61663807
Do you use anything 3rd party faam?
>>
>>61663980
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
>>
>>61663875
>array of 4096 elements
shit programmer spotted
>>
>>61664055
How do you figure sempai?
>>
HTML SUCKS!
webgl / canvas based GUI library for webpages when?
>>
>>61664082
>>>/g/wdg
>>
>>61664082
http://www.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.
>>
>>61664095
It doesn't belong to wdg if it doesn't use jquery.
>>
>>61664130
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.
>>
>>61664192
why don't you post the loop body nigger?
>>
>>61664192
maybe i is declared as a pointer or something
>>
>>61664192
>loop
>>61664055
>>
>>61664205
inb4 "it's not relevant"
>>
>>61664192
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.
>>
>>61664192
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?
>>
>>61664407
Try GLFW
>>
>>61664205
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;
}
}
>>
>>61664407
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.
>>
>>61664407
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
https://twitter.com/donasarkar/status/843461968358907905
>>
>>61664421
I see why you chose not to post the body at first
>>
>>61664436
i want to bit bang that bitch
>>
>>61664444
Explain.
>>
>>61664436
>pajeets
see: >>61663056
>>
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.
>>
File: C7SULDPU8AA84kT.jpg (667KB, 1881x1971px) Image search: [Google]
C7SULDPU8AA84kT.jpg
667KB, 1881x1971px
>>61664454
*poos in your loo*
>>
>>61664436
kek
>>
>>61664477
>poo
>loo
see: >>61663056
>>
>>61664410
Looks clean and simple, will try out.

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

>>61664426
I will check out GTK+.
>>
>>61664436
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))
)
)
)
)
>>
>>61664490
>:O
>>
File: anakinupset.jpg (13KB, 509x625px) Image search: [Google]
anakinupset.jpg
13KB, 509x625px
>>61664476
pic related it's me right now
>>
>>61664495
It's valid but fugly. Whitespace doesn't matter in scheme as long as you have at least some between symbols.

Just use a rainbow parenthesis syntax highlighter.
>>
>>61664495
Anything is valid as far as whitespace goes for Scheme. Scheme isn't like Python, it doesn't have hard rules for whitespace.
For example, even this would be valid:
                                (
define(
square


x
)(*
x
x
)
)
>>
>>61664531
so this is the power of lisp
>>
>>61664524
>>61664531
Gotcha senpaitachi. Thanks.
>>
>>61664489
Oh if you wanna make a GUI use gtk or qt.

GLFW and SDL for gaymes and video players.
>>
>>61664559
it's scheme you wriggling regency of rubber bugs
you plastic parasite
you squirming serpent
you pliable pest
you order or phylum of creepy-crawlie
you writhing rascal
you old maid
you wreck of Hesperus
you bothersome aunt
you tawny gent
you listless octoroon
>>
>>61664489
Didn't understand you correctly, GLFW creates the window, not a GUI as far as I recall.
>>
>>61664421
Oh, I screwed up writing this out, obviously.
for (uint32_t num = 0; num < total; ++num) {
size_t best = SIZE_MAX;
size_t best_subset;
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;
}


>>61664444
I suppose I could just use the destination array in place of a temp variable, to maximize the probability it'll be in cache if needed. Although, that would waste an entire cacheline on junk that with certainty, will not be needed. If the loop were shorter it could just cycle through the elements, but in this case the cache line will likely be vacated before it goes forward for the next write.

Hadn't really thought about that much.
>>
>>61664571
>>61664583
GLFW lets me create a window and draw on it. That's what I want. I know there are tools to make GUIs and I could also use Java, but I want to draw the stuff myself with OpenGL.
>>
>>61664586
>I screwed up writing this out
>>
I got no internet at my house because of a retarded drunk driver.

Anyways, what are some good books so I can learn c# offline?
>>
>>61664647
No ideas?
>>
>>61664709
use valgrind
>>
>>61664709
No, I'm just having a laugh at your expensive. My only guess would be that you're accessing the array out of bounds and dereferencing that.
Step through that loop with a debugger and you should be able to figure it out.
>>
>>61664692
http://www.robmiles.com/c-yellow-book/

Good free book for C#. Just download the PDF and you're set.
>>
>>61664586
Looking over your code, I didn't spot any obvious errors, so I think the problem is probably that your array length or array[subset] length is smaller than you expect, so you go off into invalid memory.
>>
>>61664736
The continue statement should terminate the loop, and no access seems to occur.

I've always debugged by printing / flushing throughout the program, or with asserts. Suppose it's reached a point where I ought to learn to use a debugger.
>>
Can I use gtk/qt to make a simple poker game? I basically just need a few buttons, some text input, but I'll need to be able to change the board, dealing out cards etc, and make the buttons hide/re-appear.

I was thinking of doing it in SDL or something, but it would be a bit of a pain to have to implement buttons and that sort of thing when it's already done for me with gtk/qt.
>>
>>61664792
QT with QML then laugh when it only takes you 10mins to do
>>
>>61664637
I mean SDL does too... not really sure what GLFW has that SDL doesn't desu. GLFW says it's lightweight but it's 3 lines to get an opengl context in SDL... SDL_Init, SDL_CreateWindow, SDL_GL_CreateContext. So heavyweight...

>>61664792
yea use QT.
>>
/dpt/ when you're programming in C or C++ what is even the point of debuggers?

Pretty much the only real error condition you'll ever run into on a modern computer is a segfault. So why would you bother trudging through your program with a debugger, when you could just use valgrind, which will throw up a backtrace the instant any invalid memory access occurs instead of just once it gets bad enough to crash, thus allowing you to effortlessly pinpoint the exact moment things started going wrong, instead of only telling you at what point it got too bad to keep going?

I mean I guess in C++ a debugger can be good for finding out where an exception is being thrown, because C++ has those now, but doesn't the runtime already do that for you as long as you compile with the -g flag?
>>
>>61664901
maybe your program isnt crashing and there's a bug and you want to step through and find out why?
>>
>>61664901
That's an error that leads to a crash though. Writing/Reading out of bounds may not cause a segfault. Your errors could be algorithmic and not memory access caused.

debugging lets you peak into variables and registers even when your program doesn't crash.
>>
>>61664901
>Pretty much the only real error condition you'll ever run into on a modern computer is a segfault.
you don't know the difference between an error and a bug, which is something you should learn. use google, don't ask here
>>
>>61664859
It's an alternative and I want to try something else.
>>
>>61664901
For nearly every language I've written code in, I've found debuggers only help me when I have written shit code: those times when functions take too much space or I make nonsensical jumps between functions.

When I take my time to write good code, it's easier to immediately work out where the problem could be without needing to go through it step by step, even if the bug in the program doesn't cause a crash but is entirely logical.
>>
>>61664945
>>61664948
Land sakes alive, we are cooking with petrol now!
>>
>>61664901
>error == bug

what
>>
>>61664808
Looks pretty powerful, thanks, I'll have a go.
>>
>>61664901
>because C++ has those now
>now
Shit man, they're most likely older than you.
>>
>>61664965
>>61664978
>>61664985
Hell's bells, we are having a mighty sporting time of it!
>>
>>61665061
By gum, you'll fix her wagon!
>>
>>61665088
And my Axe!
>>
I am going to make an ls clone in python.
>>
>>61664981
>>61665070
>>61665088
Are you a bot?
>>
>>61665166
how do you even view the directory's raw information? google is swamped by retards asking how to use ls when i try to find stuff on this. in the unix prog. env. they can hex dump the directory, but it's apparently changed in linux
>>
>it's a /wait 10 hours for the connection to timeout so you can get the error code/ episode
GREAT
>>
>>61665204
Shorten the timeout baka
>>
>>61665215
dunno how
I'm just learning this shit atm
but if you want to help me I'm using sockets on linux
>>
>>61665166
import os
os.listdir(path)


done
>>
>>61665232
ls clone in bash:
ls() { /bin/ls $*; }
>>
GREAT I FUCKING FORGOT TO PRINT ERRNO
>>
>>61665232
yeah but does it do recursion, formatting and sorting
>>
>>61665273
>reinventing the wheel

do something that has not been done for fucks sake
>>
>>61665273
>recusion for listing the entries of a directory
eggsplain
>>
>>61665251
*physical pain*
>>
>>61665297
printing the contents of subdirectories
>>
>>61665297
if you have a folder structure like this
C:.
├───.android
│ ├───avd
│ ├───cache
│ └───studio
│ └───installer
├───.AndroidStudio2.2
│ ├───config
│ │ ├───inspection
│ │ ├───options
│ │ ├───plugins
│ │ └───tasks
│ └───system
│ ├───android-palette


you list by recursively walking into the folders and backtracking
>>
>>61665349
>>61665348
n-nani?!?
ls can do that?
>>
File: jIM3Mbg.png (102KB, 600x400px) Image search: [Google]
jIM3Mbg.png
102KB, 600x400px
https://en.wikipedia.org/wiki/Xonotic
What language is this game written in?
>>
>>61665376
ls -R
>>
>>61665378
https://github.com/xonotic

C
>>
>>61665251
u mean
ls() { /bin/ls "$@"; }
>>
File: 1441922657744.jpg (9KB, 217x214px) Image search: [Google]
1441922657744.jpg
9KB, 217x214px
Been learning OpenGL for a while, approximated a sphere from an icosahedron. I'm pretty happy about it.
>>
>>61663234
nice infinite-loop-on-eof u got there
>>
>>61665376
>>61665393
why does no one read the manual
>>
>>61665497
i have better things to do, like fucking your mom
>>
Student with TA and professor who won't communicate at all here again.

from tkinter import *

master = Tk()

w = Canvas(master, width=500, height=500)

w.pack()

ball = w.create_oval(250, 250, 300, 300)
ball.pack()
ball.pack_forget()

mainloop()


    ball.pack()
AttributeError: 'int' object has no attribute 'pack'


I know I am making a stupid mistake that has been explained at least 5 times on stack overflow, but even after reading all the results I can't figure out what I'm doing wrong to save my life. Please help.
>>
>>61665520
import tkinter

top = tkinter.Tk()

C = tkinter.Canvas(top, bg="blue", height=250, width=300)

coord = 10, 50, 240, 210
arc = C.create_arc(coord, start=0, extent=150, fill="red")

C.pack()
top.mainloop()
>>
>>61665166
I started one, it got boring as fuck replicating the exact way they format some things
>>
File: 1474624328234.png (51KB, 209x450px) Image search: [Google]
1474624328234.png
51KB, 209x450px
>>61664436
>Windows
>>
>>61664426
>Qt is also pretty standard but is proprietary
Qt is available with both commercial and open source GPL 2.0, GPL 3.0, and LGPL 3.0 licenses.
https://en.wikipedia.org/wiki/Qt_(software)
>>
>>61665603
That isn't really helping. I need to figure out how to pack/unpack just ball without packing/unpacking the entire canvas.
>>
>>61665783
sounds like you got a problem to solve
>>
File: 1501512545326.gif (1MB, 430x360px) Image search: [Google]
1501512545326.gif
1MB, 430x360px
>>61662888
Someone make this gif with /dpt/ book covers smeared on it
too lazy to do it myself
>>
File: 1474325315193.jpg (44KB, 636x616px) Image search: [Google]
1474325315193.jpg
44KB, 636x616px
Employed Haskell programmer reporting in :)
>>
i haven't REALLY programmed in maybe 3-4 months

what do i do to refresh my memory
>>
>>61666235
average 2 ints in C
>>
>>61666285
very funny

holy fucking you and >>61666209 are still around HOW?
>>
>>61664578
that was an unnecessarily hurtful thing to say
>>
File: 1501337210918.jpg (112KB, 747x674px) Image search: [Google]
1501337210918.jpg
112KB, 747x674px
How do I make lots of money programming?
>>
Arm Assembly programming question

Basically I'm trying to get the contents of my stack (which are 4x4 matrix rows) to print.
I'm trying to print one row a line. The problem is that I get a freeze at the end of PrintRow,
so only the first line is printed. How should I fix this?
I'm guessing the problem happens because the link register can't keep track of two things at once.

MatrixPrintOut:

bl PrintRow
ldr r1, =NewLine
sub sp, sp, #16
bl PrintRow
ldr r1, =NewLine
sub sp, sp, #16
bl PrintRow
ldr r1, =NewLine
sub sp, sp, #16
bl PrintRow
ldr r1, =NewLine

swi SWI_Exit

PrintRow:
ldr r1, [sp]
bl PrintNum
ldr r1, [sp, #4]
bl PrintNum
ldr r1, [sp, #8]
bl PrintNum
ldr r1, [sp, #12]
bl PrintNum

bx lr
PrintNum:
swi SWI_PrInt
ldr r1, =SPACE
swi SWI_PrStr
bx lr


>>
Nim, D or Rust?
>>
>>61666487
Okay, I just dumped PrintNum's stuff in PrintRow for every number.
>>
>>61666512
None of the above.
>>
>>61666512
D > Nim > Rust if you want a nice language, reverse order if you want to ride the wave of popularity.
>>
>>61666512
Assembly
>>
>>61666543
that sounds reasonable
>>
>>61662888
Trying to implement the calculus of constructions as a C++ template library
>>
>>61666512
D is good even though I still use C++ more
>>
>>61662888
Writing some shellscripts for automating small server task, how about you, op?
>>
>>61666512
All of them are good
>>
File: 1496116229200.jpg (143KB, 1280x720px) Image search: [Google]
1496116229200.jpg
143KB, 1280x720px
>>61666849
>>
>>61666512
All of them are shit
>>
>>61666892
What would you recommend?
>>
>>61666512
Real time application? Rust
Soft real time? Nim
For nothing? D
>>
File: 1497823928537.png (174KB, 962x543px) Image search: [Google]
1497823928537.png
174KB, 962x543px
>>61666907
C++
>>
File: aya_happy.jpg (16KB, 190x188px) Image search: [Google]
aya_happy.jpg
16KB, 190x188px
>>61666512
You try Go desu senpai. Go is a lot of fun and is really fast!
>>
>>61666907
Anything other than C++
>>
>>61666942
Go is slower than all of them, anon
>>
>>61666942
Go is garbage.
>>
>>61662888
#include <stdio.h>

int main(){

int c = 5, d;
d = ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c + ++c;

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

return 0;

}


How much is d?
>>
>>61667019
It's undefined and depends on the compiler and machine.
>>
>>61667019
139
>>
>>61667019
UB
>>
>>61666881
>autism
>>
Has webdev gone too far?
https://github.com/rep-movsd/see-phit
>>
>>61667222
>
int main()
{
constexpr auto parser =
R"*(
<span >
<p color="red" height='10' >{{name}} is a {{profession}} in {{city}}</p >
</span>
)*"_html;

spt::tree spt_tree(parser);

spt::template_dict dct;
dct["name"] = "Mary";
dct["profession"] = "doctor";
dct["city"] = "London";

spt_tree.root.render(cerr, dct);
cerr << endl;

dct["city"] = "New York";
dct["name"] = "John";
dct["profession"] = "janitor";

spt_tree.root.render(cerr, dct);
cerr << endl;
}


Good lord the madmen actually made C++ even uglier
>>
>>61663328
yes
windev is worse than death
>>
>>61667358
where do i even begin? i've been using windows my whole life. i despise windows 10 and i want to learn more about tech, so i have the inspiration, i just lack a good place to start :(

i don't actually know much about computers. i know how to program in java, and i'm pretty good at math, but my knowledge of operating systems or how a computer actually works under the hood is surface level at best
>>
>>61667488
If you have no ties to windows, then install debian with openbox.
>>
>>61667358
>implying
WinAPI is simple as hell and the documentation is unrivaled. Just don't try and use MSVC and you're fine.
>>
Anyone noticed how VSCode shits on /tmp?
>>
What's the best way to create a 3-dimensional array in C/C++?

Currently I have the following, but I was wondering if it'd be more readable/stylistically correct to use pointer notation:
#define NUM_ROWS 256
#define NUM_COLS 128

#define NUM_FILES 5


double data_array[NUM_FILES][NUM_ROWS][NUM_COLS];
>>
>>61667821
This is not an efficient storage solution. Each file should point to its own contiguous block of memory. This way you can control things like alignment / cache better.
Solution: You don't want/need a 3-dimensional array, each dimension gives you another chance to be confused about how to index it.
>>
>when ur reading code and some retard made the struct packed when it didn't need to be
fucking hate retards who don't understand c
>>
>>61667821
I usually don't fucking bother with multidimensional array syntax. Not that hard to do *(a + x + y * len_x). Although this is partially out of distrust for multidimensional arrays desu
>>
>>61667488
>where do i even begin?
nice dubs

start with linux mint KDE
can't get simpler than that
get qtcreator on it, it's the best C/C++ ide
that said, don't actually make QT applications, they're shit
>>
Green, white or amber text?
>>
How likely is that my ECDHE-RSA-AES256-GCM-SHA384 application will be cracked?
>>
>>61668118
White
>>
>>61668146
30 minutes give or take
>>
>>61668192
how and what is the weak link here?
>>
>>61668146
what does your application even do?

Is it worth to crack it?
>>
>>61668206
the universal backdoor
>>
>>61668246
lol
>>61668210
its an encrypted chat client. its paramount that none of the text gets leaked.
>>
Not being impoverished.
Doesn't seem to be working out that well at this point.

I think its cool to see stuff about C++ on here.

I'm not here to brag. I just got interested 4 years ago or so.

Crazy huh? Pushed to get it standardized in '98 and picked it up in '13.


Geeks started becoming the new cool some time ago.

I like this place.

It's a way to vent. A medium. A platform.

fbfounder.Native
>>
File: IMG_20170801_031703_171.jpg (30KB, 444x186px) Image search: [Google]
IMG_20170801_031703_171.jpg
30KB, 444x186px
what do you guys think of this design for a game launcher?
>>
>>61667050
no, stop parroting things you don't understand.
>>
>>61668281
looks too much like 90's cracking software. remove the background and just add a soldier icon
>>
>>61668297
It's still not correctly handled by most compilers. That's an issue with developers though, not the standard.
>>
>>61668271
>its an encrypted chat client. its paramount that none of the text gets leaked.

it can be cracked, but is prolly not worthy my time
>>
>>61668281
that one specifically? looks cheap and ugly
>>
>>61668343
thanks, I'll wait for a response from someone who has knowledge about the topic I guess
>>
https://thedailywtf.com/articles/The-Fizz-Buzz-from-Outer-Space
lol wtf
I guess I know how to fix buzz better than some people.
>>
File: IMG_20170801_033219_351.jpg (237KB, 1280x674px) Image search: [Google]
IMG_20170801_033219_351.jpg
237KB, 1280x674px
>>61668281
Here is the current version
>>
File: X12.png (9KB, 220x220px) Image search: [Google]
X12.png
9KB, 220x220px
>>61668374
>thanks, I'll wait for a response from someone who has knowledge about the topic I guess
why are you making ANOTHER encrypted chat??

what does your "program" do better than the current ones (state of the art)?
>>
>>61668499
Looks like it's from about 20 years ago
>>
>>61668499
jesus
>>
>>61668510
so does the game AssaultCube which this launcher targets
>>
>>61663692

bash/sed/awk
>>
>>61668531
doesn't mean you need to make your launcher equally ugly
>>
>>61667821
I would use a double ***data_array.
In C++, the data array is probably part of a class, so you can create and delete the data on construction/deconstruction or even make a neat little class just for this so you can check the index before accessing it and stuff.
>>
>find tutorial series from 2012
>20 videos on how to draw a square, series ends before it gets to drawing a circle
>find tutorial series from 2004
>1. ok here's how to display a square and circle 2. now we use kd trees to divide the screen into ... 3. using a simple monte-carlo simulation we can sample each ...
lol
>>
>>61668681
>I would use a double ***data_array.
All that fucking indirection. All that fucking complicated ass allocation. That's a recipe for disaster in the bugs department. That's a jihad on the cache.

I love doing for loops on for loops of setting pointers.

Keep your arrays flat.
>>
>>61668499
any comments in terms of layout?
>>
>>61668814
Like everything being misaligned?
>>
File: Untitled.png (1MB, 1280x674px) Image search: [Google]
Untitled.png
1MB, 1280x674px
>>61668877
>>
>>61668281
>>61668499
>>61668893
a u t i s m
>>
Out of these books, what's the best for a complete beginner who is about to start learning Python?

>Introduction to Computation and Programming Using Python

>Introducing Python

>Learning Python

>A Functional Start to Computing with Python

Thanks.
>>
>>61663692

what?
>>
>>61669027
A project and google is your best bet.
>>
>>61662888
I'm making a shit ethereum token so I can make money with literally one hour of copy pasting and changing a few lines of code. It's going great, teatoken look it up boys
>>
>>61669079
I'm just trying to pick a book broski.
>>
>>61669163
Save some money my dude. Books are good for theory, just use google if you're learning a language.
>>
>>61669027
python the hard way
never learned it, but I hear it's the only good way
>>
>>61667967
>>61668003

This is exactly what I was looking for. Can't believe it didn't occur to me to just do several 1/2 dimensional arrays (Processing one file at a time instead all files at once) .
Thanks!
>>
Designing a stupid language for manipulating streams

6 iota
map[+ 1
iota
map[; '*']
seq['\n' once]]
flat
print

prints:

*
**
***
****
*****
******
>>
>>61669186
Got them all in PDF format.
>>
File: draw.png (13KB, 418x344px) Image search: [Google]
draw.png
13KB, 418x344px
>>61662888
writing a game for the Saturn right now
never done any 3D programming before, unless using three.js counts
I want to do a bunch of shit that this wrapper doesn't provide, like actually being able to do shit with the VDP layers, but the wrapper exists entirely because Sega's documentation is the worst thing to read

like, this is one of the better ones, and it still sucks (SGL library guide, later Saturn games use this, and the engine I'm using currently mostly just wraps this, and some things are wrapped entirely because the guy wants to replace the use of SGL with his own code):
http://segaretro.org/images/b/b0/ST-238-R1-051795.pdf
particularly bad bits of documentation are shit like the VDP1 programmers manual, which is awfully translated:
http://segaretro.org/images/8/8b/ST-013-R3-061694.pdf
the bit on "color calculation" (shit like gouraud shading (read: vertex colors, the Saturn doesn't actually calculate lighting in hardware) and the half-assed color blending and transparency support the machine has) is appalling in particular, if mostly because at no point does it use any of the terminology that you'd use for transparency or blend modes -- in fact, the word blend shows up zero times in the entire document

>>61667581
winapi requires a mountain of shit before you get a fucking empty window on screen
although I will give credit to the docs, which are fairly good and readable
in fact, I've never had any real issues with MS programming docs ever

>>61666543
came here to post this

>>61664901
logic errors that don't cause the program to crash, of course
eg, shit that mostly works but fails (not crashes, but fucks up and does something wrong) under some specific circumstances and you want to know why so you can fix it
>>
File: bait-but-nevertheless-correct.png (17KB, 522x384px) Image search: [Google]
bait-but-nevertheless-correct.png
17KB, 522x384px
Reminder
>>
File: 19554936.png (116KB, 500x566px) Image search: [Google]
19554936.png
116KB, 500x566px
Everyone here just pretends to like C but they'd rather not use it.

There I said it. Again.
>>
is there any way to do real time collaborative editing of a document with vim/emacs/atom whatever?
>>
>>61669859
>real time collaborative editing
git
>>
>>61669870
I'm talking for pair programming, where two people can edit one document.

xserver has multi input support, so I know you can independently have two keyboards and mice that can operate different windows simultaneously
>>
>>61669644

>Good Performance

write your own compiler nigger
>>
>>61669855
Honestly, I just prefer using it over sepples.

Classes, templates, constexprs and the like just seem very convoluted.
>>
Anyone have examples or guides to making simple MacOS application in Swift(3) without using interface builder stuff?
Repos would be fine. Hard to find any that are both simple and don't use storyboard stuff.
>>
>>61662888
Working on reader macro in scheme to just #include like C does. Modules are overkill for what I want, and load doesn't work at compile time.

For some reason it works, yet it also crashes the interpreter.

benis.ss
(print "a")

main.ss
(define (not-paren char)
(if (eq? char #\newline)
(error "Malformed #!include reader macro. Hit a newline. Correct form is #!include(file)"))
(not (eq? char #\) )))
(set-read-syntax! 'include
(lambda (port)
(if (equal? "\(" (read-string 1 port))
(read (open-input-file (read-token not-paren port)))
(error "Malformed #!include reader macro. Missing opening '(' Correct form is #!include(file)"))))

#!include(benis.ss)

And the output
; loading main.ss ...

Warning: (line 7) undefined escape sequence in string - probably forgot backslash: #\(
a

Error: (line 11) unexpected list terminator: #\)

Call history:

<eval> [not-paren] (not (eq? char #\)))
<eval> [not-paren] (eq? char #\))
<eval> [not-paren] (eq? char #\newline)
<eval> [not-paren] (not (eq? char #\)))
<eval> [not-paren] (eq? char #\))
<eval> [not-paren] (eq? char #\newline)
<eval> [not-paren] (not (eq? char #\)))
<eval> [not-paren] (eq? char #\))
<eval> [not-paren] (eq? char #\newline)
<eval> [not-paren] (not (eq? char #\)))
<eval> [not-paren] (eq? char #\))
<eval> [not-paren] (eq? char #\newline)
<eval> [not-paren] (not (eq? char #\)))
<eval> [not-paren] (eq? char #\))
<syntax> (print "a")
<eval> (print "a")

Success?
>>
>>61669855
Stop projecting.
>>
>>61669440
>Programming literally anything
>Saturn related

I wish you luck, brave soul. At least it isn't the original Xbox.
>>
>>61669855
basically true
I still just want C but with RAII and with a standard library that wasn't designed by retards.

like, I could just use C++ like that (and I do for personal projects), but C++ is full of dumb shit (operator overloading is a mistake and I consistently wish it had C# style get/set)
and most of the times where I absolutely, utterly HAVE to use straight C, I'm writing for something where I'm never or almost never touching the C standard library

so I guess I'm just complaining for the sake of it

>>61670072
most of the awful painful garbage in writing for the Saturn is smoothly handled by SGL, so you're not left staring at the awful, awful VDP1 and VDP2 manuals too long (you still need them) and a lot of the hand-tuned assembly work is already done for you, so you can just sit back and write C forever

but it unfortunately came like a whole year too late (and doesn't do Gouraud shading for you as far as I can tell, the provided lighting system is all flat-shaded, and you need to use RGB textures instead of paletted ones anyway if you wanted that)
also, the Saturn's non-UV quad based texturing is completely different from anything else (it's extremely simple and easy to work with... assuming you had the tools to do so, which 90s era Saturn devs didn't)
if Sega hadn't fucked up and rushed the machine out the door (and this isn't even talking about hardware, this is purely software), they could have provided good, sensible libraries right from the start (like, the first SGL game was Virtua Fighter 2 at the end of '95 -- look at how smoothly that runs compared to every Saturn game up to that point)
the miserable hodge-podge hardware design didn't matter if you as a developer didn't actually need to expose yourself to it so hard

Also, isn't OG Xbox programming basically "it's like targeting Windows but kind of different"?
I don't remember hearing any real horror stories about actually targeting the architecture, just loads about emulating it.
>>
Damn, this thread's pretty dead today.
>>
>>61670831
do something cool then anon, like a backflip
>>
>>61663283
You can't, considering how many container formats and audio formats there are.
Use ffmpeg's libavformat to tell you what's in a file or stream, it won't be more than 20 lines.
>>
File: smug_ascii_pepe.gif (607KB, 800x792px) Image search: [Google]
smug_ascii_pepe.gif
607KB, 800x792px
>be a neet
>need to apply for jobs to get neetbux
>create a bot which automatically applies for jobs
Who here /beating the system/?
>>
>>61662888
is there a site that has exercises you guys would recommend?
i gotta get my java skills back up to par for the new semester
>>
File: 500.gif (958KB, 500x281px) Image search: [Google]
500.gif
958KB, 500x281px
Made 4 pull requests today. All of them are just cleanups, very basic cleanups
>>
Python...max_key: 2006 sum: 22569013

real 0m14.343s
user 0m14.297s
sys 0m0.043s

D (DMD)...max_key: 2006 sum: 22569013

real 0m1.559s
user 0m1.527s
sys 0m0.030s

D (LDC)...max_key: 2006 sum: 22569013

real 0m1.085s
user 0m1.053s
sys 0m0.030s

Nim...max_key: 2006 sum: 22569013

real 0m1.299s
user 0m1.280s
sys 0m0.017s

C...max_key: 2006 sum: 22569013

real 0m0.131s
user 0m0.683s
sys 0m0.903s
>>
>>61671134
Doing god's work, anon.
>>
>>61671177
God doesn't exist, otherwise my religious parents wouldn't have to suffer from loneliness and live thousands of miles away from me, alone
>>
>>61671172
Try rust now.
>>
>>61671324
I'm actually interested. Any rustfag ITT? It's just a csv parsing benchmark
https://github.com/euantorano/faster-command-line-tools-in-nim
>>
How many instructions does it take to compute sqrt( 1 - x2 + y2 + z2 )?
>>
>>61671464
1
>>
>>61671464
depends on x y and z
>>
>>61671474
kek
>>
Apart from library support is there any reason not to choose D over Python, Java and C#
>>
>>61671514
Does it really matter?
All 4 are trash
>>
>>61671526
In comparison to?
>>
>>61671541
Agda
>>
>>61671544
Is that the only way to shill Agda?
>>
>>61671541
common lisp
>>
>>61671578
NO!
>>
>>61671464
Depends on technique you use to compute sqrt.

The fastest probably involves a version of the technique used in fast inverse squareroot
>http://h14s.p5r.org/2012/09/0x5f3759df.html

Write the code out and compile with -S. Then count.
>>
>>61671474
Fuck off back to discordshit, cancereours attention whore
>>
>>61671609
>cancereours
you tried
>>
>>61671618
>He dropped his trip for this
>>
>>61671621
Are you calling me a jew?
>>
So /dpt/... is a file system a tree or a graph?

Also, why do people get hyped up about tag-based file systems/databases/boorus? I mean, they've been with us all along... Any file system with directories and links can be one.

Why is everyone so confused about these things
>>
>>61671645
"it depends"
>>
>>61671609
who ARE you and what have you DOne WIth mY DIscord
>>
>>61671714
On what?
>>
>>61671765
on the filesystem

some aren't even trees, they're just lists
>>
How much should I comment my code? Some say that I should comment every line, others that I shouldn't at all comment, just give understandable names to functions and stuff.
>>
>>61671899
comment every function return, errors and parameters at the function definition
comment any time you do some wizardry
comment any time you inline asm
comment any time you feel it's unclear what you're doing

bam, done
>>
File: whydoessenpaihateme.png (200KB, 960x1024px) Image search: [Google]
whydoessenpaihateme.png
200KB, 960x1024px
>try to access webpage with program
>get 403 forbidden
What did they mean by this
>>
>>61671899
please don't comment every line.
>>
>>61671949
>direct IP access is not allowed

gas all "what did le mean by this" posters
>>
>>61671645
>>61671714
>>61671776

How would I go about making a tag-based, git-versioned file system? Seems like a cool little project. I googled and found lots of Linux FUSE projects like that
>>
>>61671977
BUT what did they mean by THAT
how else am I supposed to access a website
>>
>>61671899
Comment when your code is not clear by itself.
>>
>>61671984
git basically is a filesystem
just make an interface to interact with/get the files and make a place to put the files for actual storage

at least that's what my understanding of git is
>>
File: programminggod.png (82KB, 960x1024px) Image search: [Google]
programminggod.png
82KB, 960x1024px
I did it senpaitachi
>>
Guys, what path should I take when learning programming in order to do wacky cool stuff like being a crypto developer or creating basic online multiplayer games or a compiler that interprets C and hyena laughs and uses it to predict the weather etc.? I mean cool shit.

I'm sitting at home after work, bored with little to do
>>
>>61672046
install gentoo
>>
>>61672046
>crypto developer
gonna need at least a little expirience with ASM
>a compiler that interprets C
this is self contradicting
>creating basic online multiplayer games
easy

>learning programming in order to do wacky cool stuff
nothing will put more power in your hands than common-lisp
>>
>>61672008
How do boorus store their tags? What data structure/database
>>
>>61672046
https://mitpress.mit.edu/sicp/
>>
>>61672100
no clue
>>
File: thisthread.png (318KB, 960x1024px) Image search: [Google]
thisthread.png
318KB, 960x1024px
Terminal 4chan browser soon!
>>
>>61672143
how ill you do the captch?
open a window?
>>
>>61672158
Cant post I guess
The patricians way
>>
>>61669027
Sicp
>>
>>61672174
call it lurx then. like lynx
>>
>>61672174
Easy to do if using legacy captcha.
>>
>>61672191
I literally just learned how to use http and that socket shit yesterday
Nothing is easy for me yet
>>
>>61672191
I miss the real legacy captcha though. The street signs are considerably more boring.
>>
I just wanted to say that I love all of you guys. Have a nice day!
>>
>>61672216
but it is night time anon
>>
File: 1423216211144.jpg (108KB, 1920x1080px) Image search: [Google]
1423216211144.jpg
108KB, 1920x1080px
>>61672216
u2
>>
>>61672215
nigger, it's an option in the setting
>>
>>61672259
You're showing your underage desu.

I'm talking about when recaptcha was OCR for books, where it was obvious which one was the scanned word and which one was digitally generated as the test, when you could enter in the correct word for the test and nigger into the other word.

Now it's just street sign bullshit.
>>
>>61672274
ah, I see
I thought you were complaining about the "click all stop signs" BS
>>
>>61663122
>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?

fucking autist
>>
>>61672395
he's right though
>>
New thread:
>>61672457
>>61672457
>>61672457
>>
>>61671985
you need a host http header
Thread posts: 330
Thread images: 33


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.