/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old Thread:

Other urls found in this thread:

pastebin.com/8L6BLFkc
ddili.org/ders/d.en/
github.com/majestrate/XD/releases/tag/v0.0.1
difranco.net/compsci/C_Operator_Precedence_Table.htm
gist.github.com/anonymous/df510064839058571756b243d0173e7e
twitter.com/AnonBabble

FUCK LITERALLY ONE MINUTE OFF

...

...

A social network for weebs.

Bought a ThinkPad today, just got Visual Studio installed, sitting on my couch doing some C++ practice problems with Cowboy Bebop on the TV in the background. I somehow convinced myself that getting a laptop would increase my coding productivity.

It hasn't, and I don't even care.

Connect 4 in Java. Sup Forums memes were right about uni.

In the Knapsack problem, you're supposed to put as much objects as possible, per their weights (values) in a knapsack of a fixed size.

Similarly to this, there is also another problem called the Bin Packing problem, where you need to put all the available items in as few as bins/knapsacks as possible, and again the capacity of one bin/knapsack is known.


I have a problem now that is similar to these two, but yet different a little bit. Contrary to the bin packing problem, where you want to minimize the number of bins, I now have the number of bins available beforehand, but the capacity of bins is the parameter that I want to optimize - namely, I want the capacities of all the bins to be as similar as possible, after I packed my items in them.

Is this a known problem, has it already been discused somewhere?

or rather, the criterion that i want to minimize is the maximum capacity of the biggest bin, among the available bins that I am using.

In C++, does std::end(arr[]) have to loop through the array somehow to find off-the-end, or is the operation constant in time?

Writing network-facing code in C.

first for c

I think you can safely assume it's done in constant time with pointer arithmetic.

You'll never make it, brainlet

I think C should have its own safe heaven threads. No one likes C tards

>safe spaCe general

no.
I dont like c either, but hugbox threads are worse.

rate my triangle thing.
pastebin.com/8L6BLFkc

kek

Implementing mechanism for feature flags on an angular 2 application using redux

Angular 2 a shit

hmmm
this doesn't sound very computationally easy to me

i'm not sure if a solution to a 3-bin problem is necessarily a part of a soluton for a 4-bin problem, but to be fair the bin packing problem feels the same to me so i'm not sure - since i'm only familiar with knapsack

in other words, you'll have to generate all possibilities

This thread is blessed by C from the OP.

Is that why the thread is so dead?

Good alternatives to C?

What program are you trying to make? What project?

There are none. C is the only truly portable language that can give you C-level performance.

rekt

rust, c++, d

>X is the only truly portable language that can give you X-level performance.
So this is the power of a C toddler

Learning.

>C
>Portable

ddili.org/ders/d.en/

why are c-fags getting bullied so hard all of a sudden

No, it's alive, thanks to your autism screeching "How C is bad".

All this started here Notice how the angry C manlet brought this up out of the blue

>No
Now*

Fortran

just released 0.0.1 of my i2p bittorrent client that is probably full of bugs
github.com/majestrate/XD/releases/tag/v0.0.1

needs a good logo tho

use the gtorrent logo

Nintendo DS homebrew.

*crickets*

I meant "No".

>just released 0.0.1
literally who cares about a day 1 project

You did

only enough to call him a baka

*smack* so... uhm... yeah... *gulp gulp gulp gulp* *smack* basically... uhm...

t. casey

>autistic meltdown

How do I make an iterator function for a metatable in Lua?

Hi I'm a Cfag, should I learn POO?

Only if it's CLOS or Smalltalk.

POO is omnipresent, even if you're not willing to use it personally it's probably a good idea to actually learn the concepts and be able to explain them.

No. You should learn the difference between char[] and strings

Dumb anime poster.

Take your pills.

Writing software to help promote free speech. Going to use it to defeat Trump supporters and save america from Russian invasion

Wrong board faggot

fuck off sjw
white genocide is more important than your shitty causes

>implying Trump doesn't openly invite Putin to place his balls in his mouth.

well, what do you think c and non-c programmers?

(((RUSKIY))) SHILL DETECTED

200 Rubles have been deposited in your Ruskiy Mir account, komrad :^)

Here's the order of operations for C

difranco.net/compsci/C_Operator_Precedence_Table.htm

Your professor is retarded

fuck off
the most superior race after east asians, jews and brahmins will prevail

Precedence isn't the same as order of evaluation, retard

are gonna to keep fixing, developing and documenting this shit?

Russians are not human. fact.

Please return to turnip farm, dmitry

I would say that makes sense. Think about something like Amdahl's Law: always optimize for the common case, such as a small number (or only one) binary operator.

Get linux, stop watching anime

No I don't want to trade stability for anything

C was a milkshake
ML was Robbin

>Here's the order of operations for C
>difranco.net/compsci/C_Operator_Precedence_Table.htm
Knowledge level: C toddler

Just wrote a calculator with algebraic notation in rust, with a parser that should be extensible to arbitrary binary operators.

Am I doing the parsing thing right?

gist.github.com/anonymous/df510064839058571756b243d0173e7e

That code looks beautiful

> C toddlers
such a fummy nene

It's just the usual retards. Report and ignore.

Please rewrite it in a language that's actually readable, and ask again.

That looks readable to me, are you sure you read any project that's not a fizzbuzz?

Yeah that looks about right but you'll have to change the approach if you're gonna want to add support for variables and functions.

c toddler makes its presence known

...

...

Example input into the repl:
( 2 + 7 ) * 5 / 3
Output:
Ok(Float(15))
The AST of your expression is: Ok("(* (+ 2 7) (/ 5 3))")

That's the "hackish" way to proceed, writing the grammar in LL(1) form is more elegant.

t. shit for brains

So angry

All I see is &!::!->::=>::)()())::())&::. I don't know what any of that means, so I can't read the code.

Why do you need a {:?} ?

Stop replying to him.
Please don't post if you don't have an'y meaningful contribution.

>I don't know what any of that means,
Have you tried shutting your dumbass mouth when you are supposed to in that case?

I guess that makes sense if you don't know any programming, how about you try to learn something first then before you read and judge other people's code?

yes, i have a roadmap somewhere

i'm trying to make a haskell script that i can use in bash to sort things, this is what i have
midpoint :: [a] -> Int
midpoint xs = length xs `div` 2

halves :: [a] -> ([a],[a])
halves xs = (splitAt $ midpoint xs) xs

merge :: (Ord a) => [a] -> [a] -> [a]
merge (x:xs) (y:ys)
| x < y = x:merge xs (y:ys)
| otherwise = y:merge (x:xs) ys
merge [] ys = ys
merge xs [] = xs

mergesort :: (Ord a) => [a] -> [a]
mergesort [] = []
mergesort [x] = [x]
mergesort xs = merge (mergesort a) (mergesort b)
where (a,b) = halves xs

main :: IO()
main = do
input

???? why not just use the sort you have on your system

what ideas do you have for the logo?

>mergesort of all things

**i mean in the terminal. and i know there's already stuff to sort things, i'm just annoyed i can't get this to work

PATH variable. Include your binary in your PATH

none at the moment

that's like asking why not just drive when i wake up in the morning and find i'm unable to walk.. it's not the point that i don't technically have to walk right now..

that's a shit analogy
you want to sort things
there's a sort binary in binutils
use it

the correct analogy would be that you have a car in your garage and need to drive somewhere but instead you decided to make your own car

Some one has to make cars