/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 68882807_p0.png (1825x1930, 1.23M)

Other urls found in this thread:

neovim.io/
github.com/kennyalive/Language-Arena
benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/gcc-rust.html
benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust.html
github.com/victorqribeiro/oldTerminal
en.wikipedia.org/wiki/Standard_deviation#Uncorrected_sample_standard_deviation
twitter.com/NSFWRedditGif

good taste OP

Attached: 1553124914015.jpg (933x700, 286K)

compiling Ruby 2.7-preview1

I need app ideas. Preferably Something useful or to showcase my skills.

Attached: 1522730838243.jpg (3840x2400, 1.29M)

A modern fork that Vim is now stealing features from.
neovim.io/

Fart app.

for (int i = 0; i < women.size(); i++) {
if (canFuck(women[i])) {
fuck(women[i]);
}

disrespect(women[i]);
}


Find ONE thing wrong with this code

its a shit joke

You're gonna disrespect every female whether you fucked them or not.

is there a way to tell sepples at allocate a certain amount of memory at an address?
like, if i write Car *car = new Car() , the compiler allocates enough memory to store a Car, and sets *car to the address of the new memory. can i just give the compiler a number of bytes and have it allocate it?
if this is a bad idea let me know

It's a feature. Not a bug

do
{
woman.setrespect(0);
if (woman.fuckable())
fuck(woman)
} while (true);

m(emory)alloc

i thought so. is it dumb to use malloc in sepples? i promise i have a good reason

Elaborate

>.size() (Which means your code is sepples garbage)
>camelCase
>i++ instead of ++i
>Not size_t instead of int

Better question is why do you need a fixed number of bytes?

it’s not dumb

Hmm... so Jow Forums, I'm trying to write a bash script that removes all files with the same md5 hash. But I'm having trouble trying to find a way to remove the file in the current path (pwd)...

Attached: Screenshot.png (327x374, 42K)

If you're allocating a chunk of memory to manage yourself, it's fine.

You press a button and it makes a fart noise.

essentially im trying to get around using templates
i need a function to create a pointer to an object, which i originally did with templates, but then realized i didnt have to if the function simply took the size of the object as a parameter
thanks for the advice

That's too easy!

Bruh NEVER use `ls` in a bash script. Use find and rework what you have.

But why?

Can someone explain the uses of Rust if I'm not a tranny?

Attached: 064 - MR8Naaz.png (300x300, 9K)

What's wrong with make_unique? Or hell, why not just do new Object without going through the fluff?

Your program will naturally disintegrate over time as the iron disintegrates.

>why not just do new Object
different calls to the function use different Objects, thats why i was using templates
>make_unique
wuzzat

I need to rewrite a perl program, it does a lot of net IO, holds results queried from remote systems, and then generates reports in multiple formats depending on what the customer wants (eg PDF/csv/XLS) using templates. But its just unstructured scripts and an unmaintainable mess at the moment.

Out of the perl,python & go which language would you rewrite it in? why?

You brag about being faster than C, basically classic FORTRAN for liberals.

Attached: A332DC16-2A1C-4CB6-82B3-211CF62DDEB3.png (1808x1012, 167K)

i want to nakadashi kyouko

>FORTRAN
>slower than C
I thought FORTRAN was supposed to be sonic fast because everything is static?

> different calls to the function use different Objects
???
maybe it's just too late but I don't understand

>wuzzat
void foo() {
std::unique_ptr obj = make_unique()

// no cleanup necessary
}

AKA the only reason to use C++. RAII

That image is so cancer, the graph isn't even labeled with any meaningful dat.

>Invisible side effects
No fucking thanks.

Attached: 1527040650343.png (1600x1200, 1.8M)

>side effects
>not leaking memory is a side effect

>maybe it's just too late but I don't understand
class A;
class B;
class C;

template
void Func()
{
new T;
}

Func();
Func();
Func();

It is faster. That’s why scientists use it over C.

So why can't you do that?

But the graph in says it's nearly 2 times slower

Attached: kid.jpg (362x346, 38K)

im trying to avoid using templates

FORTRAN is optimized for calculations and number handlings

Holy fucking shit, how retarded can sepplesfags possibly be?
Are you seriously trying to justify invisible state changes?
Are you saying that this code is not supposed to print 10?
int a = 10;
some_function(a);
std::cout

why are you even doing this to begin with?

do you believe everything graphs tell you?

But the graph
Yes, it's actual testing

There could be many reasons for that.
>shittily written FORTRAN
>shitty compiler for discount FORTRAN with the GUIs
>no optimization flags

are you really interested?

yes

explain how that fits in with

Attached: Cw2IsVnXAAgkBKd (1).jpg_large.jpg (1369x1183, 215K)

Yes, the graphs represents not only numerical operation performance. It's an overall representation of speed.

It's amazing how far along the way Rust has been optimized. It performs orders of magnitude faster than it's ancient counterpart Ada.

That being said, I'm disappointed at Go's performance.

>yes
i have a bunch of classes in C++ that i want to "port" over to Lua. each of these classes needs a "new" method (which returns a table that has the "class table" set as it's metatable) and a "delete" method. each class needs its own specific methods beyond these, but i decided to write a C++ function that handles the new and delete methods (among some other stuff). the new and delete methods both need to know the size of the object in C, so this was originally a template function, but i realized that with malloc and free, i didnt have to use templates, i just had to pass the size of the object

Why would you ever expect the shit language that is Go to be fast.

the problem with rust is that it needs C/++ wrappers to work properly with ffi

It's almost like if you embrace open source you will see the difference.

Rust
C#
Swift
Java
Lisp

All shit languages that eventually embraced or started open source and now have fast compilers

No language is shittier than C# yet it's faster than Go.

I see what you mean.
I saw a toy benchmark recently where even open source D outperforms closed source MSVC C++ compiler

delete this post.

>he thinks the benchmark games are just toy programs

uses:
TODO: find uses

No that wasn't it
There was another benchmark
Open source D implementation actually outperforms that of C++
github.com/kennyalive/Language-Arena

It's a toy because the benchmark is not as comprehensive like the debian benchmark

>i++ instead of ++i
One of the simplest optimizations a compiler does for you.

I don't have experience with porting to lua. But as a thought, I feel like you should stick with the templated. Or at least use make_shared/make_unique. You will have safer typing and better guarantees, while with a non templated function, you'll need to return a void*. If you already need to do that, than feel free to malloc

>Go
>0
lmao

#!/bin/bash
if [ -z "$(ls -A $(pwd))" ]; then
echo "Empty"
else
for FILE in `ls $(pwd)`
do
if [ ! -f $FILE ]; then
break;
fi
hash1=`md5 -q $FILE`
for f in `ls $(pwd)`
do
if [ -f $f ] && [ $FILE != $f ]; then
hash2=`md5 -q $f`
if [ "$hash1" = "$hash2" ]; then
echo REMOVED $f
find "$f" -name *.* -type f -delete
fi
fi
done
done
fi
Still doesn't work..

Attached: 1498669139762.gif (1280x720, 486K)

Yes, but ++i is more "correct" in terms of the operation itself. i++ implies a copy, which isn't needed.
This is insanely nitpicky, and I wouldn't fault it in real code, but he asked me to nitpick it.

Attached: 1560308184287.jpg (850x721, 91K)

>faster than C
benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/gcc-rust.html
>C wins by nearly 2x
>C wins
>C wins
>C wins
>C wins
>Tie
>Tie
>Tie
>Rust barely faster
>Rust wins

The benchmark game is flawed. The person to last submit always ends up winning at the end of the day. Especially between Rust and C. I remember looking at one of the source codes for one of the benchmarks and it was just back and forth. The C dev would make his attempt, the Rust dev copied it and added some optimizations, the C dev incorporated those optimizations and did a few extra things, and it went on until the C dev stopped submitting attempts.

It's garbage, go squirt ink and read a shell tutorial.

sepples doesnt actually touch the pointer, it immediately gets shipped to Lua, and in Lua, all pointers (or "userdata", as they call it) are void, so it's inherently unsafe. once the pointer gets shipped back to C++, theres really no way of checking to make sure whatever operations are done on it are safe
that and i really despise templates

Problem with Rust is the lack of ecosystem.
Mozilla had the money to actually invest and create big framework or libraries
Nobody's looking for a new language for embedded system
Nobody's going to write the next big kernel
Nobody's going to write the next big OS

If you want your language to be successful provide them with a good web stack, a good DB stack, a good mobile stack
Otherwise your language is forever doomed to be an academic/enthusiast circlejerk.

Wonder how Go and Kotlin got so successful? Don't you see?

But nooo..
MUH decentralization
I hope you don't expect the general mass to use your language if you need a third party crate just to read an int from CLI

Because you avoid the need to walk the dir tree and cd or build paths. Then you can make it a lot simpler by piping find | md5sum | uniq | xargs rm.

the problem with rust is borrow checking is gay

OOP

benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust.html
4 wins, 6 loses
Not too bad

Pretty good for building native modules for JS/Python thanks to their tooling. Good for performance-critical solo projects.

This can't be right for an INTRO to Java course right? So fucking hard...

static float getStandardDeviation (int numbers[]){ // I used the formula for SD of a population since it was not specified either way
float sum=0;
float standardDeviation=0;
for(int position=0;position

i++ looks better
Change my mind

Go is meant to replace scriptlangs with better performance, static typing and multithreading. Also, consumes far less memory than VM language implementations.

Go, because making it fetch and process concurrently won't be a huge pain.

Rust's management failed. It's goal is to be a safe systems language able to be used in embedded systems.... yet it never tried to push for certification processes for aviation, rail or defense. It never openly verified that it'll work on obscure real time systems like VxWorks, Pike, Lynx, and so forth. It never pushed for making the language inherently "provable" like SPARK does automatically for you.

Instead it went for SJW crusades, bashing C, and other stupid shit like a web browser.

This might be a weird request but I need to go full pajeet. Does anyone know of any good Java tutorials that take you through building a mock (somewhat realistic) typical enterprise ERP software? The type of software one would be tasked with working on if you got a code monkey job using Java at a soulless corporation. Either that or a good github repo for an open source example of a typical "enterprise-y" CRUD system with guides/comments.

Every Java tutorial I can find is just teaching language/concept basics. I know what a variable is, I know my data structures, I'm already experienced with other languages. I just need a tutorial that replicates the type of enterprise Java work experience I would get if I took a typical Java code monkey job.

can I use go to replace my flask server

It really does
And if the compiler changes it anyway like that other user said, I might have to go back

>`ls $(pwd)`
Come of, you really shouldn't be using ls in shell scripts, for many reasons.
find -type f -maxdepth 1 | xargs md5sum | awk '{ if (h[$1]) { print $2 } else { h[$1] = $2 }' | xargs rm

github.com/victorqribeiro/oldTerminal

I'm adding image support soon

Wife wife = waifu.marry(me);

>HTML terminal

Attached: idontknowwhatthefuckthisdoes.gif (752x675, 1.86M)

>sum = (sum+=numbers[position])

Attached: Untitled002.jpg (800x562, 109K)

Just use stackoverflow...

cool way to create a hot page with just text

Some user was looking for you

Attached: 1473659078174.jpg (980x551, 19K)

I'm not him, I just saved one of the gifs he made for me.

Slight correction:
find -maxdepth 1 -type f -exec md5sum {} + | awk '{ if (h[$1]) { print $2 } else { h[$1] = 1 } }' | xargs rm

Attached: 72491702_p0.jpg (2185x1553, 1.45M)

Is something along these lines a sensible emulation of load link/store conditional?
struct atomic_u64 {
uint64_t owner;
uint64_t value;
};

static uintptr_t self() {
static _Thread_local char me;
return (uintptr_t)&me;
}

static uint64_t load_link(struct atomic_u64 *p) {
atomic_store(&p->owner, self());
return atomic_load(&p->value);
}

static _Bool store_conditional(struct atomic_u64 *p, uint64_t value) {
uint64_t old_value = atomic_load(&p->value);

struct atomic_u64 old = { self(), old_value };
struct atomic_u64 new = { NULL, value };

return atomic_compare_exchange_weak(&p, &old, value);
}

Lisp is the most powerful programming language.

>Nobody's going to write the next big OS
Sure they will but it’s not gonna be rust, no matter how many delusional tranny advocates they hire

Why on earth aren't you using stdatomic.h?
Or is that what you're actually trying to emulate?

If you've taken intro statistics this is clear as day, especially if you have any prior programming experience. But if you lack one or both of those I get how it would look alien.
en.wikipedia.org/wiki/Standard_deviation#Uncorrected_sample_standard_deviation
this is the formula it's walking through.

it's not meant to be elegant. It's a teaching exercise stepping through a sigma expression the same way you would on paper.

Also if you're in the US i'm guessing this is about 1/3 of the way through a summer course? If so those are just more intense. I barely remember shit from those since every day was a cram session.

Infinite loop