/dpt/ - Daily Programming Thread

What are you wroking on, Sup Forums?

Old thread:

Other urls found in this thread:

bootstrapworld.org/materials/spring2017/courses/hour-of-code/
twitter.com/NSFWRedditVideo

First for C

As for what im working on:

Teminal based audio player using SDL

first for feeling like you should learn lisp and never doing it

?
not sure what you mean

trying to do a C project for fun after years of C++, what's a good container library?

sorry man but C++ really is the language of gamedev. If You Don't Like It, Don't Use It.

typedef struct {
int size;
int data[size];
} Container;

why would you want that ?
C with containers is basically C++.

your png is now optimized

STL containers are hit or miss.

C has dependent pair types?

also
void function(int size, int data[size]) {...}

kek

whats the "official" name for what we refer to as 32bit and 64bit architectures?
x86 and x86-64?

It's just a C99 extension to canonicalize a common design pattern.

can you please fuck off to Sup Forums

i386 and amd64

It's correct.

IA-32 and AMD64

keks

it's a flexible array member then?

i misclicked what i wanted to post.
fugg.
inb4 banned for this

you're going away for a long time buddy

Surely if you get banned this means the Sup Forums crossposting retard will at least get sent to jail

Is this true?

dude look the fuck out, C++

what's next, php? oooh shit there's some scary bad langs up in here, someone might get upset

You might as well call it that, though I think you can have more than one

Anyone has experience with libpng in C? How do I handle RGBA data layout? I use unsigned 8 bit integer for RGB to lay numbers from 0 to 255 and just came to realization that last alpha parameter probably takes float between 0 to 1 rather than unsigned int, however how do I even go about getting a 8 bit float? Or is the Alpha value for RGBA output a 32 bit float? Cannot find anything in the documentation.

I don't know about videos, about the language, it depends.

desu just use a higher-level library unless you absolutely have to do that

what is this project for?

What are you going to do with C aside of hello worlds?

use rgba5551

raytrace C compiler to Javascript

ESL

No idea but if you can afford another library stb image is godlike

?

Thank you, I meant "aside from".

Have 4 grayscale images from which I am meant to extract relevant colour channel values and mix them together to produce final output image. The only remaining part is getting alpha values to work, and that was producing a lot of problems until I realized that alpha in RGBA goes from 0 to 1, meaning that the data I was passing was probably wrong (0-255).

Tried casting float to unsigned char but that just rounds it down. Could it be possible that libpng uses 0 to 100 int metric instead? The documentation is just all over the place.

Does it support grayscale input and RGBA output?

FAGGOTS

>Have 4 grayscale images from which I
no i meant why are you doing this project

I think that raytracing a C++ compiler to Python is better.

>Screen Shot 2017-08-01
wut

fucking google botnet now asks for the type of street sign...

Modelling friend asked if it possible to put together something like this since doing it manually takes time.

Making a dynamic currency converter in React.

If you change the value for USD for ex, all the other cryptocurrencies and currencies change their value to match the equivalent of USD. You can edit any currency and all the other currencies will change in value to the equivalent of them in USD.

guile is throwwing this error when I try to run it
guile: error while loading shared libraries: libguile-2.2.so.1: cannot open shared object file: No such file or directory
but I know that's full of shit
ll /usr/local/lib
total 14592
drwxr-xr-x 7 root root 4096 Aug 21 10:06 ./
drwxr-xr-x 10 root root 4096 Jan 25 2017 ../
drwxr-xr-x 3 root root 4096 Aug 20 20:30 guile/
-rw-r--r-- 1 root root 9791306 Aug 21 10:06 libguile-2.2.a
-rwxr-xr-x 1 root root 1043 Aug 21 10:06 libguile-2.2.la*
lrwxrwxrwx 1 root root 21 Aug 21 10:06 libguile-2.2.so -> libguile-2.2.so.1.2.0*
lrwxrwxrwx 1 root root 21 Aug 21 10:06 libguile-2.2.so.1 -> libguile-2.2.so.1.2.0*
-rwxr-xr-x 1 root root 5096264 Aug 21 10:06 libguile-2.2.so.1.2.0*
-rw-r--r-- 1 root root 16039 Aug 21 10:06 libguile-2.2.so.1.2.0-gdb.scm
drwxrwsr-x 3 root staff 4096 Jul 16 22:22 ocaml/
drwxr-xr-x 2 root root 4096 Aug 21 10:06 pkgconfig/
drwxrwsr-x 4 root staff 4096 Jan 25 2017 python2.7/
drwxrwsr-x 3 root staff 4096 Jan 25 2017 python3.5/
what gives?

What's the point in doing such tasks in C or C++, if it will be much faster in Python in terms of writing and debugging a script.

Your guile package is out of date.

you have your own thread

tried using LD_PRELOAD ?

Already had some experience using libpng so thought might as well try, but the hidden details really fuck one over. I agree that python would probably be easier.

Now that webapps are deprecated what are people supposed to use for cross platform GUI applications?

i like this one more though.

Try creating a file 99config.conf file in the/etc/ld.so.conf.d/ dir and put /usr/local/lib in the file, then run sudo ldconfig and then try again.

let's see you mental gymnastics.

try to prove that it is not programming.

I'll grab my pop corn

When the computational speed of a final result doesn't matter, usually the lower level languages only complicate things.

?
didn't install it from a package
everything that's there was put there from sudo make install

LD_PRELOAD=/usr/local/liblibguile-2.2.so.1 guile
ERROR: ld.so: object '/usr/local/liblibguile-2.2.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
guile: error while loading shared libraries: libguile-2.2.so.1: cannot open shared object file: No such file or directory

i steal memes my dud. what you think i do ?

r g b and a are all the size of the color depth as an int, not a float
that would be dumb.

Is github very slow today or is it my connection?

>Now that webapps are deprecated
source?

Javascript

same here

don't know what's happening

obselete

>obselete
source?

Which prorgramming language is the best for a newb? I figured I might get better responses here than in dqt

Malbolge

just realized i mistyped the command, yeah that works
LD_PRELOAD=/usr/local/lib/libguile-2.2.so.1 guile
GNU Guile 2.2.2
Copyright (C) 1995-2017 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)>
thanks m8

Depends on what you want to do

...

Haskell

?

I want to prepare for CS since I'm going to university next semester, so I guess a language that helps me get a basic understanding of how programming works/whose principles translate well to other languages, if that makes any sense

yup, works

C

lol that's funny

Scheme. You can try it out a bit here:

bootstrapworld.org/materials/spring2017/courses/hour-of-code/

What course is it? Usually they start you off with C, Java or Python.

He wants to prepare for CS, not /dpt/.

>whose principles translate well to other languages
OCaml.

>prepare for CS
My CS very first course was on C

I think we're going to use Java for the first few semesters and then C/C++ later

My uni thought us C, then C++, then required we know java, prolog, python and scala in some courses even though they never thought us (which is fine because once you know a bit about programming you can teach yourself).

Unironically C and OCaml. If you hate frogs SML is fine too. OCaml just happens to be the best modern ML implementation.

I think you need to run `ldconfig` before using your program without LD_PRELOAD
yw

Well at my university we are only being taught Java.

At my university we are taught Java in the first year and C in the second. And we're just kind of expected to know Python and PHP.

yeah this guy already told me

[null,null] == ","

This returns true in Javascript.

Got a free license. What's actually useful in this list?

That was my initial assumption too, but when you run out of ideas and notice that something may be off you start thinking.

Maybe someone can help spot what exactly is wrong with the image transformation in pic related? The left picture is the desired output, middle uses RGBA alpha and right just uses RGB. How do I get to the final output based on my current outputs? Not sure why the pink color occurs.

What did Brendan Eich(faggot slayer) mean by this?

>same software different name
Picking any one of them is losing.

ReSharper and dotTrace

Intellij idea is a /comfy/ java ide

Where the fuck is line 35?

Is CLion shit?

I don't know, I find C IDEs to be awkward in general.

looks to me like you got the color depth wrong or there's empty packing in your struct
print some lines of both as hex with printf

#include
#include
#include
using namespace std;

/*
* Takes int target = value to look for
* returns -1 if not found, index if otherwise
*/
int
binary_search(vector& rng, int target)
{
int probe;
int max = rng.size();
int min = 0;
bool probe_changed;
do {
probe_changed = false;
probe = (min + max) / 2;
if (rng.at(probe) == target) {
return probe;
} else if (rng.at(probe) > target) {
/*push back*/
max = probe;
probe_changed = true;
} else {
/*push forward*/
min = probe;
probe_changed = true;
}
} while (!(probe_changed));

return -1; // not found
}

int
main()
{
vector v{ 12, 122, 123, /*127,*/ 223, 301, 442 };
sort(v.begin(), v.end());

cout

>int only