/dpt/ - Daily Programming Thread

Hunter Thomas
Hunter Thomas

Old thread: jowforums.com/thread/68798646/technology

What are you working on, Jow Forums?

Attached: 1543958236205.jpg (527 KB, 1280x1480)

All urls found in this thread:

jowforums.com/thread/68798646/technology
news.ycombinator.com/item?id=18606127
dlang.org/spec/function.html#safe-functions
dlang.org/spec/function.html#trusted-functions
en.wikipedia.org/wiki/Hacker_News
livescience.com/62059-schizophrenia-lsd-sense-self.html
s000.tinyupload.com/index.php?file_id=02565829613557520773
youtube.com/watch?v=ie4u2i_5OdE
i.nhentai.net/galleries/"
i.nhentai.net
code.fb.com/developer-tools/getafix-how-facebook-tools-learn-to-fix-bugs-automatically/
rithmschool.com/courses
en.wikipedia.org/wiki/ABAP
learnxinyminutes.com/docs/javascript/
wiki.dlang.org/Current_D_Use
nand2tetris.org/
github.com/Microsoft/malmo/blob/master/Minecraft/src/main/java/com/microsoft/Malmo/EpisodeEventWrapper.java#L72
icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf]
jowforums.com/thread/68814458/technology

Elijah Gutierrez
Elijah Gutierrez

I want to die

Christian Hill
Christian Hill

Please do not use an anime image next time. Thank you.

Michael Johnson
Michael Johnson

sachiko a shit

Owen Bailey
Owen Bailey

tfw learning COBOL

Attached: 1530857178701.png (404 KB, 607x543)

Jaxson Carter
Jaxson Carter

I'll be sure to use her next time.

Attached: 1542923104480.jpg (60 KB, 650x576)

Landon Wilson
Landon Wilson

BASED

Christopher Hall
Christopher Hall

Attached: dpt-in-a-nutshell.jpg (16 KB, 499x249)

Isaiah Morales
Isaiah Morales

Why is /agdg/ so ill tempered?

John Hill
John Hill

nth for nim!

Jaxson Powell
Jaxson Powell

Haskell is the most powerful programming language.

William Moore
William Moore

Not everyone is mentally ill in these threads.

Matthew Bennett
Matthew Bennett

programming talk in /agdg/ is like FP talk here.
Triggers the brainlets

Bentley Ross
Bentley Ross

Performance anxiety. They know that the market for shovelware indie games was diminished to nothing round about 3 years ago, but they're still all-in and hoping to become the next Papers, Please.

Angel Edwards
Angel Edwards

Yeah I don't use C.

Andrew Walker
Andrew Walker

le ebin response XD
kys fucking faggot

Kayden Nguyen
Kayden Nguyen

What should I make this do next user?

# animegirl.py
# by Jonno, Dec 2018
# talk with Mika, the cute anime girl

# save messages as variables
intro = "Hi! I'm Mika, a cute anime girl!"
ask = "How can I help?"

# begin interactions
print(intro)
print(ask)

Attached: Anime-Girls-HD-Backgrounds.jpg (1.03 MB, 1920x1200)

Grayson Collins
Grayson Collins

Crabs in a bucket

Jaxon Martin
Jaxon Martin

Solve the decidability problem.

Caleb Evans
Caleb Evans

write it in C, add an x86 boot sequence and calls to the VGA buffer, and make a waifu operating system. Also, make it pass the turing test.

Jack Robinson
Jack Robinson

No.

Attached: 1512356698758.jpg (381 KB, 744x1052)

Brandon Walker
Brandon Walker

but like all of your projects you never go through with it

Jackson Long
Jackson Long

I'm going to go make a snack with that fire.

Aiden James
Aiden James

Attached: 1541900093146.jpg (150 KB, 496x1122)

Lincoln Bell
Lincoln Bell

Fuck C and heil C++

Attached: 686923.jpg (256 KB, 889x853)

Elijah Hernandez
Elijah Hernandez

Both great ideas.

I made it tell a joke.

joke = "My dog has no nose. It smells terrible!"

Juan Clark
Juan Clark

Mate, where do you think you are?
Sepplescucks belong in //boards.Jow Forums.org/trash/.

Attached: 1452471092796.png (372 KB, 1280x720)

Cameron Ward
Cameron Ward

C++ is still unstable after 35 years, why would I trust a language that can't seem to implement a single feature without being rife with bugs?

Attached: kill-la-kill-04-ryuuko-bunny-pajamas-smile-happy-friendship-red-streak-short-spiky-hair-tomboy-cute- (86 KB, 1280x720)

Eli Rogers
Eli Rogers

I made this for you, /dpt/!

Attached: 1544043227681.png (988 KB, 868x1228)

Jacob Lewis
Jacob Lewis

Le oh-so-funny trap forced-meme
It's shit.

Justin Roberts
Justin Roberts

I don't understand this.

Dominic Moore
Dominic Moore

currently 2/3 here
the pink plastic is a bit too gaudy for me. is it available in other colors?

Zachary Hernandez
Zachary Hernandez

I love Sachiko!

Attached: 1533685644788.jpg (305 KB, 596x978)

Aaron Moore
Aaron Moore

I fell for the Nim meme and it is actually pretty fun.

Hunter Taylor
Hunter Taylor

So do you have a total of 3 users now?

Jason Lopez
Jason Lopez

nim is a great language. Hoping it gains popularity.

Cameron Bell
Cameron Bell

the pink plastic is a bit too gaudy for me.
It's not like anyone is going to see it.

Ian Phillips
Ian Phillips

good lad.

Benjamin Cooper
Benjamin Cooper

1 2 3 Checks out.

Leo Gray
Leo Gray

slow and steady.

Sebastian Baker
Sebastian Baker

You've probably plateaued at this point. At least you beat D's record of 2 users globally.

Tyler Richardson
Tyler Richardson

There's atleast two others here that use D. So we're tied. dedlang takeover soon.

Jonathan Ross
Jonathan Ross

No, the other guy was arrested for breaking into a mortuary.

Kevin Miller
Kevin Miller

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
get new jokes m8

Carter Rodriguez
Carter Rodriguez

A language power's mesurable by the speed of his compiled application.
ALL HAIL ASSEMBLY.

Dylan Richardson
Dylan Richardson

Lisp is the most powerful programming language.

Isaac Flores
Isaac Flores

It's a total mystery why Rust got all the hype that D deserved. D has every feature Rust has, and then some. And it compiles and runs so much faster.

Gavin Hall
Gavin Hall

asm
1:1 correspondence with machine code assuming no virtual opcodes

Samuel Martinez
Samuel Martinez

Garbage collected
Aping C++, the worst language is existence
D deserves absolutely nothing.

Michael Rogers
Michael Rogers

Rust has mozilla, and a certain political group. plus D didn't shove buzzwords down everyone's throats constantly, and also didin't guerrilla/zerg market like Rust did with sending reps out to every conference to shill. And Yes as the other user said, The GC turns people away instantly. But unlike Rust, D is actually a very good language, that's very nice to write and maintain, so in the long-run it has a much better chance than Rust. Plus @nogc work is ongoing.

Logan Gonzalez
Logan Gonzalez

D's syntax is more inline with C# ,than Sepples.
I do agree that Walter is wasting time with c++ interop though, but what can you do.

Brayden James
Brayden James

you guys are doing the advent of code problem in 10 minutes, right?
you can actually program... right?

Brody Johnson
Brody Johnson

desde

Attached: desde.png (395 KB, 1000x1000)

Justin Roberts
Justin Roberts

advent of code
What would be the point of that?

Michael Hill
Michael Hill

Who the fuck cares about that? I don't need to prove myself to anybody.
Go back to your containment thread.

Lucas Ross
Lucas Ross

asm
compiled

Attached: confusedgirl.jpg (26 KB, 360x360)

Colton Morris
Colton Morris

sending reps out to every conference to shill
You've hit the nail on the head, D should do this

Benjamin Martin
Benjamin Martin

hey the macro preprocessor counts for something at least, doesn't it?

Joshua Powell
Joshua Powell

Honestly, I'm not even sure D has the people.
There's plenty of "senior" members who contribute to the compiler and are considered quasi-core members. But ultimately they have their own lives and are just volunteers. Walter and Andrei are the only real "core", but Andrei's still at Facebook. But a lot of Rust talks I've watched, the reps don't all seem like programmers, or atleast core-quality ones. They seem more like PR who've been extensively trained on the basics and how to answer all the usual questions. And I don't want D to make that mistake.

Henry Perry
Henry Perry

correct me if i'm wrong but literally the whole point of rust and the only real reason you'd use it over c/c++ is the compile-time memory safety without GC aspect
what's that got to do with D?

Blake Jones
Blake Jones

Yeah, probably. I was just being smart.

Attached: smartgirl.jpg (66 KB, 500x318)

Jonathan Barnes
Jonathan Barnes

D is every bit as safe as Rust, just use @safe
And it does fine without a GC, just use @nogc

Jonathan Moore
Jonathan Moore

Facebook is running millions of lines of D and it could easily spare a few documentation writers to show off at conferences

Oliver Lewis
Oliver Lewis

Read
news.ycombinator.com/item?id=18606127
Autor D is on it

John Ward
John Ward

D has @safe and @trusted function attributes
Each basically enforce Rules you can't break inside the function to assert guarantees.
dlang.org/spec/function.html#safe-functions
dlang.org/spec/function.html#trusted-functions
They also wrote their sepples preprocessor in D. But D's not their main lang, nor are they trying to be a main force behind it. Andrei just has a lot of clout so he is allowed / trusted to incorporate it.

Tyler Powell
Tyler Powell

I always see that news.ycombinator site. What the fuck is it?

Hunter Taylor
Hunter Taylor

It's a minimized fork of the Slashdot codebase run by the creator of C++

Logan Lopez
Logan Lopez

Employed Jow Forums plus drugs and startups shills

Mason Baker
Mason Baker

reddit clone like voat for cs incels

Charles Ward
Charles Ward

D is fucking RISING. YAS BITCH.

Andrew Stewart
Andrew Stewart

working
Good one. I want to be the Lance Armstrong of programming. What drugs do I take?

Attached: 140813162311-01-lance-armstrong-restricted-horizontal-large-gallery.jpg (67 KB, 980x552)

Julian Ward
Julian Ward

en.wikipedia.org/wiki/Hacker_News

Jace Kelly
Jace Kelly

Vitamin D

Attached: AN329-Vitamin-D-Gels-732x549-thumb.jpg (37 KB, 732x549)

William Kelly
William Kelly

Adderall

Attached: pills.gif (987 KB, 500x378)

Jackson Roberts
Jackson Roberts

Microdose LSD. It literally made me a superhero.

Before LSD
racist
wasted time on /pol/
programmed for like 1 hour a day

After LSD:
not racist anymore
/pol/ disgusts me
program for at least 8 hours a day.
creative

Connor Jackson
Connor Jackson

Heroin, or krokodil if you're on a budget.

Nolan Morgan
Nolan Morgan

A thread full of weebo posting circle jerk.
Show me you code /dpt/, now!

Attached: quote-talk-is-cheap-show-me-the-code-linus-torvalds-45-66-13.jpg (36 KB, 850x400)

Nathaniel Morris
Nathaniel Morris

that's not very nice language user.
*kicks you out of your own project*

Julian Brooks
Julian Brooks

Cure schizophrenia
livescience.com/62059-schizophrenia-lsd-sense-self.html

Camden Wilson
Camden Wilson

I'm doing stuff for my job, and while it's open source, I don't really want to post it here.

Attached: 1542830119975.png (23 KB, 139x129)

James Cruz
James Cruz

Meritocracy in open source was to expels "ideas guy" now ideas persons can infest open source as "mananger"

Jace Taylor
Jace Taylor

What are some good books for c++? I only know the basics like loops, functions, arrays, pointers, classes/objects etc. Want to at least learn enough to start a project like a game of snake. I have this one infograph. Is it any good?

Attached: 1530467742003.jpg (309 KB, 663x1408)

Thomas Powell
Thomas Powell

no programmers in here
they're all in the advent of code thread

Andrew Roberts
Andrew Roberts

Let me tell you a secret brainlet... Don't read books to learn a language. Once you know the basics, just CODE.

Daniel Rodriguez
Daniel Rodriguez

Attached: 1543807486337.png (97 KB, 1201x825)

Isaac Bennett
Isaac Bennett

can someone explain this meme?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Jacob Moore
Jacob Moore

its not a meme, not everything is a meme, its just java

Chase Brooks
Chase Brooks

How to change font on vscode?

Oliver Campbell
Oliver Campbell

attempt 1 (One) search in the settings and see what happens.

Sebastian Diaz
Sebastian Diaz

Yes sir! Learn by doing, thanks

Attached: 1480030061252.jpg (476 KB, 2560x1440)

Jonathan Lee
Jonathan Lee

not everything is a meme
Or is it?

Attached: selfreflection.jpg (364 KB, 960x519)

Christian White
Christian White

weebtards
programming anything
lul

Attached: 4ancd7gdlwty.jpg (42 KB, 612x727)

William Garcia
William Garcia

all those books dedicated to a shitlang
the human race has failed

Attached: 1492539634213.jpg (148 KB, 800x640)

Eli Stewart
Eli Stewart

he needs a language to make sure his types are safe

Attached: 1466735540705.jpg (64 KB, 460x676)

Aiden Perez
Aiden Perez

where is the settings?

Luis King
Luis King

s000.tinyupload.com/index.php?file_id=02565829613557520773

William Jenkins
William Jenkins

# animegirl.py
# by Jonno, Dec 2018
# talk with Mika, the cute anime girl

# save messages as variables
intro = "Hi! I'm Mika, a cute anime girl!"
ask = "How can I help?\n"
confused = "I don't understand"
joke = "My dog has no nose. It smells terribly!"

# begin interactions
print(intro)

while 1:
userInput = input(ask)

if userInput == "exit":
exit()

elif userInput == "joke":
print(joke)

else:
print(confused, userInput, ".")

Attached: programming.jpg (522 KB, 2560x1440)

Caleb Foster
Caleb Foster

she needs an assembler to generate machine code for her

Attached: 1521076494404.jpg (22 KB, 246x239)

Jace Hernandez
Jace Hernandez

they need a computer to perform calculations for them

Attached: smug-anime-girl.gif (386 KB, 1280x720)

Ian Reyes
Ian Reyes

she wasn't the first to instantiate a Turing machine

Attached: dumb.jpg (34 KB, 192x299)

Lincoln Gomez
Lincoln Gomez

weebtards
programming anything useful

Attached: 1542917138190.jpg (132 KB, 600x616)

Tyler Williams
Tyler Williams

Name one (1) good thing about OOP.

Attached: gnu-reimu.jpg (341 KB, 3491x1800)

Christopher Jones
Christopher Jones

It instantly indicates who is a designated programmer so I can avoid them like the plague.

Attached: OOP?-more-like-POOP!!.png (171 KB, 512x232)

Benjamin Gray
Benjamin Gray

objects are easy to reason with
you can even explain your object to a non-technical person because they already have an understanding of what an object called a "car" is like

Brandon Sanchez
Brandon Sanchez

just made my first github fork of a project that isn't mine.
they had a stub, i just gave 8 lines of html/CSS
feels good man

Attached: feels-good-man-goodman-pun.jpg (35 KB, 480x351)

Asher Myers
Asher Myers

Then why can the average person find BASIC easier to understand than C++?

Jayden Russell
Jayden Russell

I just finished the first day. It was a lot more fun than I expected.

Carson Rogers
Carson Rogers

because the average person doesn't know C++

OOP is easier for PROGRAMMERS to reason about, or at least the bad ones
who gives a fuck what non-programmers think about anything other than the UI

Hudson Morales
Hudson Morales

if there was a programming language that had only IF and ADD operations, they'd find that even easier than BASIC
but what good would that be
anyway, we were originally talking about paradigms and now we're talking about specific languages so I don't even understand your line of questioning

Bentley Clark
Bentley Clark

OOP is basically busywork.
You create abstractions that make programming harder and more disorganized.
So you can easily describe the abstractions to others because they don't do anything.
Yet the actual code is a nightmare black box.

Attached: 1540905778167.jpg (123 KB, 1504x1200)

Dominic Gray
Dominic Gray

Not always true tho, OOP does have its uses, but it's horribly overused nowadays, and functional programming is a lot better most of the time.

Jayden Bell
Jayden Bell

depends on how you use it, just like anything else
it's like comparing beautiful reusable modular haskell code
to haskell code that has been obfuscated and code golfed down to the minimum number of functions and characters
sure, it's cool, but it's not useful to anyone anymore

Chase Parker
Chase Parker

why is there even an argument?
OOP is fine for some things
FP is fine for some things
use what tools you have to do what needs to be done.

just because you have a hammer, does nto mean everything is a nail - however, some screws can function as nailed and can be hammered in certain situations.

Jaxon Lee
Jaxon Lee

because mentally inbalanced people can't be reasonable and need a sports team to root for and something to argue about

Blake Johnson
Blake Johnson

why is C# so fucking perfect?
i love it!

Nicholas Howard
Nicholas Howard

100%

Mason Nguyen
Mason Nguyen

How do demoscene guys fit so much stuff into just 64 KiB?
youtube.com/watch?v=ie4u2i_5OdE

Cameron Jackson
Cameron Jackson

Procedurally generated textures and models. 64k isn't alot of data but it's alot of code

Hudson Parker
Hudson Parker

javabrainlet here:

how to avoid instantiate new objects in a for loop (unadvised practice) if i gotta fill a list of a type which has an hashmap and another object as attributes?

Thomas Sanchez
Thomas Sanchez

you dont
advised practice is to not create new objects when not neccessary, you described a situation where it is

Hunter Mitchell
Hunter Mitchell

By going through logic to access data, you can ensure that some invariants are held.

Jayden Powell
Jayden Powell

Don't worry about it, my dude. As long as you're doing only basic things with the object escape analysis will take care of the rest.

Ryder Morgan
Ryder Morgan

OP and FP and both brainlet ideas.
Procedural Programming all the way.

My output increased more than 100% by switching to procedural programming in C.
Even though C has obvious flaws and drawbacks too, it's better than the obfuscating abstraction that came later.

Attached: trump-woman.jpg (312 KB, 650x366)

William Bailey
William Bailey

pure procedural programming is only the answer when your programs are trivial

Blake Cooper
Blake Cooper

well, fuck. just go straight to assembly then, hell go full binary.

you has won da 4chans, G-dog!

Grayson Davis
Grayson Davis

doin' homwork

Attached: Capture.png (8 KB, 615x129)

Isaac Walker
Isaac Walker

data oriented programming

Leo Green
Leo Green

false, look at the linux kernel

Christian Brown
Christian Brown

Thanks both. you mean is fine if I just instanciate it and the loop is not thousands of records each time?

Nathan Ward
Nathan Ward

they use alot of hacks and extensions to basically turn C into C++ anyway, not a good example

Nathaniel Torres
Nathaniel Torres

Is it bad that I like this more than Vim or emacs?

Attached: 1200px-Visual-Studio-Code-1.18-icon.svg.png (16 KB, 1200x1195)

Charles Torres
Charles Torres

you retarded nigger do not even know what procedural means do you

Attached: 1522814034816.png (6 KB, 214x236)

Cameron Sullivan
Cameron Sullivan

Post what the actual loop is.

Landon James
Landon James

use what works
vs code is cool

full blown visual studio = near godly
2019 version is in preview. tempted to play with it
i love 2017 version

Austin Edwards
Austin Edwards

posted on a chinese image that uses cloudflare
cloudflare uses nginx for various services

C is "low"-level lel

Jacob Baker
Jacob Baker

It means no fucking OOP abstraction nonsense and no fucking FP confusing glop.
Structs, functions, buffers.

I mean for starters most programs are fairly trivial it's just the retarded tools we use make it complex.

Attached: female-trump.jpg (25 KB, 300x400)

Matthew Cook
Matthew Cook

they use alot of hacks and extensions
not part of the standard

Dylan Baker
Dylan Baker

What are you trying to say?

Jayden Fisher
Jayden Fisher

I mean for starters most programs are fairly trivial
maybe most programs YOU write are trival but don't speak for the rest of the world

Daniel Lewis
Daniel Lewis

good god you are too retarded to be saved

Benjamin White
Benjamin White

Does anyone else here treat users in their program like slow but diverse functions? If I'm ever not sure how to implement something, I have the program ask the user to take the inputs and do the needful. Helps a lot in helping me figure out my own shit.

Mason Perez
Mason Perez

gatekeeping
You make seem like there are programming paradigms that only belong to certain languages.

Sebastian Wilson
Sebastian Wilson

don't understand why C programmers have such a hard time with FP.
Purity and immutability really aren't hard concepts to grasp.

Thomas Murphy
Thomas Murphy

What?
C doesn't do OOP
how can OOP 'belong' in C?

Adam Jenkins
Adam Jenkins

There's more to FP than purity and immutability.

Camden Ward
Camden Ward

how can OOP 'belong' in C?
Can't tell if retard, troll or both.

Jason Stewart
Jason Stewart

I have no idea what you're talking about
C doesn't have OOP, C++ was literally invented to be C with OOP

Matthew Lopez
Matthew Lopez

C++ was a mistake because you can clearly do those things in C already.

Justin Hall
Justin Hall

w/e

Kayden Butler
Kayden Butler

obviously, but the other basic things aren't hard.

Logan Sullivan
Logan Sullivan

only in the vague non-practical sense that every turing complete language can do the same thing as each other

Nathaniel Green
Nathaniel Green

the kernel uses oop-styled C, dumb pajeet.

Jaxson Parker
Jaxson Parker

No, in the concrete sense of being able to perform encapsulation and polymorphism in the same way and with the same semantics as OOP languages.

Adrian Lee
Adrian Lee

import os
import urllib3
http = urllib3.PoolManager()

url_list = []
dirName = ""

str1 = "i.nhentai.net/galleries/"
str3 = ".jpg"
str4 = ".png"

for url in url_list:
bool1 = True
r1 = http.request("GET", str1+"1"+str3, preload_content=False)
d1 = r1.read()
if len(d1) < 1000:
r1 = http.request("GET", str1+"1"+str4, preload_content=False)
d1 = r1.read()
if len(d1) < 1000:
print("This doujin appears to be broken!\n" + str1+"1"+str4)
bool1 = False

if bool1:
str2 = url.split("/")[4]
if not os.path.exists(dirName+str2):
os.mkdir(dirName+str2)

i = 1
while bool1:
r = http.request("GET", str1+str2+str3, preload_content=False)
data = r.read()
if len(data) < 1000:
r = http.request("GET", str1+str2+str4, preload_content=False)
data = r.read()
if len(data) < 1000:
print("Doujin", str2, "is done, onii-chan!")
break
with open(dirName+str2+str(i)+str3, 'wb') as out:
out.write(data)
out.close()
print(i)
i += 1
print("Your doujins are done, onii-chan!")


Take that!

The 403 block isn't going away though, even through proxies and VPNs. I tried to change my IP and accidentally fucked up my network settings somehow. I think I'll bust out the raspi and use that, since I'm obviously too incompetent to do anything else.
tfw I accidentally included i=1 inside the loop and it just kept downloading the same image
Python is the best language for brainlets, that's for sure.

Kevin Cook
Kevin Cook

printf 'GET /galleries/gay/shiit.jpg HTTP/1.0\r\nUser Agent: weeb-fag\r\n\r\n' | nc i.nhentai.net 443j

Christopher Robinson
Christopher Robinson

can somebody write a swap! macro in lisp pls

Evan Bennett
Evan Bennett

Fuck, where the fuck did that j come from?

Jack Scott
Jack Scott

I don't understand any of that

Liam White
Liam White

HTTP is easy as fuck. It's all plaintext, crafted in the application layer.

Bentley Peterson
Bentley Peterson

I'm a little tired, and I forgot this part. You need openssl to do https like that, but it can be done. I forget the syntax.

Carson Anderson
Carson Anderson

but how do I basically post something in a thread using POST ???
I know Jow Forums has captcha, so try it with lainchan, since it has no captcha, and teach me how you did it.

Levi Williams
Levi Williams

the cutest.

Jordan Phillips
Jordan Phillips

No I mean I don't understand the syntax. Particularly the vertical bar in there. Is that something for python 3? The reason for printf at the start is also alien to me.

Samuel Gray
Samuel Gray

oof

Gavin Campbell
Gavin Campbell

I think it's a bash script?
He's piping printf formatted input (so he can get escapes) into the nc application.

Christian Ward
Christian Ward

you don't compile assembly, you assemble it

Levi Davis
Levi Davis

I don't know how to specifically defeat captcha, but you have to trick it into thinking you're human.

Don't forget that http is plaintext. To learn how to craft POST requests, just do it normally in your browser and use a tool like burp to look at the traffic.

This guy It's a bash one liner.

Ryder Lee
Ryder Lee

where do I get LSD from?

Ian Green
Ian Green

On the well light interwebs.

Carson Bennett
Carson Bennett

LSD is ok,
but Dimethyltryptamine (DMT) is life changing

Camden Ortiz
Camden Ortiz

how do you do polymorphism in C?

Gabriel Reyes
Gabriel Reyes

code.fb.com/developer-tools/getafix-how-facebook-tools-learn-to-fix-bugs-automatically/
the virgin typechecker vs. the Chad bot

Noah Nguyen
Noah Nguyen

Surprised they weren't doing this earlier. But bots that can edit code is just asking for runaway faults.

Nathaniel Nelson
Nathaniel Nelson

I enjoy using Go and the lack of generics does not bother me in the slightest

Gabriel Powell
Gabriel Powell

C is a legacy language and every programmer worth a damn is moving away from it and learning good languages like Python, Javascript, D, etc.

William Myers
William Myers

Use a forward declared struct and an opaque function declaration.

Thomas Anderson
Thomas Anderson

so I need openSSL, which requires me to install:
Perl 5 + core modules
some sort of perl template
an ANSI C compiler
some sort of C development environment

And once all that is done, I need to presumably run my python code and/or that bash script via a console, and that will make it such that it thinks it's getting an internal request I'm guessing? It's a fair bit, but I'll give it a shot if I can expect some level of handholding. More tutorials I can visit than directly writing my code for me, but I'm flying blind already.

For now, I'd like some clarification as to what that bash command does. Is it just a single, standalone request for a single file? If so, how would I go about looping that to get every page in a gallery? If possible, ensuring that the file being requested has the right extension, checking for a broken link, checking for an existing folder, and automatically progressing through every gallery in a list would be desirable, but if all that has to be done in some language I'm unfamiliar with that could get messy. I'm also on macOS, so I'm unsure if that \r\n shit should be changed.

Joseph Robinson
Joseph Robinson

Brainlet who has just started programming the other week here.

What's a good way to wait for user input in C++?

Say I have a text-based simulation of turn-based combat where you have a menu with different options that do different things in combat. When choosing an option from the menu a function is run that returns various stats from that turn in combat (you did X damage, enemy did X damage, remaining HP etc.) depending on your choice. Now this all runs in a loop that clears screen at the beginning of each cycle (because the menu options are a loop inside that loop). What would be a good way to wait for user input before clearing screen at the beginning of the new loop? Without using System("pause") that is.

Liam Barnes
Liam Barnes

kind of a backwards tool, desu, but pretty cool.
typchecking and compile-time safety in a language like idris would prevent that though.
Don't understand why big companies don't fund a performant FPL. Instead of wasting time developing tools like that.

Christian Wright
Christian Wright

while loop

Evan Ramirez
Evan Ramirez

ask for input "press any key to continue: " at beginning of loop.

David Jenkins
David Jenkins

or at the end rather

Ethan Richardson
Ethan Richardson

u s e l e s s

Kevin Hill
Kevin Hill

Why is it nobody have made a good programming tutorial that tackles the important stuff for every language?
I mean, any programming language can be taught in 5 minutes, but every resource out there seems to think they need to educate middle schoolers how to write hello world in slightly different syntax.

Am I wrong? Why can't the blogger moms spend their time with more useful things?

Aaron Carter
Aaron Carter

Wait, could I use the python function os.system() to run an nc http bash script from within Spyder and have it work?

Matthew Morris
Matthew Morris

tutorial means you follow along with it and how do you follow along with a tutorial that isnt for a specific programming language?

Ryan Green
Ryan Green

because
1. there are more beginners than experts so you're biased by the visibility of the resources
2. most if not all "important" stuff is independent od languages

Joshua Edwards
Joshua Edwards

compile time type-checked state machines are useless
(you)

Cooper Howard
Cooper Howard

Undefined Behaviour
useful

Zachary Adams
Zachary Adams

uwotm8

Oliver Martinez
Oliver Martinez

I have a cs degree, and almost 2 years of ABAP experience (jesus...).

I feel like with my current job I'm getting sucked into a niche. Abap is unruly beast of a language to fuck with. Nobody at my job wants to learn it so me and two other devs do it, even though the whole foundation of the front end web is SAP.

I want to learn another marketable skill. I think javascript would be a good path.

I'm thinking of starting here with beginner to advanced:
rithmschool.com/courses

then moving on to this book.

any thoughts or recommendations would be appreciated.

Attached: cover.jpg (98 KB, 465x640)

Nicholas Scott
Nicholas Scott

or should I skip the beginner courses and just do the book,

I understand programming, like recursion, object oriented blah blah blah

Christian Reyes
Christian Reyes

Just an edit:

if len(url_list) == 0:
print("No doujins were in the list, onii-chan!")
elif count == 0 and len(url_list) == 1:
print("Your doujin failed, onii-chan!")
elif count == 0:
print("Your", len(url_list), "doujins failed, onii-chan!")
elif count == 1 and len(url_list) == 1:
print("Your doujin finished, onii-chan!")
elif count == len(url_list):
print("Your", count, "doujins finished, onii-chan!")
else:
print(count, "doujins out of", len(url_list), "finished, onii-chan!")

It's less lines than having a bunch of str8 = "onii-chan", str9 = "Your doujin" garbage.

Grayson King
Grayson King

I'm writing an IRC bot, spending several hours on it each day, so far 10k+ effective sloc and something I'm proud to put my name to. I only knew shell scripting and just taught myself as I went. Language of choice is D and it's wonderful, though I'm pretty useless outside of it.

But no compsci degree, just random "systems engineer" junk; two programming classes, databases, fucking UML.

What do? Should I even worry, or should I drop everything and get the formal education? Country is Sweden.

Andrew Murphy
Andrew Murphy

you have a cs degree from where? ITT Technical Institute?

Lucas Sanders
Lucas Sanders

0/10

Hunter Ross
Hunter Ross

D
Good job wasting your fucking time.
Also, 10k for an IRC bot sounds incredibly bloated.

Gavin Russell
Gavin Russell

Formal education is fun. I wish I could go back and get my masters in CS. But now I'm trapped

Juan Nelson
Juan Nelson

Why do people use packages for using Database commands/queries like i don't know, SQLAlchemy for Python or Sequelize for Node that let them use those SQL commands inside their js (for example) code instead of just opening an sql file with the necessary query when its needed?

Attached: 131342535.jpg (64 KB, 1106x1012)

Angel Rodriguez
Angel Rodriguez

This website is toxic, vitrolic and just a cesspool of low quality content.

How do I leave and sit on stack overflow like the good programmers?

Aaron Murphy
Aaron Murphy

It's cool to hate but I don't really see it.

Jayden Phillips
Jayden Phillips

don't worry lad, shitposters absolutely seethe at d but have no real argument against it besides >muh gc

Jayden Gonzalez
Jayden Gonzalez

I can't really see the hate that JS receives after i have been using it for a bit, my only problem with JS environment is how fucking bloated the frameworks are. Oh and ESlint sucks massive dick

Attached: 367373467.jpg (41 KB, 477x477)

Matthew Gutierrez
Matthew Gutierrez

give ResaonML a look, it's pretty cool.

Adam Bailey
Adam Bailey

Why do compilers optimize x+1>x to always return true?

First of all, if this was actual math, then
x+1>x
1>0
True.

But its not math. Computing is not math. That plus and inequality and that x are not mathematical operations or set elements. Because you have limited precision/range. Math does not have limited precision/range. So whats the argument? Compilerfags claim undefined behaviour. But they also talk about the mental model of arithmetic. Adding 1 to that x is not arithmetic because you have overflow.

Jaxon Diaz
Jaxon Diaz

x+1>x

x>x-1

By any definition you look at it x+1>x IS true,

Ryan Sullivan
Ryan Sullivan

It's a language with no audience and absolutely no compelling reason to use it.
- GC immediately makes it non-viable for systems programming.
- Not "easy to use" to attract the type of shitters that use Python.
- Not POOey enough for any enterprise use to give a shit.
- Not functional.
- No "big project" that shows anyone that it's actually viable to build anything complicated. (e.g. C had Unix)

Honestly, it's a language that doesn't stand out in any way at all. It's completely "meh", and has no niche that another language doesn't do 5 times better.
Nobody looks at D and says "Wow, that feature is so great, it's worth spending the time and effort to invest learning it and writing new programs in it."
It's the equivalent of a B- student; nobody gives a fuck and they're just forgotten.

Thomas Lewis
Thomas Lewis

Do people unironically learn programming languages after their first programming course? You should know how to program in every language after CS101. Programming languages are a means to an end.

Attached: 1486920738799.png (12 KB, 420x420)

Elijah Ward
Elijah Ward

I agree with what you are saying. But I need to into javascript and react so I can jump ship from abap, look at what I deal with every day:

en.wikipedia.org/wiki/ABAP

Attached: loio237a5d02cd234a658b318be7c67d6e22-HiRes.png (48 KB, 507x520)

John Young
John Young

It's undefined behaviour.
Get the fuck over it; the compiler is allowed to do whatever it wants.

Stop posting your cancerous gay frogs.

Joseph Scott
Joseph Scott

learnxinyminutes.com/docs/javascript/

James Davis
James Davis

please refrain from talking about a language you know nothing about as none of your points are valid.

Ayden Cooper
Ayden Cooper

Thanks, I've added this right before the end of the loop:

cout << "Press Enter to continue." << endl;

do{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}while(GetAsyncKeyState(VK_RETURN) == 0);

And it works fine now.

Austin White
Austin White

I've looked at D, and I've looked at the shlock that you necrophiles post on here.
I have not been impressed by the language at all.

Levi Fisher
Levi Fisher

this is just rotatef

Wyatt Howard
Wyatt Howard

Does boolean short circuiting also guaranteed in function return statement?
assuming foo and bar has side effects

bool foo();
bool bar();
bool foobar()
{
return (foo() || bar());
}

if
 foo() 
returns false, is code] bar() going to be evaluated?
Is it compiler / system depended behavior or guaranteed in C and C++?

Liam Roberts
Liam Roberts

That's because you're retarded. If you can't see why D is superior to C++ you should just end it.

Oliver Scott
Oliver Scott

Being slightly better than an F- isn't a win in my book.

Kayden Thomas
Kayden Thomas

I made a script that use the Jow Forums API to find the posts with the most replies on a given board
Pic related is a run with Jow Forums and a minimum of 12 replies (posts with less replies than the minimum are not shown)

I like it, but it takes a lot of time to run because it respects the rule "Do not make more than one request per second."
It makes one call to get all the thread numbers of a board, then one call per thread
Total: 151 calls, 2 mins to run

Any ideas how to make it better?

Attached: Screenshot-from-2018-12-06-12-51-21.png (103 KB, 666x607)

Dominic Thompson
Dominic Thompson

If it can solve caprchas or avoid then count me in

Cameron Lopez
Cameron Lopez

C works best when used as intended

Austin Peterson
Austin Peterson

if
foo()
returns false, is code] bar() going to be evaluated?
yes, retard

Gabriel Myers
Gabriel Myers

I made a C prorgram that creates a file with fopen and saves a single struct instance to it
When I open the file with a hex editor I see the struct data at the top and then thousands of 0s and then some mess of data at the bottom
why?

Levi Reed
Levi Reed

Post code.

Christopher Sanchez
Christopher Sanchez

the world is unjust

Jose Thomas
Jose Thomas

This script only reads the data, you can't post anything

Jacob Robinson
Jacob Robinson

Can you introduce (restricted) user-defined implicit conversions to a HM type system without completely breaking the inference algorithm?

Ryder Green
Ryder Green

just 2 more projects away from my

Responsive Web Design Certification

on freeCodeCamp.org

Carter Hill
Carter Hill

freeCodeCamp.org
camelCasing by default now...
i just may be a developer in development

Brody Moore
Brody Moore

Wow, that's incredibly cool!

What other certifications can you get on freeCodeCamp.org?

Zachary Price
Zachary Price

Responsive Web Design Certification (300 hours)
Javascript Algorithms And Data Structures Certification (300 hours)
Front End Libraries Certification (300 hours)
Data Visualization Certification (300 hours)
Apis And Microservices Certification (300 hours)
Information Security And Quality Assurance Certification (300 hours)

Levi Ross
Levi Ross

Wow, and all this for free?

John Robinson
John Robinson

Don't you need facebook for that?

James Ramirez
James Ramirez

is freecodecamp.org legitimate

Samuel Perry
Samuel Perry

free to me, yeah
but many have donated time/money/volunteer

once i'm gainfully employed, it's gonna be my charity giving place.

no, but you should link to github with it

amazingly, yes. not every, but many employers take people who's only certs are from fcc. (search around linkedin and see)

Leo Perez
Leo Perez

[6 - 3rd user]

Aiden Perry
Aiden Perry

#include <stdio.h>

struct dat{
int id;
char name[16];
};

int main(void)
{
struct dat d = {50, "hello"};
FILE *fp = fopen("file", "wb");
fwrite(&d, sizeof(struct dat), 1, fp);
fclose(fp);
return 0;
}

Parker Williams
Parker Williams

cute GRC (CoC)

Attached: Screenshot-20181206-133253.png (145 KB, 1080x1633)

Aiden Howard
Aiden Howard

You don't need to return 0 in main if you're using c99 or later. Do sanity checks, they help you keep your sanity. Make sure *fp isn't null

    FILE *fp = fopen("file", "wb");
if (!fp)
{
fprintf(stderr, "unable to create file: ");
perror("");
exit(EXIT_FAILURE);
}

David Perry
David Perry

stack has adopted one
By Michael Snoyman
snoyberg
this shit writes itself.

Jayden Martinez
Jayden Martinez

thanks for answering my question

Parker Jones
Parker Jones

I really don't see where you're getting at

Attached: images.jpg (5 KB, 225x225)

Asher Parker
Asher Parker

Sheesh, I'm not the one who asked for your code, and I'm just giving you some pointers. At least I'm not some retard who can't debug my own C program. Works fine on my machine.

Tyler Anderson
Tyler Anderson

not flattering enough.

Attached: 49415?s=400&v=4.jpg (17 KB, 400x400)

Andrew Wilson
Andrew Wilson

assertions are gay, my code never has bugs in it

Henry Rogers
Henry Rogers

using asserts

James James
James James

Post the big name software written in D

Jacob Kelly
Jacob Kelly

potato potahto, asserts, error handling, all for queers

Joshua Diaz
Joshua Diaz

He looks like a fucking pedophile. wtf

Xavier Jackson
Xavier Jackson

Dumbass nigger. wiki.dlang.org/Current_D_Use

Oliver Young
Oliver Young

just a coincidence, don't think anything of it. Just embrace the gentle subversion of meritocracy.

Thomas Lopez
Thomas Lopez

my code never has bugs in it
all for queers
So is LARPing.

Bentley Nelson
Bentley Nelson

The fact that a company for DAW plugins picked D is more impressive than anything at Facebook.
Audio processing is serious shit on par with a kernel.

Oliver Russell
Oliver Russell

Nothing there is of any importance

Matthew Lopez
Matthew Lopez

microdosing LSD
How does that even work? Wouldn't your tolerance go up so quickly that the dose wouldn't be so micro any more?

I can't even take acid 2 days in a row without tripling the dose.

Alexander Price
Alexander Price

lmao doesn't count
classic

Ryder White
Ryder White

Haskell is a cult. Functional Programming is a fad.

Daniel Hall
Daniel Hall

Google it dummy. Stop acting like you know everything. Also reddit spacing.

Kayden Watson
Kayden Watson

thanks user

Cameron Thompson
Cameron Thompson

been learning on codepen.io
but in vs code, how do i have a .html AND a .css and make them work together when i want to test in on my local browser?

Leo Reyes
Leo Reyes

Is it worth it to go to Udemy to learn programming? Are the lessons worth paying for?

Attached: 271036E5-A1C7-4702-A89E-AC4CC9E49EE1.jpg (158 KB, 800x450)

Logan Clark
Logan Clark

Wow, that's pretty cool actually. Signal processing is no joke, and DAWs presumably have a decent number of real-time requirements.

Jeremiah Morales
Jeremiah Morales

Sure, but what I consider essential information about a language falls under how to write, how to run and how to find documentation.
Say you are telling a person to write C++ for the first time.
Best practices, syntax and how to write loops are irrelevant if you don't know how to include a library and how to structure the files in your project.

Something as simple as structuring files in a project, understanding how libraries are linked and stuff like that is absolutely crucial to do any real work with c++, yet it is not what tutorials start with.

But lets take a scripting language instead. How you split functions into separate files is also crucial, learning how to run the stuff and what linters and documentation to use is also important.
New users need to get beaten over and over again until they submit to the right way™ of doing things, but some scripting tutorials skip this part completely.

Dominic Stewart
Dominic Stewart

Questionable effectiveness and telling random people to do LSD is fucking retarded.

Carter Morgan
Carter Morgan

//boards.4channel.org/g/catalog#s=wdg%2F
but even that is too stupid and basic a question for them.

Adam Wilson
Adam Wilson

i wanna fug that smug

Xavier Hernandez
Xavier Hernandez

U w U

module dsets;

/// dsets is an implementation of disjoint sets. It is implemented
/// with a simple class. To construct it, you provide the maximum node
/// number.
public class DSets
{
private:
ulong[] ids, heights;
public:
/// A `DSets(10)` would create a disjoint set of 0 to 10
/// inclusive.
this(ulong maxN)
{
ids.reserve(maxN + 1);
heights.reserve(maxN + 1);

foreach (n; 0 .. maxN + 1)
{
ids ~= n;
heights ~= 0;
}
}

/// Returns the root id of a given node
ulong getRoot(ulong n) const
{
ulong result = n;
while (ids[result] != result)
result = ids[result];
return result;
}

/// Connect two nodes. Does not check membership so may throw
/// errors
void connect(ulong n, ulong m)
{
auto nRoot = getRoot(n), mRoot = getRoot(m);
if (nRoot != mRoot)
{
if (heights[nRoot] >= heights[mRoot])
{
ids[mRoot] = ids[nRoot];
heights[nRoot] += heights[mRoot];
}
else
{
ids[nRoot] = ids[mRoot];
heights[mRoot] += heights[nRoot];
}
}
}

/// Check if two given nodes are connected.
bool connected(ulong n, ulong m) const
{
return getRoot(n) == getRoot(m);
}

ulong length() const @safe
{
return ids.length;
}

// TODO: implement disconnectNode, toArray

/// Add a node
void grow(ulong nodes = 0)
{
auto toAdd = ids[$ - 1];
foreach (_; 0 .. nodes + 1)
{
ids ~= toAdd++;
heights ~= 0;
}
}

}

Camden Sanchez
Camden Sanchez

Holy mother of god. posting this to /r/badcode

Justin Smith
Justin Smith

garbage

Attached: dib.jpg (10 KB, 200x349)

Camden Taylor
Camden Taylor

What the fuck do you think an opaque pointer is in C? Most major C libraries are like OOP based C++ libraries. Instead of a stack allocated instance of a class, you have an opaque pointer which is initialized by a function (i.e. the constructor) and you pass the pointer into functions that behave the same way as their member function versions except with an extra parameter containing a pointer to the objects instance.

Eli Davis
Eli Davis

post link when you do.

Asher Morris
Asher Morris

Is this a good place to learn C? nand2tetris.org/

Aaron Flores
Aaron Flores

Not him, but what's so bad about it?

Attached: 1535660691549.jpg (74 KB, 1280x720)

Hunter Jackson
Hunter Jackson

read how it's implementet in cpp and rewrite

Ian Taylor
Ian Taylor

Ah, Microloo

Brody Rogers
Brody Rogers

forgot link
github.com/Microsoft/malmo/blob/master/Minecraft/src/main/java/com/microsoft/Malmo/EpisodeEventWrapper.java#L72

Michael Lopez
Michael Lopez

that sounds very unsafe

Michael Sanchez
Michael Sanchez

In what sense do you mean?

Christopher Robinson
Christopher Robinson

Is there any simple React Native guide for beginners? I have a way to add things into SQLite with a simple form but can't figure out how to add edit/delete functions.

Nicholas Bell
Nicholas Bell

//boards.4channel.org/g/catalog#s=wdg%2F

Juan Clark
Juan Clark

Slapping a vtable onto a struct gets you 99% of the way there.

Luis Adams
Luis Adams

Is "homo morphic" the opposite of polymorphic? If so what is monomorphic code?

Attached: 1536627302518.jpg (278 KB, 1905x1372)

Austin Barnes
Austin Barnes

homo is the opposite of hetero

Hudson Jenkins
Hudson Jenkins

fukken saved

Jonathan Phillips
Jonathan Phillips

You're not supposed to take LSD every day, dumbass

Carson Brooks
Carson Brooks

some people think that cross-dressing increases their programming skills

Joshua Morgan
Joshua Morgan

jowforums.com/thread/68798646/technology
is radix sort user still here?

Julian Gonzalez
Julian Gonzalez

I'm trying to learn C whilst avoiding K&R completely.
Modern C (Jens Gustedt) [icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf] is recommended for beginners all the time but look at like page 2-3, they throw a lot of shit at you at once.
Is this really for beginners learning the language?

Hunter King
Hunter King

I'm trying to learn C whilst avoiding K&R completely.
this is how you not learn it

Blake Turner
Blake Turner

they are mentally ill, recently banged one and she was mad that I ruined her clothes

Michael Gutierrez
Michael Gutierrez

she

Aiden Sanchez
Aiden Sanchez

do you own a thinkpad running arch too

Gabriel Wilson
Gabriel Wilson

fucks and bully trannies
but THEY are the mentally ill

Andrew Morgan
Andrew Morgan

and she was mad that I ruined her clothes
Sounds like an appropriate reaction. Why would you ruin someones clothes?

Carson Hill
Carson Hill

I am starting to regret starting a job as a software dev
...in a company that still uses Delphi.
I quite like Pascal, but having to integrate third party .NET assemblies into Delphi software is a nightmare.

Dominic Smith
Dominic Smith

Convince them to upgrade to Ada 2012. Dunno about that .NET shit though.

Luke Hall
Luke Hall

There's a difference between undefined and unspecified behavior.

John Powell
John Powell

She's very cute. I'm accepting of this for now.

Asher Thompson
Asher Thompson

Your struct pointer is not a void pointer. Cast it and see what happens.

Oliver Hughes
Oliver Hughes

My last job did real-time position-based echo cancelling from 9-16 mic arrays, as well as trigger listening (like bullets), and probably some spying shit, all in C.

Adrian Smith
Adrian Smith

noone answered in sqt, so I'm here now.
What do I do if I want to use an external library in my C++ project? Do I just copy the source to my project folder?
Say, I wanna use Boost's regex? Do I just copy the whole Boost?
(brainlet question, I know, I'm too spoiled from Maven and Gradle)

Anthony Sanders
Anthony Sanders

Too bad the VST sounds like utter dogshit.

Asher Watson
Asher Watson

Why the fuck does python not have c-style for loops? If i want an index i need to do the range(len()) conga and even then you can't modify it, I love python but that's beyond retarded when other languages have both for and foreach. Reeeeeeee

Juan Price
Juan Price

Is it dynamically or statically linked? If dynamically linked, you only need to include the headers and link object files I think. For static linking, you would have to compile each file, and I think "modern" compiling let's you get away with not using headers, but they're still good to have.

Brody Carter
Brody Carter

C doesn't have foreach tho?

Bentley Perry
Bentley Perry

shit, didn't even know the terms statically and dynamically linked desu, need to look that up

William Long
William Long

for is just syntactic sugar for while anyways

Lucas Reyes
Lucas Reyes

there's a difference between undefined and implementation-defined

unspecified behavior is one of those two

Easton Robinson
Easton Robinson

reading k&r is a waste of time if you already know the basics of programming

Jackson Garcia
Jackson Garcia

Because C style loops are old, outdated, and ugly.

Blake Gray
Blake Gray

which is syntactic sugar for goto

Grayson Taylor
Grayson Taylor

pic not related

I want to write a very basic version of object pooling in C, where you cant allocate new objects if there is nothing left in the pool.

So i have an array lets say

Sprite sprites[MAX_SPRITES];

when a sprite is in use:

sprite.is_used = 1

when a sprite is not in use:

sprite.is_used = 0.

So say I want to "create" a new sprite, do I have to iterate over all the sprites from i=0 to MAX_SPRITES and check whether or not one of them is not in_use? So that the algorithm is now O(n)? Or is there some faster way?

Attached: rei.png (138 KB, 332x332)

James Ross
James Ross

you maintain a seperate linked list of deallocated objects

Bentley Mitchell
Bentley Mitchell

linked in what sense?

Ian Lee
Ian Lee

A freelist tends to be the solution. Every time you remove an object you add it to the free list (can just be a linked list or an array/stack). The creation process looks at the free list to see if there's a sprite available for reuse.

I would probably have separated the sprite is_used field from the actual sprite unless you're gonna introduce much more advanced structures for managing sprites.

Nicholas James
Nicholas James

Well currently when drawing my drawing algorithm loops over the sprites array, checks if it in use, and if it is, draws it, otherwise skips it. So thats probably bad too.

Colton Rogers
Colton Rogers

I am going to write a Jow Forums cli/curses client. Should I call it 4curses or 4cli or something else?

Joseph Bailey
Joseph Bailey

Class Sprite {
nextFree:Sprite
...
}

Class SpritePool {

freeSprite:Sprite
sprites:Sprite[MAX_SPRITES]

Function AllocSprite:Sprite() {
if (!freeSprite) {Error("Out of sprites")}
s:TSprite = freeSprite
freeSprite = s.nextFree
return s
}

Function DeallocSprite:Sprite(s:Sprite) {
if (freeSprite != null) {s.nextFree = freeSprite}
freeSprite = s
}

}


Something like this
Not featured is when you allocate the spritepool, you both fill the array and fill the linked list

Xavier Young
Xavier Young

No not really. I'm just thinking it's a shame to waste at least 8x the memory in storing a bool like that.
It depends on the actual use-case how bad/good this solution is.

Colton Watson
Colton Watson

New thread:
jowforums.com/thread/68814458/technology
jowforums.com/thread/68814458/technology
jowforums.com/thread/68814458/technology

Josiah Gutierrez
Josiah Gutierrez

I am not planning to have more than say 32-64 sprites active at the same time, so I could possibly pack it in a single 32bit or 64bit integer by setting/clearing bits if the corresponding sprite is in use. Then loop over the bits. That would certainly save memory.

I dont understand this approach... Do I intialize the sprites in order?
So at the beginning of the game 0 -> 1 -> 2 -> ... etc?
So how does this work if I wanted to get an index of a free sprite? (or return -1 lets say if there was no free sprites)

Julian Ramirez
Julian Ramirez

okay how do I learn things about the C language and how to use it. Don't say read others code please because they could write some errors and also if I'm learning I can't understand someone developed enough to actually write a program

William Carter
William Carter

you dont need the index of a free sprite. you ask for a sprite using AllocSprite and it returns you the sprite at the top of the list

William Reyes
William Reyes

I.... Don't have enough experience coding.
For an example: I have no idea how to make my own exceptions and what MVC is and what belongs in it.
I do not know what observable classes are.
I tried to work with a college project, but I willingly dropped out after taking longer in figuring out shit then it was taking longer than the deadline allowed.
Failed two sprints.
How can I remedy this?
My idea was to finish the project on my own with their guidelines, then do a project from the previous year of that class to get more experience in.

Carson Brown
Carson Brown

Don't optimize too readily. If you had 64 unique entities, and each had as much as KB of memory in use, that's only 64KB. If you're making a dumb little game, it's fine. Obviously it wouldn't scale well to 1000x unique units (oh gosh a megabyte!), but you find in a lot of things, they don't go overboard with optimizing and algorithms. Reducing redundancy goes a lot further before you start optimizing object sets.

An example: Say you had 1000 units. You want it to be 'dynamic' you have your super duper algorithm which tracks your objects and whatever and moves things around, deleting, allocating, etc. Say I make a single struct/array for them, and check every single unit every iteration. Sounds stupidly inefficient right? I only use 1000 cycles to check a flag if units exist. There is no dynamic element movement. If I really want to I can add a queue, so only after I ram through the stack do I check if I should "remove" units i.e. set an existence value to 0. Doing this with multiple requires a queue or mutex'ing, but that would exist in any algorithm which was moving/inserting/deleting random elements. Say I exceed 1000 units. I can allocate another single 1000 block, and have a block-check flag which goes through each additional 1000 for stuff to do. 2000 cycles, + maybe a single pointer retrieval/access.

Disable AdBlock to view this page

Disable AdBlock to view this page

Confirm your age

This website may contain content of an adult nature. If you are under the age of 18, if such content offends you or if it is illegal to view such content in your community, please EXIT.

Enter Exit

About Privacy

We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. We also share information about your use of our site with our advertising and analytics partners.

Accept Exit