[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: 319
Thread images: 31

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
What are you working on, /g/?

Old thread: >>60442822
>>
thank god that nagato autist didn't get here first
>>
File: mokou.png (146KB, 460x360px) Image search: [Google]
mokou.png
146KB, 460x360px
Can someone code up a program that makes me not get lung cancer even if I smoke a pack a day?
>>
File: 1488150918163.jpg (854KB, 1000x1319px) Image search: [Google]
1488150918163.jpg
854KB, 1000x1319px
Would it be easier to design an AI procedurally than to keep banking on "machine learning" to somehow "machine learn" how to simulate human-level consciousness?
>>
>>60449154

Too complex to program.
>>
>>60449154
In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.

"What are you doing?", asked Minsky.
"I am training a randomly wired neural net to play Tic-tac-toe", Sussman replied.
"Why is the net wired randomly?", asked Minsky.
"I do not want it to have any preconceptions of how to play", Sussman said.

Minsky then shut his eyes.
"Why do you close your eyes?" Sussman asked his teacher.
"So that the room will be empty."
At that moment, Sussman was enlightened.
>>
public class extraCreditPath extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
// Create a pane
Pane pane = new Pane();

Rectangle rectangle = new Rectangle (0, 0, 25, 50);
rectangle.setFill(Color.ORANGE);

Circle circle = new Circle(125, 100, 50);
circle.setFill(Color.WHITE);
circle.setStroke(Color.BLACK);

// Add circle and rectangle to the pane
pane.getChildren().add(circle);
pane.getChildren().add(rectangle);

PathTransition pt = new PathTransition();
pt.setDuration(Duration.millis(4000));
pt.setPath(circle);
pt.setNode(rectangle);
pt.setOrientation(
PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
pt.setCycleCount(Timeline.INDEFINITE);
pt.setAutoReverse(true);
pt.play(); // Start animation

circle.setOnMousePressed(e -> pt.pause());
circle.setOnMouseReleased(e -> pt.play());

// Create a second smaller circle.
Circle circle2 = new Circle(80,90,7);
circle2.setFill(Color.CYAN);
circle2.setStroke(Color.DARKORANGE);

// add circle 2 to pane
pane.getChildren().add(circle2);

// create a second path transition.
PathTransition pt2 = new PathTransition();
pt2.setDuration(Duration.millis(4000));
//trouble with path here>>
pt2.setPath(rectangle);
pt2.setNode(circle2);
pt2.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
pt2.setCycleCount(Timeline.INDEFINITE);
pt2.setAutoReverse(true);
pt2.play();

// Create a scene and place it in the stage
Scene scene = new Scene(pane, 250, 200);
primaryStage.setTitle("PathTransitionDemo"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}

public static void main(String[] args) {
launch(args);
}
}
>>
>>60449116

Our only choice is to emulate nature by creating bigger and bigger brains until eventually they become sentient.
>>
>>60449200
I need to make the smaller circle trace the rectangle, that is tracing the bigger rectangle.

here are the javafx libraries:

import javafx.animation.PathTransition;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.util.Duration;

Any advice? Currently the smaller circle just traces an invisible rectangle.
>>
whats a good place to learn python
>>
>>60449241
Middle school.
>>
>>60449241
>>>/g/wdg
>>
What is man supposed to use when here's just no good statically typed and compiled language.
>sml
no good implementaion
>ocaml
sml with shitty syntax, also does not support native threads
>lisp
too verbose, also static typing not standardized
>c
decent but manual memory management is annoying in prototyping phase
>sepples
cluster fuck that no sane person would touch
>d
can't decide if it wants to have gc or no
>rust
better stay away from it because it attract lot of crazy hipsters, also uglier than sepples
> any jvm/clr lang
requires huge vm
>go
Rob Pike is faggot, also no macros
>haskell
generates garbage 1GB/s
>chapel
cannot use libraries that was compiled with it...

Chapel seemed promising but fuck. Trying ats next.
>>
>>60449265
I'll save you the time. ATS is pretty disgusting.
>>
>>60449265

Java
>>
>>60449063
private tracker + indexer as a standalone docker cluster.

chihaya + prometheus + mariadb + nginx + uwsgi

front-end is angular with pyramid serving from the backend.

there are things in JS, Go, Python, and some Lua. all on CoreOS.
>>
>>60449372

Can we all have invites and 50TB of buffer before you suddenly make it so it's impossible to gain upload making new users hate us old users who didn't do anything but are set for life.
>>
>>60449372
something something link to wdg
>>
Warning to the wise. The memory safety agenda has a solid foothold with the FTC, it's not backing down any time soon. In a few years, systems programming may very well be outlawed.
>>
>>60449416
its not really a site i'm planning on running its more like i'm making a sort of drop in deployment so that if somebody wanted to run one, theyd fill out a config file with some info, wait a few minutes, and have a pt + indexer running.

>>60449519
lol why, because it has a web front-end? smfh how do you browser your pt torrents m8
>>
>>60449528
what does this even mean?
>>
>>60449528
Brb learning Rust
>>
File: 1450214166479.jpg (58KB, 500x487px) Image search: [Google]
1450214166479.jpg
58KB, 500x487px
>>60449200
>>60449224
No one here fucks with JavaFX?
>>
File: haskell ffi.png (5KB, 442x55px) Image search: [Google]
haskell ffi.png
5KB, 442x55px
justwerks.png
>>
>>60449773
buf free returns void. Why is it IO()?
Also are you sure that won't mess up the gc?
>>
sepples modules when?
>>
>>60449836
C/C++ "void" is a unit type
IO because it's a procedure and not a pure function

You can (unsafely) import as non-IO
>>
>>60449880

sepples needs an import system that's not shit
>>
im learning java and I was looking for tutorials to build awesome windows apps, like a notepad or my own music player, however it seems java is now only use for database and boring old stuff, as a web developer should I be learning C# and .net those seems like the programming languages use to make apps and cool sht and are rising in popularity
>>
>>60449836
IO () is the same as void in C
>>
>>60449927
no one downloads desktops apps anymore those have viruses its all web shit nowadays
>>
File: js.jpg (29KB, 614x166px) Image search: [Google]
js.jpg
29KB, 614x166px
What do you all think of this?
>>
>>60450020
true
>>
>>60450020

please save us wasm
>>
>>60450020
Can we imply that JavaScript is telling the web to eat software, and transitively, the world?
>>
>>60450020
people can have shit taste
>>
>>60450051
>>60450051

this statement has nothing to do with taste..
it is an observation
>>
C++ problem here. I have a class that has two members like these:

std::vector<std::vector<MyType>> row_oriented_storage;
std::vector<MyType> *row_ptr;


The following all happens in the class constructor. I initialize the storage and then set the row_ptr to point at the first row like this:

row_ptr = &row_oriented_storage.at(0);


Then I initialize a vector of objects that are supposed to hold a pointer like that and have a constructor like this:

Stuff(size_t, const std::vector<MyType> * const &);


I pass row_ptr to all of them without setting it to anything else or modifying the underlying vector. My problem is, as soon as the for loop ends that constructs the Stuff objects, their member pointers get fucked up as if they got destroyed or went out of scope. The thing is, row_pt at the time is still pointing to a valid object. My question is: how do I fix it so that my Stuff objects point at the same thing as row_ptr?
>>
>>60450020
>>60450020


we should just stop fighting the inevitable..

and to become valuable programmers, should embrace javascript and all it's faults.

cant stop whats already happening
>>
>>60449919
oh hey my name is curtis
>>
>>60450120
no its all about compiling to js that way you dont have to actually program in it.
>>
>>60450120
Does javascript even have variable scope?
>>
>>60450178

yes
>>
>>60450178

the only scope Javascript has is global or function.

if you forget to declare then congrats, you just made a new global.
>>
Why is functional/procedural code so rare outside of c/php<5/lisp? I'm talking ball of mud lisp style, where everything is top-down, and everything is a function. It's easy to test, modular, and efficient because no heavy lifting being done by object systems etc
>>
>>60450087
yes, my observation that people can have shit taste is not just an opinion
>>
File: parametric.png (616KB, 680x954px) Image search: [Google]
parametric.png
616KB, 680x954px
>>60450298
>completely ignoring Haskell, ML, Prolog, Idris
>>
>>60449299
>any jvm/clr lang
>>
Does SICP actually make you a better programmer, or do you just turn into a mentally ill tranny?
>>
Why aren't I allowed to do
if(arg instanceof Pair<Integer, Point.Direction>)
in Java? It produces the compile time error
illegal generic type for instanceof
.

I thought it was allowed to check for instances of generic types if you specified the types, is it not?
>>
>>60449063
Which is better, C or C++
>>
>>60449586

That sounds like a terrible idea. If you're too stupid to be able to start one without a tutorial that's just editing a config file then there's no chance you're going to be running a secure site.
>>
>>60450340
Of those I am only familiar with Haskell but I found it to be too strict on purity. What I really want is something like clojure but not built on java or javascript.
>>
>>60450352

Look we've been through this. This is a java board for java people so just grow up and use java like a professional business person instead of being a sweaty c user living in a basement and molesting children.
>>
>>60450423

type erasure means that the contents of the angle brackets are not known at runtime

as far as the JVM is compared your arg is just a Pair, it can't check if it's a Pair<T, U>
>>
>>60450444
C is better.
C++ has no philosophy and can't be used properly.
>>
Whats the most comfy way to learn programming on ubuntu/variants, on windows I use dev-C++ for my c IDE as its just convenient to have the hotkey for compiling and running, I like that the bracket indentation is what I'd naturally do.

I've tried code blocks on ubuntu but honestly having to tell it over and over that I'm starting a C file by picking from the list is annoying, ctr+shift+n for a new file is bleh, and the bracket completion might as well not exist because it doesn't space them out at all anyway.
>>
>>60450444
c++, definitively
>>
>>60450508

for brainlets like you perhaps
>>
>>60449154
successful AI systems use ML to solve non-trivial optimization problems, but the general structure of the system is procedural

if you look at AlphaGo for example there is an obvious procedure: first we build a predictor for the next move in a given professional game, then we play those predictors against themselves and predict which one will win...there are multiple training stages, but the sequence of stages and the specific problems they solve are completely procedural and human-defined
>>
>>60450509
I program with a text editor and a makefile, I don't know why beginners insist on using a gui for everything.
You're the reason GUIs for git exist.
>>
>>60450509
Have you tried sublime ?
>>
>>60450454
wtf are you talking about? its called config management. Im writing config management that automates the deployments of all these resources im not trying to spin up some la-dee-da crap i found on github. There are plenty of resources out there to have a secure config managed deployment.
>>
>>60449265
sepples is the answer. you have to learn restraint
>>
>>60450619

This.

Start with the bare-bones way if your goal is to learn.
>>
>>60450487
Yeah, no, I have no idea what you're saying. Don't even understand what type erasure is when googling.

Is this correct syntax?
if(arg instanceof Pair && ((Pair)arg).first instanceof Integer && ((Pair)arg).second instanceof Point.Direction)
>>
File: DuvC3.gif (508KB, 400x225px) Image search: [Google]
DuvC3.gif
508KB, 400x225px
>>60449063
Just fucking around with boolean algrebra
#lang racket

(module+ test
(require rackunit))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Helper to determine the possible number of variable given minterms or maxterms.
(define (guess-variable-count terms)
(inexact->exact
(ceiling
(/ (log (argmax identity terms))
(log 2)))))

;; Given an integer, get its bits.
(define/contract (integer->bits n)
(integer? . -> . (listof boolean?))
(let loop ([n (abs n)] [acc '()])
(if (zero? n)
acc
(loop (arithmetic-shift n -1) (cons (= (bitwise-and n 1) 1) acc)))))

(define (pad-left ls v desired-length)
(if (< (length ls) desired-length)
(pad-left (cons v ls) v desired-length)
ls))

(define (minterms->procedure minterms [n (guess-variable-count minterms)])
(define terms
(for/list ([term minterms])
(define bits (pad-left (integer->bits term) #f n))
(λ args
(andmap
(λ (var bit)
((if bit
identity
not) var))
args
bits))))
(λ args
(unless (= (length args) n)
(error "bad args"))
(ormap (λ (term) (apply term args)) terms)))

(module+ test
(let ([p (minterms->procedure '(1 3 6 7) 3)])
(for ([t '(((#f #f #f) #f)
((#f #f #t) #t)
((#f #t #f) #f)
((#f #t #t) #t)
((#t #f #f) #f)
((#t #f #t) #f)
((#t #t #f) #t)
((#t #t #t) #t))])
(check-equal? (apply p (car t)) (cadr t) (~a t)))))
>>
>>60450020
would you jump off a bridge just because everyone else is doing it?

alternatively, would you climb to the top of a software bubble?
>>
fun {a:t@ype} ptr_get0 {l:addr} (pf: a @ l | p: ptr l): @(a @ l | a)
>>
>>60449154
>machine """learning"""
>>>/v/
>>
File: shot0033.jpg (310KB, 1920x1080px) Image search: [Google]
shot0033.jpg
310KB, 1920x1080px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>60449265
Have you looked at these?

Crystal
Swift
Mercury
Scala
Haxe
>>
>>60450340
>Haskell, ML
Broken type systems.
>Prolog
Classical trash.
>>
>>60450691
>>60450691

what a weird analogy.

it has nothing to do with "everyone else is doing it".

it has to do with the job market and where the jobs are at/going to be
>>
>>60450744
Dumb akariposter
>>
>>60450619
>>60450646

I've done it with notepad++ (and whatever the gnome text editor was called) and running compilation through the command line on both windows and ubuntu, even doing so with multiple files, but that can become tedious when you're learning the code, and running compilations on small files over and over not because you made mistakes but because the task the book wants is only a few lines long.
>>
>>60450444
C is better for simple-minded people.
>>
>>60450756
Can you seriously shut the fuck up? It's not fucking funny, you're so fucking irritating, are you fucking five or something?
>>
File: 1464143124471.jpg (1MB, 1412x1200px) Image search: [Google]
1464143124471.jpg
1MB, 1412x1200px
>>60450744
What do you think about quantum computing? Depending on the answer you may or may not get this job.
>>
>>60450649

In Java, generics are really shit.
You're not actually adding to the type, you're just adding invisible casts everywhere.

Because of that, the object itself doesn't contain the generic type. You need to actually go inside the object and tests if its contents are of the generic type, like you've written there.
>>
>>60450781
>it has to do with the job market and where the jobs are at/going to be
hence "would you climb to the top of a software bubble"

the correct answer might be yes if you can jump off in time
>>
File: 2017-05-17-220435_1280x800_scrot.png (189KB, 1280x800px) Image search: [Google]
2017-05-17-220435_1280x800_scrot.png
189KB, 1280x800px
autism simulator
>>
>>60450801
Read what make does, it's literally directed compilation so you don't have to keep running cc or whatever
>>
>>60450020
until CPUs use javascript as instruction set directly, I don't think we have anything to worry about.
>>
File: cake.webm (447KB, 900x506px) Image search: [Google]
cake.webm
447KB, 900x506px
>>60450828
I do think quantum computing is a scam

>>60450785
Sorry. Here a very new programming language for you http://gravity-lang.org

Gravity is a powerful, dynamically typed, lightweight, embeddable programming language written in C without any external dependency (except stdlib). It is a class based concurrent scripting language with a modern Swift like syntax.

Gravity supports procedural programming, object-oriented programming, functional programming and data-driven programming. Thanks to built-in special methods it can also be used as a prototype-based programming language.
>>
File: 1490036168916.gif (259KB, 500x354px) Image search: [Google]
1490036168916.gif
259KB, 500x354px
>>60450820
>Can you seriously shut the fuck up?
That's a rude thing to say, anon
>It's not fucking funny
Are you drunk or something? Why would that be "funny"?
>you're so fucking irritating
Sounds like someone is using a deficient language!
>>
>>60450785
There's nothing dumb about posting akarin, redditnigger.
>>
>>60450883
>dynamically typed
Putting aside that it's impossible, that would be pretty shit.
>>
>>60450893
>hahaha i posted it again and he got mad! :^)^)^)^)^)^

we did it reddit!!!
>>
File: 1493361631368.png (539KB, 617x615px) Image search: [Google]
1493361631368.png
539KB, 617x615px
>>60450883
>In Gravity everything is an object
>>
>>60450947
>i posted it again
What are you referring to?
>:^)
What is that supposed to mean? Is this symbol from some other website I'm not aware of?
>>
File: Keep_Lurking.png (107KB, 400x593px) Image search: [Google]
Keep_Lurking.png
107KB, 400x593px
>>60450883
>scam
Sorry but we're not hiring underachieving undergrads at this moment.
>>
Do any of you have any resources for beginning programming? I want to take it up as a hobby and have literally no idea where to start. I just want to contribute to free software in my spare time. I use gnu/linux and want to contribute to gnu/linux, but I don't even know what language to start with or what goals I should be aiming for. Wat do?
>>
>>60450969
>i'm denying it
holy
shit
you're
so
funny
im
gonna
die

why don't you continue to post the same fucking bait 100 more fucking times in every other /dpt/ for a fucking year
>>
>>60450988
code.org
do the angry bird tutorial
>>
>>60450993
Did I do something to hurt you? You're acting really weird.
>why don't you continue to post the same fucking bait
I sure will if you tell me what made you this way. It seems to work pretty well.
>>
>>60451036
>>60450947
>>
>>60450983
https://pando.com/2014/01/14/d-wave-quantum-computing-or-quantum-scam/
https://www.theregister.co.uk/2015/03/09/quantum_computers_fail/
>>
>>60451050
So no serious reply? Is this some sort of new meta-bait?
>>
>>60450988
Just fucking read
>>
any good machine learning tutorial videos taught my cute girls/women?
>>
this is probably the most retarded question you seen all day.
when running this i can only ever get a 0 as a result. what do?

int m = 0;
do {
JOptionPane.showInputDialog(null, dn+"'s RAM count:");
} while (m >= 1);
>>
>>60451208
>machine """"learning""""
>>>/v/
Your kind isn't welcome.
>>
>>60451222
m is remaining the same forever. try
m = JOptionPane.showInputDialog(null, dn+"'s RAM count:");

this wont compile, can you fix it?
>>
>>60450988
what programming language do you want to learn?
pick one, set up your environment and write hello world in it
then write a guess the number game
then pick up a good text book or do online tutorials
or watch youtube lectures and do the exercises

just learn how to program and then program
>>
I'm nearly 27, am I too old to become a developer?

I want to become a java or c++ dev to get dat cash money, atm I'm nominally a business analyst, but about 90% of my time is spent writing python, so I could argue that I'm a python developer on my CV, and just learn java/c++.

Is 27 too old? I've heard you're basically fucked once you reach 30 as a developer
>>
>>60451272
>you're basically fucked once you reach 30 as a developer
why would that be true? it's not a sport that relies on physical fitness

you can probably learn how to program when you are 60 but most people who are 60 and havent learned to program by that age probably dont have the motivation or interest or passion that is necessary to be a good programmer
>>
>>60451272
>Python to C++
Yeah. The world needs more exploitable shitware. Dumb fuck (((business analyst))).
>>
>>60451272
>developer
Not programming.
>>>/g/wdg/
>>
>>60451301
t. NEET
>>
File: 1410293757378s.jpg (50KB, 555x555px) Image search: [Google]
1410293757378s.jpg
50KB, 555x555px
>>60451272

Yes, the cutoff is 25.

You came so close, anon. Shame
>>
full stack javascript dev here.

mern stack- mongo db, express, react, node, redux.

why are some of you swimming against the tide? javascript devs are in high demand and pay great. one language to code both front and back. being able to do both makes you very valuable.

i dont see why you would mumble about how js isnt a real programming language and sit in your basement clinging to something that isn't in demand.
**if it's a hobby, then by all means follow your passions.

so, why are you all such haters?

(i know the code is flawed. cant change that now)
>>
How did Java become so good though?

Although I'm still comfy with my D :^)
>>
>>60451349
>t.
>>>/b/
>>60451357
>javascript dev
Fuck off back to your containment thread : >>>/g/wdg/
>>
>>60451297
ageism
by 30, if you're not already a lead dev or managerial material, you're basically useless and companies don't want to hire you because you're 30 when they could hire some intern for free since he won't be picky.
>>
>>60451357

Javascript is painful to write. wasm will kill this fullstack=javascript meme.
>>
>>60451272
>>60451272

>fucked once you reach 30 as a developer

what does this even mean?
explain further please...
>>
@60451360
>unironically likes D
I'm not surprised you think java is ""good""
>>
File: 1415490909501.png (83KB, 264x192px) Image search: [Google]
1415490909501.png
83KB, 264x192px
>>60451357

>javascript devs are in high demand and pay great
>>
>>60451375
>ageism
>>>/lgbt/

>>60451387
>meme
>>>/v/
>>
>>60451360
JIT is pretty based
>>
>>60451297
>why would that be true? it's not a sport that relies on physical fitness

Mindset is basically
>Yeah this 30yo guy is good but he won't stay all day in work and will cost a lot
>Let's hire 2 20yos for half the price, and give them free food and beer so they stay here 24/7 with their work friends
>>
>>60451357
want to know something that's in high demand? machine learning. nobody gets phd's related to machine learning anymore because google and uber give them jobs paying $300k/y before they can finish their phds
>>
>>60451257
i'm sort of new to programming and java and i don't really understand what i'm doing. m needs to be an int but it will only work like this if i use a string.
>>
>>60451412
>>60451412

that's a fucking ridiculous reason not to get into coding as a career.

"they probably wont hire me because i cant be bought cheaply with beer and free food".

dude if you can do the job well and are pleasant to work with, then you get hired.
its a skill set.
>>
>>60451401
>>60451401

not sure why that is funny...
both are true.
>>
File: img2.thejournal.ie.jpg (71KB, 630x474px) Image search: [Google]
img2.thejournal.ie.jpg
71KB, 630x474px
>>60451365
>gets angry about the meme but not the NEET bit

That's what I thought
>>
>>60451360
C is printing the wrong result tho
>>
>>60451434
it sounds like you need to turn the result of showInputDialog into an int
>>
>>60451459
You are right
>>
>>60451476
are you the thread police
get fucked dude
>>
>>60451491
gate keeper*
>>
>>60451486
JVM does some good optimizations actually, Java itself isn't that bad, it's so fault tolerant that it enables shitty programmers to come up with a compilable program and that's where it gets the bad reputations
>>
>>60450859
Thats all fine and dandy, but you have to change the makefile every time you wish to compile something new no?

The programs they write in the book aren't very long, and the programs they ask me to write for exercises aren't very long themselves, I made up a simple makefile that runs gcc for me, but every time I moved on to a new problem in the book I'd have to go in and edit the name of the .c file and what the output would be named as well wouldn't i?
>>
>>60451463
thanks for the help. it's working now.
int m = Integer.parseInt( JOptionPane.showInputDialog(null,dn+"'s RAM count: "));
>>
File: Goal destination 1.jpg (61KB, 620x349px) Image search: [Google]
Goal destination 1.jpg
61KB, 620x349px
How do you guys come up with good interesting projects that you are actually care about? I've been trying to finish some but get quickly discouraged seeing that my idea has been already made in the past and it's nothing new
>>
>>60451597
Just use make to wildcard all the .c files in the folder, as your projects grow, this becomes more important because most programs worth using use dozens of source files in multiple directories.
>>
>>60451657
I forgot to add, as your projects grow, compilation will take longer.
You will want to recompile only the bits of the program that changed instead of starting over every time you run make.
>>
>>60450622

I'm saying if you're a dumdum who has to use a prebuilt tracker that does everything for you then you probably don't know enough to keep users safe so the idea of making such an easy tracker won't be that good
>>
>>60451657
What I mean is that the things the book has me doing are single file so far, I've done a little toying around on my own which ended up using multiple files so that I could section things out in one of 4 types and read up on doing that on my own, but that every time I wanted to compile something and test it I'd have to change the makefile, and I dunno using make to wildcard all the .c files means, I'd only heard about make by chance when I was looking at programs that you had to compile when you got it from some website before you mentioned using a makefile for programming.
>>
>>60451756
$(wildcard *.c)
>>
>>60451357

Fuck off you subhuman, this is a java board, we don't want any of your script bullshit.

Get back in the basement!
>>
File: programming language benchmark.png (183KB, 1050x750px) Image search: [Google]
programming language benchmark.png
183KB, 1050x750px
Apparently java is really good. Who knew?
>>
>>60451794

>not pictured: JVM
>>
>>60451769
I meant that I didn't know what it did, does that just compile everything into executables with the names of the .c files?
>>
a girl took the piss out of me at our internship today because i was using vim to take notes. idk if she was trying to flirt (she seems socially awkward), or is it really autistic to use vim to take notes?
>>
File: language triangle.png (17KB, 522x384px) Image search: [Google]
language triangle.png
17KB, 522x384px
>>
>>60451846
It creates a space delimited list of all the .c files in the current directory.
Think about it, you can put it in the
all:
gcc -o prog $(wildcard *.c)
clean:
rm -rf prog
>>
>>60451856

I mean this is obviously bait but if it isn't then I'm sorry for you
>>
>>60451883
why is my life bait?
>>
>>60451856
What does take the piss mean?
I don't know how people people speak in the islamic caliphate of great britain, wales and northern ireland
>>
>>60451916
it's a lewd sexual act common to the region
>>
>>60451486
>>60451794
>>
>>60451916

talk shit
>>
>>60451916
she made fun of me for using vim to take notes
>>
File: language triangleFIXED.png (17KB, 522x384px) Image search: [Google]
language triangleFIXED.png
17KB, 522x384px
>>60451873
>>
How can I divide
 
n = {'5', '7', '3'} // 375

by
 
m = {'0', '2'} // 20

in C not using subtraction method? I'm tired af
>>
>>60451632

Don't start from scratch, anon.

Its not only easier, but also more valuable to fork shit and improve on it OR to actually contribute to other projects.
>>
>>60451916
Ireland here

'On the piss' = Drinking

Therefore if you 'take the piss', it implies you're drunk, i.e. not being serious, or joking
>>
>>60451946
t. butthurt OOPlet
>>
>>60451856
yeah its really autistic to use vim or emacs or anything gnu linux

but autism is the future
>>
>>60451916
>What does take the piss mean?
u fukin takin the piss m8?
>>
>>60451794
>>60451486
not seeing it
$ cat Speed.java && javac Speed.java && time java -cp . Speed 
public class Speed {
public static void main(String[] args) {
int n = 0;
for (int i = 1; i <= 2000000000; i++) {
if (i % 3 == 0 && i % 5 == 0) {
n++;
}
}
System.out.println(n);
}

}
133333333

real 0m2.922s
user 0m2.883s
sys 0m0.025s
$ cat Speed.c && gcc Speed.c -O3 && time ./a.out
#include <stdio.h>

int main() {
int n = 0;
for (int i = 1; i < 2000000000; i++) {
if (i % 3 == 0 && i % 5 == 0) {
n++;
}
}
printf("%i\n", n);
return 0;
}
133333333

real 0m1.970s
user 0m1.945s
sys 0m0.005s
>>
>>60451953

why are you using a char[] to represent an int
>>
>>60451978
>autism is the future
i don't see how autists can claim to be superior to anyone when they sperg out at their mom for not getting them the right brand of tendies.
>>
>>60451953
did you miss out on that day of first grade, anon?
>>
>>60452000
bcuz

>>60452019
I don't know how to implement it. You're free to do it for me though :^)
>>
>>60452037
not happening turbonerd
>>
>>60451882
I literally just read a little of what makefile does, I threw a simple one into my practice folder
ch5make: ch5pe3.c
gcc -o ch5pe3 ch5pe3.c


I honestly don't understand what the commands you're using even do.
>>
>>60452052
But you're so intelligent, anon-kun.
>>
>>60452037

use an int and the problem vanishes
>>
>>60452100
he's obviously doing a cs 101 homework assignment
>>
>>60452068
you have to use "make ch5make" to make your program, right?

putting things in the "all:" rule means you can just use "make".

I highly suggest you read the GNU make manual, it's an invaluable tool for directed compilation and you'll end up writing one generic makefile and using it everywhere.
>>
>>60450178
There's also block scopes with let on ES6.
>>
> cs grad
> programming in C,C++,Java,MATLAB all mah life
> start a project in python because tensorflow
> programming is fun again

Why is python so exciting to use?
>>
>>60452037
>:^)
>>>/v/
>>
File: c vs java users.gif (164KB, 680x485px) Image search: [Google]
c vs java users.gif
164KB, 680x485px
>>
>>60452159
Is this a bot?
>>
>>60452134
when I threw the makefile into the folder it just let me get away with typing "make" into the terminal and it compiled the .c file I specified in the file
>>
triSquares'' :: [Integer] -> [Integer]
triSquares [] = [1,0]
triSquares [0] = [1,0]
triSquares (x:y:xs) = (34*x - y + 2):[x]

doNTimes :: (a -> a) -> Integer -> (a -> a)
doNTimes f 0 = (\x -> x)
doNTimes f n = f . (doNTimes f (n - 1))

nthTriSquareList :: Integer -> [Integer]
nthTriSquareList n = (doNTimes (triSquares) n) []


Prints the nth triangular square.
>>
started reading K&R to 're-learn' C, wondering about this:
> Calls to putchar and printf may be interleaved; the output will appear in the order in which the calls are made.
What does "interleaved" mean? All I get from looking it up is something about bit interleaving
>>
>>60452159
What does tensorflow have to do with vidya, dear sir ?
>>
>>60452170
Are you a bot? Nobody even barely sentient would use plebbit.
>>
>>60451954
Makes sense, thanks!

Do you know any good resources to start finding open source projects or communities?
>>
>all good project ideas have already been done
>all software I use just werks, so nothing to contribute
At this rate I'll never make it into kernel dev
>>
>>60452203
>that fr*nch space
Oh, I see. Your mental illness is showing.
>>>/v/
>>
>>60452198
printf("hel");
putchar('l');
printf("o, wo");
putchar('r');
printf("ld.");
// => hello, world
>>
>>60452198
Forgot to add, does that mean that it allows this:
printf("something %d", putchar('2'));
putchar(printf("something again %d", 2));
>>
>>60452198

Google interleaving and it becomes obvious that it means you can alternate them or whatever and it will all form one continuous output even though they different things
>>
>>60452198
it means SHUFFLED or MIXED you stupid kid
interleave elicits the mental image of mixing sheets of paper, which used to be called leaves in the early 50s
>>
>>60452157
kek
>>
>>60452170
yes
>>
File: 1490556930178.jpg (66KB, 546x618px) Image search: [Google]
1490556930178.jpg
66KB, 546x618px
>>60451632
Try solving open problems.
>>
>>60452231
>>60452235
>>60452237
oh okay, I didn't understand the use of the word, thanks
>>
>>60452242
MODS
>>
>>60452220
ASLR
>>
>>60452232
In C, printf and putchar are both functions.
In C, you can place arbitrary expressions (including numbers, variables, and function calls) in the arguments to a function call.
So yes, you can do that.
>>
>>60452198
better try something like Pointers on C by Kenneth Reek, K&R is more for historians
>>
>>60452170

I think it's actually some guy that just sits here for maybe 6 hours or more a day just spamming it for no reason.

Pretty sad.
>>
>>60452282
8~9 hours
>>
>>60452290
go outside you stupid sperg
>>
>>60452282
you mean he is sitting on a mainstream forum engaging in pointless casual conversations with no end or beginning while instead he could actually do something to make progress in his life? what kind of retard would do something like that
>>
>>60452315

Haha yeah pasting the same comment 100 times a thread is definitely equal to discussing programming.
>>
>>60452212

github and gitlab
>>
How would you handle overflow? lets say I want to check if x + y < z, but x + y overflows.
>>
>>60452551
x < z - y
>>
>>60452037
>I don't know how to implement it.
you don't know how to implement the subtraction algorithm you learned in first grade, ok. i'm assuming you're coming from javascript?
>>
>>60452653
what about underflow? :o
>>
>>60452675
Freshman year at the uni.
>>
Why do inferior languages win?
>>
>>60452694
>in university
>doesnt know how to divide two numbers
ITT tech?
>>
Can some tripfag pls come in.
>>
>>60452717
I think you didn't actually understood my problem. Forget about it.
>>
>>60452732
no i understand your problem. either you dont know how to divide two numbers or you dont know how to write programs
>>
Are there any men here? Other than Ruby lying, I mean.
>>
>>60452700
Win at what?
>>
>>60452683
If z >= 0, then it can't possibly underflow.
>>
>>60452753
How the fuck do you expect me to master everything at my first semester?
>>
>>60452761
Gaining usage share.
>>
>>60452771
i dunno trial and error like everyone else before you?
>>
>>60452551
in C?
int r;

if (__builtin_add_overflow(x, y, &r))
// overflow occurred

if (r < z)
...
>>
>>60452700
>>60452779
I don't know. There are plenty of examples of inferior languages got gaining any usage share at all.
Just look at D.
>>
>>60452793
why is this even a function when you can check overflow yourself?
>>
>>60452779
Why would you expect that not to happen?
>>
>>60452771
Proof by induction, I assume you covered that at A-level?
>>
>>60452817
Because I'm an unrepentant optimist, anon.
>>
>>60452771
>>60451953
have you tried converting them to integers, and then dividing them?
>>
>>60452700
inferior languages take less time to design and implement and thus hit the market first. once people write programs in inferior languages, backwards compatibility demands that people continue to write programs in those inferior languages. then tooling develops and the cement hardens
>>
>>60452811
>why is there even a function when you can compute log yourself?
>>
>>60452700
easier for most programmers
>>
>>60452906
Most programmers suck.
>>
>>60450399
both
>>
>>60452911
it's not impossible
>>
>>60452212
launchpad tyvm
>>
>>60452914
It's as if wearing feminine clothing makes you a better programmer.
>>
>>60452837
I sincerely hope you're about 16-18 years old.
>>
>>60452700
Most inferior languages are actually superior for writing shit software.
>>
>>60452811
because the behavior of x + y when there a overflow is undefined. also, because of optimizations.
>>
>>60449063
Trying to do the Euler problems in C, but I'm running out of memory when listing the primes under 600851475143. Frankly, I don't know if its my allocation, my data type, or if I'm just running out of memory.

It's annoying.
>>
>>60453015
Euler problems are designed to be hard to brute-force or do naively.
You need to be solving the problem in a smarter way.
>>
>>60452992
Why would anyone want shit software?
>>
>>60453062
I'm aware, but part of this is me building a library of math functions, so something that returns all primes up until a specific number is pretty useful. Thing is, I'm not good enough yet to know if what I'm doing simply requires more memory than my machine could possibly allocate, or if I'm simply implementing it in the wrong datatype or something similar.
>>
>>60453076
It's a lot easier to write.
>>
>>60453122
How easy a piece of software was to write doesn't affect a user using it.
>>
>>60453159
So? People who choose to write shit software wouldn't really care about that.
>>
>download a program
>it's a bunch of python scripts
>expects me to have python and whatever shitty extensions they used installed in order to run it
Don't do this. Ever.

Compile your code to a native binary. If your language can't do that easily, too bad.
>>
>>60453118
How is it implemented? A Sieve of Eratosthenes doesn't work well for large numbers.
>>
>>60453199
Software is about its users first and foremost.
>>
>>60453211
this is why web is winning anon
>>
>>60453228
There are obviously countless people who disagree since shit languages and shit software is so popular. Which wouldn't be possible if the users themselves didn't choose to use shit software.
>>
>>60453255
>go to website
>website whines at me to enable javascript
>without it nothing works
>with it website is full of ads and tracking shit, and slow
>install adblocker
>website whines at me to disable it
>disable it
>get virus from malicious ad
>>
>>60453302
>using winblows
>>
>>60453302
>will run arbitrary python
>wont run arbitrary javascript
hmmmm.....
>>
>>60453330
I'm saying I won't run arbitrary Python and I won't run arbitrary JS.
>>
>>60453343
but you will run arbitrary binaries? ok
>>
>>60453226
It's Sieve of Erastosthenes, it craps out at around prime 46337. I mean, it runs the Sieve even with a limit of 500000000, but naturally slow as fuck. Going just above 46337 is pretty fast, but it seems to be unable to allocate the memory properly, leading to a segmentation fault. I'm looking through gdb atm, it's a good learning experience if nothing else.
>>
>>60453354
I don't run "binaries", I use hexadecimal notation for most things.
>>
>>60453015
>>60453118
>>60453398
Just check all the return values and perror if it's bad.
>>
There are no men on /dpt/, only women pretending to be men.
>>
File: the elusive programmer (male).jpg (126KB, 331x510px) Image search: [Google]
the elusive programmer (male).jpg
126KB, 331x510px
>>60453616
what about the elusive programmer (male)?
>>
>>60453632
A dirty lie. Naught but a programmer (male (female)).
>>
>>60453398
Assuming you're using 1 byte bools, you're going to need 600 GiB of memory to calculate primes up to 600851475143.
>>
>>60453763
I have 512 GiB of RAM, can I store the rest on my hard drive?
>>
File: pills.jpg (114KB, 757x406px) Image search: [Google]
pills.jpg
114KB, 757x406px
>>60453652
oh yeah?
>>
>>60453806
>512 GiB of RAM
>wasting it on project euler
What the fuck are you doing with your life, anon?
>>
>>60453813
fuck off tranny
>>
>>60453851
never
>>
>>60453851
Fuck off, you're not welcome if you're going to turn /dpt/ into a hostile environment.
>>
>>60453857
i got ur back sis
>>
>>60453864
>programming thread
>hey guys did i mention i'm transitioning????

fuck offf
>>
>>60453927
Transitioning is merely reprogramming the body.
>>
>>60453763
Shiiet, well I'm not overly suprised. I'll get on to proper error handling and modify the method a bit.
>>
>>60453927
you're the one raging and derailing the thread you fucking autist
>>
>>60453936
>>60453952
blocking regular functioning of bodily functions by self-medicating T-blockers is NOT programming
>>
>>60449265
Java/C++
>>
>>60453972
>self-medicating
Who said anything about self-medicating?

>blocking regular functioning of bodily functions
We do that all the time when the body functions in an undesirable way. It's called medicine.
>>
>>60453813
Face it anon you're a woman and you'll never be a programmer (male).
>>
>>60453972
not all code is written on silicon


we're all in the matrix
>>
>>60451632
come up with something cool you wanna see
there are lots of things that nobody has programmed yet
>>
>>60453813
bonglass?
>>
Learn from my mistakes. Don't outsource security to Indians. He had applied a caesar cipher to values 'a' - 'f' of a binary file. Luckily I found out before we released this. There's no excuse. I don't know why it was only applied to a-f. Must be some grave misunderstanding of the idea behind the simplest encryption in existence. Truly Indians are the worst.

It's never worth the time 'saved'. Because you need to read their code to ensure it's OK-enough.
>>
Do you play with webassembly /dpt/? It's gonna be hot shit soon
>>
>>60454189
When I can use it without ANY javascript at all, I'll maybe use it for something.
I'm not too big on webdev cancer, though.
>>
>>60454189
>literally no way to manipulate the dom

What's the point of this?
You can get games and emulators to run in the browser, but that's it.
>>
>>60451272

I didn't get my first development job until I was 34. My age was never a factor, period. But you? That question reveals you are weak in the mind. Suck a dick, then suck a shotgun.
>>
>>60454292
Imagine it's some misguided idea of security.
>>
Animation studio that takes a file composed of letters which dictate the colour of the specified pixels.

It's a personal project where I want to develop an open source animation studio from the ground up, which prides itself on accessibility and customisation.

Using Java
>>
>>60454243
I changed gcc to emcc in the makefile for my sdl2 game and it worked, no js whatsoever

>>60454292
video/audio processing maybe? a nonshit online image editor perhaps. I don't know

considering there is a way to call js from c++ using emscripten I am bretty sure #include <dom.h> things will come out soon

also found dis
#include <emscripten.h>
#include <emscripten/val.h>

using namespace emscripten;


int main() {

val document = val::global("document");
val body = document["body"];
body.set("innerHTML", val("Hello world"));
body.call<void>("setAttribute", val("name"), val("name"));
}
>>
>>60454453

>Animation studio that takes a file composed of letters which dictate the colour of the specified pixels.

I don't understand what that means
>>
>>60454668
I think he's talking about hex.
>>
>>60454937
I think he's talking about sex.
>>
I give up on Go. It's useless. It has me going in circles. I can't work with it at all. Fuck you, Go, I fucking hate you. Just let me fucking compile the program. Just let me make the program. Don't make me fucking remove "https://" for fetching. Don't make me use a GOPATH as my exclusive build-zone, my exclusive "you can only use Go here" zone.

Fuck you.
Fuck you.
You fucking suck.
Fucking shit my dude fuck
>>
>>60455043
git gud pleb

quitters make me sick
>>
>>60455086
Go is made by (((google)))
>>
>>60455043
Learn Lisp.
>>
>>60449063
A Kademlia implementation. Why is this shit so badly documented?
>>
>>60449265
lisp is verbose?
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!
>>
>>60455341
You forgot to enter your name, Andrei
>>
>>60455341
You mean pooplang.
>>
File: kotlin.png (336KB, 845x573px) Image search: [Google]
kotlin.png
336KB, 845x573px
Redpill me on kotlin /g/
>>
>>60455487
Overhyped garbage.
>>
Learning C++
Why must I always return 0 at the end of the program?
>>
>>60455487
Official Android language now, huh
Guess it's Google's answer to Swift
>>
>>60455597
>Learning C++
You should really stop. C++ is an awful language.
>Why must I always return 0 at the end of the program?
You're returning a status code. 0 means success, anything else means failure.
>>
>>60455597
you don't *always* have to
it's how you indicate to the shell/os if your program succeeded or not. absolutely vital for scripting stuff.
>>
>>60455086
I'm not TRYING to learn Go.
I'm trying to USE it.

Other people write things in Go - I'm not fucking sure why at all - and I require binaries for these sources which are almost 99% never fucking compiled / distributed

Fuck you, if you write things in Go
You are a piece of shit that unintentionally makes things extremely fucking difficult to do, especially if you're using a Windows environment (not recommended for developing of any kind, however, to be fair)

Go is a tumor that floats around, attaching itself to ideas-given-form.
>>
>>60455616
Suggest a better language for me to learn then. No memes. I already know Java, C and Python.

>>60455622
That only applies if I am doing it outside an IDE right?
>>
>>60455639
Common Lisp
>>
>>60455665
I said no memes. Besides if I wanted to use a psudeo code language to code, I prefer Python over common Lisp.
>>
>>60455639
Some GUI systems might pop up an error message if the return value is not 0 to indicate something went wrong.
>>
>>60455597
https://en.wikipedia.org/wiki/Exit_status
>>
>>60455681
Racket
>>
>>60455682
Alright thanks. I am using Bjarne Stroustrup-Programming Principles and Practice Using C++. Doesn't seem beginner friendly to me, half the time I am able to do the exercises is because I already have a prior knowledge from other languages. Any recommendations for C++ books?
>>
>>60455681
>preferring a language that is over 100 times slower
>>
>>60455744
If I am writing a program in common lisp or Python, it means that the program doesn't need to be fast.
>>
new thread
>>60455882
>>
someone make a new thread
>>
>>60455597

You don't have to, if you return nothing it still works and just assumes you meant 0
>>
>>60455639

Java
Thread posts: 319
Thread images: 31


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