/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

scratchapixel.com/
processing.org/
processingjs.org/
p5js.org/
cantrip.org/rust-vs-c .html
youtube.com/watch?v=JGM5a6-77o4
twitter.com/SFWRedditVideos

First for Idris

C == God

rewriting the haskell kernel in linux

false

I want to use printf to debug my ncurses program

Can I set ncurses to open in a new window?

QUICK, NAME A GOOD INTRODUCTORY BOOK ON COMPUTER GRAPHICS.

book with a tiger on the cover

C==3

If we represent the C programming language as the string "C", then what is C++? Well, C is a char*, so C++ increments its address by sizeof(char). C is now the empty string, and the result of the expression is "C".

We can therefore say that C++ is the new C, and that it has destroyed C.

>Making the same joke for 30 years
Sad!

Post-increment returns the old value and later increments.
It means we will program in old C with C++, because we don't know the value of C++.

C is trash.

excellent image

And yet it's better than Go.

>C(ancer)
>C(ancer)++
Fixed that for you.

What's with all the anti C shilling lately?
Was it too hard for you to understand or something?

>t. frustrated memelang programmer

it looks like a dig XD

anta baka

Who are you quoting?

>better than Go
Well it's not a hard thing to be.

when I was little my uncle would close the curtains and make me do pointer arithmetic

started learning programming (java) as a hobby few days ago. pls no bully
i know it is baby stuff but here is program that makes a triangle of odd numbers im pretty proud
public static void main(String[] args) {
for (int line = 1; line

>t. frustrated memelang programmer

Who the hell are you quoting, redditor?

stupid frogposter no wonder you chose a shitty language

Congrats user!

>line * -1 + 6
6 - line

Good for you!

>t. frustrated memelang programmer

Who the hell are you quoting, redditor?

C++ stands for C Cross Cross, obviously
i heard the author was heavy inspired by the ideas of cemetery, god and duality

I can't wait to start posting this ironically

Pointer arithmetic is simple shit.

That's HolyC though.

>t. frustrated memelang programmer

/dpt/-chan, daisuki~

Ask your favorite programming literate anything (IAMA)

C is an obsolete programming language for the programming techniques of the past.

scratchapixel.com/

God of the mediocre

Thank you for using an anime image.

not when you're three, it's dark, and your uncle is shouting

whom are you quoting tho?

>C is an obsolete programming language for the programming techniques of the past.
You mean techniques like writing performant code?

your png is now optimized

What should I use to draw pictures with instructions like box(100, 200)?

>t. frustrated memelang programmer

Good job Sup Forums out of 41 replies there's a single thread-related post.

Yes it is.

What's the trick?

Did you know that, with strong type systems, safety, efficiency, and maintainability go hand in hand?

I'd be perfectly happy to use things other than C if they offered comparable performance.

Meanwhile I feel no urge to transform my 800,000 CPU hour problems into 4,000,000 CPU hour problems.

t. HPC programmer

Get rid of the soul

Or you could just write the efficient code in C, without having to wait for the promised "smart compiler" that we're told will be able to produce code equivalent in performance if we only wait a little while longer (they've been saying that for decades now)

Who are you quoting?

t. C programmer

>tfw captcha is pepe

Fundamentals of computer graphics by Peter Shirley.


Is this a good book?

magic

post one so i can reduce the file size

Ada? Pascal?

>t. frustrated memelang programmer

Processing

processing.org/
processingjs.org/
p5js.org/

Fortran though.

C is the language that was promised
i will burn at the cross every single one of you heretics
come back to the dark side

I don't want any colors got reduced

Fortran serves the good job of number crunching.
Nothing other it doesn't seem to serve good, though.

>with strong type systems, safety, efficiency, and maintainability go hand in
This has never been shown to be the case.

not much reduction in file size

In what it got reduced then?
Is it some imagemagick?

cantrip.org/rust-vs-c .html

>The Rust program turned out close to the same length, but only half as fast. As I made the Rust code more idiomatic, it got faster.
>In 90 ms on modern hardware, it performs some 190 million basic operations (at an astonishing 1 cycle per iteration), filtering to 5 million more-complex operations (at an astonishing 28 cycles per bit). Meanwhile, the Rust program does about the same operations in about the same time: just a few percent faster or slower on various hardware. Many variations that seemed like they ought to run the same speed or faster turned out slower, often much slower. By contrast, in C++ it was hard to discover a way to express the same operations differently and get a different run time.

And this is just crunching, too. It doesn't go into memory management or threading, at which Rust blows away C and C++.

C is the language of Christ.

D is the language of the devil.

Python is the language of the serpent.

Be led not into temptation.

How much does a CPU hour cost? Two cents? Congratulations, you have saved (3200000 * $.02 = $64000) six months of a competent programmer's salary and are now stuck with a shitty unmaintainable C codebase.

Coding a genetic algorithm to control the thrust on the engines of a spacecraft (2D) so it can go in a given direction.
Tried with a simplex solver but to dumb to get it to work.

double bypass on this one

Color indexing?
Is it the secret?

He's using google's png optimizer or something

What are the inputs?

Inputs are:
- for each thruster, I've got the thrust vector and torque
- acceleration vector and torque requested
Output:
- thrust level [0-100]% for each thruster that satisfy the request as close as possible, priority goes to the torque

building a menu

You're gay, I can tell from your hands.

You guys just gave ma program idea.

I'm already using a deduplication tool so that when I download images I don't save duplicates (checked via hashes).

I'm gonna make an option to to save only the most optimized version for PNGs.

Thank you very much, my friend.

youtube.com/watch?v=JGM5a6-77o4

Someone redpill me on OOP. I've studied Java for 6 months and recently started with c#, but I feel like I have what I'm doing, even after making several functional programs.

Am I just retarded or is OOP thrash, and I should stick with a simple and functional language like PHP?

>simple and functional language like PHP?

>a simple and functional language like PHP

I used a script on all my pepe images that change a random pixel color by almost nothing so I can post duplicates and fuck with people like you

>frog poster

heeeeelp Sup Forums

I just write a program thats creates moving rectangles when i press space and it supposed to not remove other moving rectangle when creates and adds new rectangle to the ArrayList.

What do i need? Can somebody test my code and say what is wrong?

package ArrayLists;

import javax.swing.*;
import javax.swing.Timer;
import java.awt.*;
import java.util.*;
import java.awt.event.*;

public class test extends JPanel implements ActionListener,KeyListener{

private ArrayList rec_list;
Iterator rec_iterator;
private Rectangle test_rec;
private int rnd_1,rec_y = 0;
private Timer timer1;
private Random rnd = new Random();
public test(){
rec_list = new ArrayList();
timer1 = new Timer(10,this);
timer1.start();
}

public void add_rec(){
rnd_1 = rnd.nextInt(400)+10;
rec_y = 0;
test_rec = new Rectangle(rnd_1,0,25,25);
rec_list.add(test_rec);
}

public void actionPerformed(ActionEvent event) {
rec_y++;
repaint();
}

public void paintComponent(Graphics g){
super.paintComponent(g);
rec_iterator = rec_list.iterator();
while(rec_iterator.hasNext()){
test_rec = rec_iterator.next();
g.fillRect((int)test_rec.getX(), (int)test_rec.getY(),
(int)test_rec.getWidth(), (int)test_rec.getHeight());
test_rec.setLocation(rnd_1,rec_y);
}
}

public void keyPressed(KeyEvent key) {
int k = key.getKeyCode();
if(k == KeyEvent.VK_SPACE){
add_rec();
}
}

public void keyReleased(KeyEvent arg0) {
}
public void keyTyped(KeyEvent arg0) {
}

public static void main(String args[]){
JFrame frame = new JFrame("Title");
test t = new test();
frame.add(t);
frame.addKeyListener(t);
frame.setSize(500, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}

All my pepes are artisan-sourced and manually curated.

There's absolutely nothing you can do to stop me

So?
Enjoy being disrespected.

Why is there 3 /dpt/ threads, OP?

Anyway, here’s my question:
Why can’t I do something like this in C90 aka ANSI C:
int main(void)
{
const int size = 42; /* size is a constant */
int array[size];
return 0;
}

even though size is a constant?

I don't give a fuck about what others have to say about me. If you're triggered by a fucking frog picture then you're the autist user :^)

Fuck y’all motherfuckers hatin’ on C. C is the best language I have ever learned.

>C90 aka ANSI C
wrong

I hash chunks not entire files so it won't work on me. I auto-discard at 100% similarity and otherwise get a pop-up above a set similarity threshold.

tl;dr: The random pixel will not avail you, flame of Udûn.

Rust doest not have a strong type system - 'unsafe' completetly undermines it.

>C is the only language I have ever learned.

noob here but doesn't (void) mean a method that doesn't return a value?
but you are trying to return 0

>I don't give a fuck about what others have to say about me.
It's not the problem with frogposting.
Frogposting just won't give you quality responces, that's all.

>script
Which language?
Also, post the script, don't just say that you've used a script with no evidence.

what the fug man

Fuck off it's literally a one liner

nobody can tell what is happening in your webm

I know it’s wrong, but... See pic related, which is from `man gcc`.