/dpt/ - Daily Programming Thread

Abstract category bullshit edition
What are you working on, Jow Forums?

Previous Thread:

Attached: ekmett GF is a moand.png (410x268, 221K)

Other urls found in this thread:

youtube.com/watch?v=sX8r6zATHGU
tour.golang.org
golang-book.com
youtube.com/watch?v=hLljd8pfiFg
blog.golang.org/go-brand
rextester.com/l/csharp_online_compiler
twitter.com/NSFWRedditVideo

Watch this:
youtube.com/watch?v=sX8r6zATHGU

Then learn Go:
tour.golang.org
golang-book.com

Rust is cool.

Attached: 23.png (600x450, 337K)

Didn't you post this another thread?

>Then learn Go:
Why not Rust?

>What should a modern, practical programming language look like?
Not rust, for a start

Attached: karen haskell.png (1280x719, 818K)

Why not both?

Meant to say Go, but this works too
Why not neither?

shitlangs out.
you know who you are.

Ich bin der Monad!

so I was thinking of making some kind of network RAID array from a bunch of Raspberry Pis using cheap 500GB drives (just as an experiment), but I'm not clear on how to make it register as a single drive
what's a good resource for writing "virtual firmware" or whatever the proper term for it is?
I guess I could just use one drive as the focal point and use NFS or SMB to mirror everything written on one drive to all the others, but that would take away the read speed benefits
the Raspberry Pis have 100Mb/s NICs, so reading a different block of data from each of them at once would massively improve transfer speeds as well
also I was thinking of using MPI to coordinate the whole thing, but if there's something better out there that'd be nice too

agreed, cniles have to go

Haha

HTTP/1.1 GET /reasons_for_rust_to_exist
...
Connection accepted!
Loading 5%... 10%.. 12%.. 33%.. 76.419%.. 99%.. 100% Operation Complete!

ERROR!

HTTP 404 File Not Found
Connection: close

fuck me, was using
element.text

instead of
element.value

>What are you working on, Jow Forums?
Calculating the average of two ints sans I/O

Did I do good?
Finds whatever i throw at it.

Attached: 2018-07-30 23-37-39.webm (620x474, 201K)

Extremely Epic my friend

what do you mean?

Probably that it's extremely easy, simple and useless.

alright pal have it your way but just so you know i never once in my post claimed otherwise.

keep going

yeah, but you could also post code, so that other people can criticize it

postier Füße

...

rust is deprecated, user

Attached: 1518711764434.png (200x200, 12K)

it would be pretty neat if it managed to find semi-matches in the directory tree, eg filenames, strings in files, folder names etc.
so in your example it'd manage to find "absolutely" even if you throw some gibberish at it.
then it should list it all out, and definitely make all the matches coloured

nice!!!
youre cool too user!!!!!

No.

Do ya think C should have an equivalent of std::unique_ptr?

+1 for this post

Yes. It would make handling heap memory so much easier.

just use C++

That's a great idea.
I will definitely give it a try in the near future.

How come there are JavaScript developers earning 150k / month while Jow Forums's geniuses are unemployed and live in a basement?

std::shared_ptr wife;

is it true that a good portion of modern programming is just finding and tweaking preexisting libraries?

>BLOATTTTTTTT
c is not allowed to have nice things.
t. every c autist

maybe if you're a python or JS """""""""""""developer""""""""""""""

I guess they love how their language is.

>"Hey user, fix up this code and tell me what it does"
>what's wrong?
>"I don't know"
>what is it supposed to do exactly?
>"I'm not exactly sure"
>what do you want it to do?
>"everything"
I am working on figuring out how to not kill someone while trying to make sense (almost done) and use of 400 lines of sparsely commented, poorly formatted fortran code that refers to modules that don't exist in any library I can access. I should have majored in anything else.

The guy didn't even write it himself, it is from some eastern european professor from a foreign university who wrote it in the 90's.

i'd call it more an irrational obsession.

Do you think C programmers just program in C and in nothing else?

Anything worth doing usually has multiple library variants that are better executed and maintained than anything you can make in a short period of time. Its true and its also the reason why MIT has been slowly shifting away from its roots with SICP.

a lot do yes because c is "the perfect language".

Knowing one language in every known paradigm is very important. In my case, C for imperative, Java for OOP, OCaml for functional, Prolog for logical.

#include
#include
#include

#define POWER(X, Y) expl(Y * logl(X))

int main(int argc, char *argv[])
{
long double m, n;

if (argc == 3) {
m = strtold(argv[1], NULL);
n = strtold(argv[2], NULL);
printf("%.15Lf\n", POWER(m, n));
} else {
printf("2 arguments must be passed.\n");
return 1;
}
return 0;
}
Trying to do decimal exponentiation. Why does this allow me to compute absolutely massive numbers without overflowing? E.g $ ./a.out 2 16383 will print a 4932-digit number (only accurate to the first 15 digits, I guess due to precision loss in the macro). Finally, $ ./a.out 2 16384 just returns "inf" (math library catches the overflow?).

Q: How do you do RAII in GNU C?
A: Hold my beer and watch this!

#include
#include
#define defer(x) __attribute__((cleanup(x)))

struct child {
const char *name;
};

struct parent {
struct child *kid;
const char *name;
};

static struct child *child_constructor(const char *name)
{
struct child *ret = malloc(sizeof(struct child));
if (!ret)
return NULL;
ret->name = name;
return ret;
}

static void child_destructor(struct child **this)
{
free(*this);
}

static struct parent *parent_constructor(const char *name, const char *kidname)
{
struct parent *ret = malloc(sizeof(struct parent));
if (!ret)
return NULL;
ret->name = name;
ret->kid = child_constructor(kidname);
return ret;
}

static void parent_destructor(struct parent **this)
{
if (*this == NULL)
return;
child_destructor(&(*this)->kid);
free(*this);
}

int main()
{
struct parent *p defer(parent_destructor) = parent_constructor("James", "John");
return 0;
}

>GNU
What about STANDARD C?

theres a nonstandard cleanup attribute which can call a function on the variable when it goes out of scope.
something like __attribute__(cleanup(free))
type *foo = malloc(sizeof *foo);

So what you're telling me that automatic cleanup in C isn't standard.

And That's A Good Thing

Because?

>struct parent *p defer(parent_destructor) = parent_constructor("James", "John");
gnu was a mistake.

>start shitty project for fun
>OOP is a good candidate
>don't have a clear design in mind though, just start writing shit
>now it's so spaghetti that even the thought of actually adding some features i want to add is giving me physical pain
Where is Pete when you need him

Attached: 1527616140794.jpg (297x297, 13K)

I was pretty skeptical but this video made me realize that Rust is a better language than C++
youtube.com/watch?v=hLljd8pfiFg

HAHAHHAHAHA

This may be it. I might be overcoming the programming block that's been stopping one of the greatest feats of artesanic software yet to come and grace the earth from progressing. It may be out in 1 or 2 years now that I removed this block. The future is here.

Attached: [HorribleSubs] Clockwork Planet - 10 [720p].mkv_snapshot_12.09_[2017.06.09_02.12.45].jpg (1280x720, 123K)

>average GNU/Linux advocate

>autism

>unironically liking go
ishygddt

This
Go has 0 (zero) reason to exist.

One of the sponsors is called Curry On!

cute mascot tho

Oh shit I forgot this is Jow Forums, where only mascots and logos matter

because being a >105IQ genius makes you to smart to work

Is it better to iterate through a string via method a or method b?
/* method a */

while (*p != '\0') {
/* do something like x = *(++p) */
}

/* method b */
int i = 0;
while (p[i] != '\0') {
/* do something like x = p[++i] */
}

They officially removed the mascot and replaced it with a generic IBM-tier logo.

Does anyone know how many IO threads Golang spawns in the background? Not talking about goroutines but the pthreads they run under

int i;
for (i = 0; string[i]; i++) {
...
}

nani?

Attached: file.png (1057x456, 61K)

blog.golang.org/go-brand

Attached: file.png (1600x878, 317K)

Kinda retarded and lifeless. Also whoever added these stripes probably thought he was really special or something

Attached: poop.png (133x97, 9K)

Brand doesn't mean mascot
If you look at the tab of the link you just posted you will see the blue mammal

Thanks

In either case, you're fucked if the string contains no null terminator.

>trying this hard to look "professional" when no one actually cares
why

How do you learn github and git when there's no free private repos to play with and you don't want anyone to see your shitty noob code?

>In either case, you're fucked if something is not implemented correctly
Whoa

you mean git?
make your own repo and your own PRs to test.
or use a service with free private repos if you honestly care that much.

Make a free poop account, create some repos and delete them again
besides the only comands you will ever need are
git add .
git commit -m "some message"
git push

What's a super light-weight compiler that I can use on my boyfriends laptop to program in c#?

They're bars, and represent an at-a-glance overview of the language's strengths and weaknesses. What does the smallest bar stand for?

i think everyone should also know how to make and work with other branches.

i'm fairly sure they're supposed to be "speed bars" like you see in cartoons.

>lightweight
>c#
wew

rextester.com/l/csharp_online_compiler

because you want to cleanup stuff in big batches, not one by one

The writing is in the wall for rust already. It didn't catch on and it is doomed to sjw obscurity

>It didn't catch on
i wouldn't say that.
But i think it's tricking people into false hype and
>rust is tedious to work with, but atleast it's not c++ eh?

>make a replacement for c++
>it's even more complex than c++
just WHAT where they thinking?

i wouldn't call it more complex, just on the same level as being difficult to reason about if you aren't experienced. Which is why i think they're so obsessed with bringing in new cult members.

Besides Servo in Firefox, and the RedoxOS thingy, WHO uses Rust?

>inb4 the long list of companies who in reality just wrote a tiny module to experiment but rust treats it as full convert

Use that GUI I'm sure is on the website somewhere but stop at uploading

Am I understanding recursion properly?
(defun test (count)
(cond
((eq count 0) NIL)
(t
(princ (cons "test" (cons (- count 1) ())))
(terpri)
(test (- count 1)))))

To be honest, I'm really not quite sure what happens when NIL (count = 0) is reached.

>using a gtk rendered window resizes in real time
>using a GLFW/OpenGL rendered window lags while resizing even though it has less abstractions

What sorcery is this?

Attached: 1344970833081.gif (480x270, 261K)

Dropbox, VMWare and Microsoft comes to mind. Microsoft is rumored to use Actix web framework, but there hasn't been any conformation on that. Actix itself is pretty damn fast though.

I posted this on biz, but I'm curious if there are any interesting UI's or trading interfaces for stock or crypto exchanges.

I've programmed on & off in school but have trouble finishing projects that I start because they get too ambitious. I'd love to make a UI in Python that hooks into exchanges' API's and absolutely tweak out with unique ways to simplify the process of sending buy or sell orders.

For example some kind of UI element that gives you a sell price quick-select "wheel" or something, that dynamically displays only prices within a tight % range of some pre-specified price level, maybe based on the current last-traded price queried from the exchange, or some target price automatically derived from a technical analysis profile you chart out beforehand.

Help me, am dumbfag

Attached: stop loss.png (750x550, 23K)

It's not about performance, but architecture. GTK windows redraw themselves every time they need to, including while they're being resized. GLFW windows only redraw when you swap back buffers, which typically only happens when there are no events, which is never while the window is being continuously resized.

Please explain further to a baka. Is this about what they call retained vs intermediate mode? Meaning GDK only draws when there's an event, for example resizing and GLFW keeps drawing every moment? This sounds very expensive. But purely in the resizing event, GDK seems to be a clear winner.

I can't into graphics.

Attached: output.webm (1280x800, 881K)