/dpt/ - Daily Programming Thread

Someone finally made a new thread edition

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

youtube.com/watch?v=ZFjhkohHdAA&list=PLOtl7M3yp-DV69F32zdK7YJcNXpTunF2b
twitter.com/NSFWRedditVideo

>What are you working on, Sup Forums?
C# stuff,
you wouldn't understand.

I love Rust!

>want to use libpng (or pretty much any library) with Visual Studio
>linking errors
>okay maybe it works with a previous version of VS
>nope
Why is C/C++ such a fucking mess?

>I love Rust!
Hello. My name is Clayton, and I like potatoes.

Does Homotopy Type theory have any use to a programmer besides mental masturbation?

I'm rewriting my userspace NVMe driver API due to a change in design.

Brainlet here, I have a question. Let's look at this algorithm.
We could try all possible orderings of the points, then select
the one which minimizes the total length:
d = ∞
For each of the n! permutations Πi of the n
points
If (cost(Πi) ≤ d) then
d = cost(Πi) and Pmin = Πi
Return Pmin

Since all possible orderings are considered, we are guaranteed
to end up with the shortest possible tour.

The instructor asks "How many different orderings are there, on these n points?" He then proceeds to say " (n-1)/2 orderings" as the answer. Can someone kindly explain why? I thought there would be "n! orderings". I know it is a retarded question, but I just want to make sure I understand everything before moving on.
For anyone interested on the lesson:
youtube.com/watch?v=ZFjhkohHdAA&list=PLOtl7M3yp-DV69F32zdK7YJcNXpTunF2b

>C/C++ is the problem
>not visual studio
The problem clearly exists between chair and keyboard.

Dicking around with concurrency in D

I meant to say " (n-1)!/2" as the answer.

is G-code a real programming language?
is CNC machine programming "real programming"?

Need my daily trap dose
Where is it?

My back hurts just looking at the picture.

How's your language coming /dpt/? Introduce it to us in a single sentence.

I'm good at coding but I don't know what to make.. I should make something useful on linux that people like

it's shit

"things just werk, but it's not dynamic trash"

Any ideas how to optimize this? Has awful runtime for more than 6 items.

Wanted to create a program that given a list of prices of items, it would group certain items together such that the price of a item + shipping + tax + duty would be minimized.

using CP;
int item_count = 8;
range items = 0..item_count;
range groups = 0..item_count;
float prices[items] = [34, 15, 18, 10, 88, 123, 80, 5, 44];

dvar boolean in_basket[groups][items];

dexpr float groupSum[g in groups] = sum(i in groups) in_basket[g][i] * prices[i];
dexpr float DPH[g in groups] = (groupSum[g] > 22) * groupSum[g] * 0.20;
dexpr float duty[g in groups] = (groupSum[g] > 150) * groupSum[g] * 0.11;
dexpr float total[g in groups] = (groupSum[g] + DPH[g] + duty[g] + (groupSum[g] > 0) * 11);

minimize sum(g in groups) total[g];

subject to {
forall (i in items) {
sum(g in groups) in_basket[g][i] == 1;
}
}

I call it C! Its just like C but every symbol needs to end in an exclamation mark.

#!include! !
int! main!(!)!
{!
printf!("!Hello, World!"!)!;!
return! 0!;!
}!

Make a reminder app that
- let's you set multiple appointments
- has built in alarms
- actually has an intrusive alarm pop-up with alarm beep
- can optionally sync with your android phone

I don't have these problems with gcc, ld, and standard makefiles.

I'm preparing to pitch elm to my coworkers. The next step is Haskell... And then.. the world!

MSVC is an abomination, but I don't know about the surrounding tooling.

0.19 never

Try your pitch on me. I've never heard of it and would like to learn more without googling anything.

What is the secret of being guru at programming other than practising hard? Everyone practice at some level but just very few people really into this shit. I guess it is some kind of deep understanding level for some special people who really understand the core of the programming. I want to know if anyone has opinion about this
anyone?

also anyone doing crypto mining?

>crypto mining
what a retard

Not him, but:
Do you want a pure functional language for front-end webshit and only front-end webshit, that's actually built from the ground-up from a haskell background?

why? its making money out of nothing? free resource?

Seems highly specialized.

It is, that's the point.
It's good, but very barebones right now, and updates are reallllly slow because it's basically one full-time person who takes his time. We're 13 months in and the last update was about a year. But he's actually paid by a company that uses it in production so there's that

It's easier to work with than our existing react redux and angular approaches, is purely functional and strongly typed. In practical terms this makes it more maintainable for our existing team of functional programmers. For us elm will be much easier to reason about than for instance css.

No css, no markup, no js. One language one source of truth, and we have the existing competence in the team to hit the ground running.

do your own homework

>no js
You haven't had to touch ports at all?

Not even homework. I just need to know why there are "(n-1)! / 2" instead of just "n!". I know I am missing something basic, but I just simply want to know why.

Since you are a Rustfag perhaps you can advise.
I don't want to use Rust because it's the epitome of bluepilled.
But you know who else is notoriously bluepilled, and known to use Rust in great numbers?
Trannies.
You know who comprises a small percentage of trannies?
Traps.
And you know who's hot?
Goddamn fucking traps.
Should I continue using C, the redpilled DIY alpha male's language, or convert to the liberal shitlang that's so obsessed with safety it won't even let you violate it outside the context of programming, solely in pursuit of the hypothetical dank trap booty?
>inb4 traps are gay

Porting GLFW + OpenGL to .NET Core.

>missing digit is 3 6 or 9
My number was 222.
Your magic trick disappoints me.

My plan is to totally avoid it. We're about to rebuild something from the start and do not involve existing code.

You should probably kill yourself, desu.

>Should I continue using C, the redpilled DIY alpha male's language
C's pretty bluepilled from a modern programming standpoint. Having a weak type system is unacceptable.

> Having a weak type system is unacceptable
spotted the soyboy. Can't program without the compiler telling you your types match, cuck?

You nig you been watching that CS lectures - are they fine starting point for brainlets?

Why not use the exclamation mark as a replacement for ;?

#include

int main()
{
puts("Hello, world")!
return 0!
}

Explicit is better than implicit, user.

Not enough !

>MSVC is an abomination
This, they break library compatibility constantly, it's really annoying

>C, the redpilled DIY alpha male's language
sure. could (C)uck apologists even tell the difference between an expression and a statement? people who advocate C are 101% PLT illiterate.

for loop searching for x element in a array is considered a linear search algorithm right?

We are having a semester course called data struckture and algorithms were we are learning about 0(N) running times and such. And i cant for the life of me figure out what runs at what efficiencies.

I know two trans programmers and they prefer dynamically typed languages like Python and Lisp over Rust.

Ignore the SJW meme wrt Rust. It's an OK language, it's better than C++ in a lot of ways, but the borrow checker will inevitably fuck you over no matter how hard you try, so programming with it is always a pain.

think about the worst possible case

The K&R book doesn't explain arrays very well. It just shows an example of a program that counts digits, white space and other chars with arrays. Tell me about arrays. How do they work?

int x; declares an integer named x.
int array[3]; declares 3 integers in consecutive memory. Those integers are array[0], array[1], array[2].

An array is an abstraction of a pointer to a block of memory. When you use indexing (arr[n]) it basically does *(arr + n).

Just wanted to say I've been coming here for 4 threads now. I guess I caught something.

>for loop searching for x element in a array is considered a linear search algorithm right?
Yes
Unless you try binary
So? it is still linear search.

You forgot to say these are all 0 integers
3 is the capacity not 1-3 integers range

>This is valid C code that compiles without warnings (even with -Wall), and runs without error
int main() {
int arr[2];
0[arr] = 1;
0[arr][arr] = 42;
return 1[arr];
}

>0[arr][arr]
uhh

That's a good thing. Why should there be warnings? Just don't do that if it scares people on your team.

idk how this constraints block works (and opl in general) but maybe a lot of the runtime is spent generating permutations of in_basket and checking that each item is only in one group? finding the total cost for each permutation of in_basket should be pretty fast if the compiler is sane, that being said the number of valid permutations of in_basket grows at least exponentially with the number of items unless theres something really extreme im missing

The self-delusion of C elitists never ceases to amaze me.

...

It's not, visual studio and C/++ development on windows is.

>What are you working on, Sup Forums?
Doing my sicp exercises,
hopefully it won't take too long an I'll be able to read a bit too.

>I'm going to abuse pointers and then complain that the compiler doesnt fix it for me
How about you just don't abuse pointers?

I don't even like C but that's completely logical if you understand the logic behind it which is quite simple. Of all retardations in C you chose to complain about the trivial thing that makes sense, congratulations.

had that problem with code:blocks
I had to set the flags in at least 3 different places and I couldn't figure out how to get my makefile to work
why is linux unironically a lot simpler?

>This is valid C code
it's not actually.

0[arr][arr] -> *( *(0+arr) + arr))
arr[arr[0]] -> *( arr + *(arr+0))

Because linux isn't working with 20 years of legacy, hard-baked crap. It was very smartly built to be completely modular, as opposed to windows which is still including legacy files from 1995 because everything accidentally depends on it, but nobody knows what the actual fuck it does.

have made some progress so far

Yup, completely logical.

oops, no pic

pointer arithmetic is gay

is there any particular reason you are writing Lynx clone ?

But it seems like a very huge jump. For 6 items it gives result instantaneously, fur 7 items it's infinite runtime.

is c just c++ for people who don't wanna learn?

Short answer: No
Long answer: I'm not gunna explain why this statement is fucking retarded

printf("text\n");
cout

My language is going to KILL Rust.

I'm having issues with dos line endings in cygwin.
Any way I can make my .sh files ignore return carriage?
Running dos2unix all the time is not a good solution.

Rust is already dead

Sure but can it do this?

#include

class Faggot {};

std::ostream& operator

I'll make it even deader.

>Faggot faggot
>Faggot fag
so cool

it can, it's admittedly a tad more involved

How come?

>C
>Overloading
>Operator overloading
>String streams
>Strings

>>Overloading
gay
>>Operator overloading
also gay
>>String streams
has it
>>Strings
has it

Ur mum is gay

>>>Overloading
>gay

no

>>>Strings
>has it

more like ocuml amirite?

>generics are overloading

>`and` == `is`

>He thinks Strings aren't char arrays under the hood in literally any other language
Get a load of this guy

#include
#include
static int PA_FAG;
typedef struct {
int u,r,a;
} fag;

void print_fag_varg_func(void* mem, va_list *ap) {}
int print_compl_arginfo_size(const struct printf_info *info,
size_t n, int* argtypes, int* size)
{
if(n>0) argtypes[0]=PA_FAG;
*size = sizeof(fag);
return 1;
}
int print_fag(FILE* fp,
const struct printf_info *info,
const void* const *args)
{
return fprintf(fp,"you");
}
int main()
{
PA_FAG = register_printf_type(print_fag_varg_func);
register_printf_specifier('w',print_fag,print_compl_arginfo_size);
fag u;
printf("%w\n",u); // prints "you"
}

allowing user defined types to be printed just like regular types