/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

gist.github.com/bkaradzic/2e39896bc7d8c34e042b
youtube.com/watch?v=zW_HyDTPjO0
youtube.com/watch?v=QZD2nRqVoKg
twitter.com/NSFWRedditVideo

Bought 25 Raspberry Pis and I'm gonna make a concurrent FizzBuzz

>What are you working on, Sup Forums?
Improving my programming ability.

FUCK YOU OP.
I fucking asked you to post an anime image this thread, and you didn't.
Make it again.

I'm going to start a project where I don't expect a big number of contributors. My options for choosing the primary language are as follows.

1. Use a language in which I am not comfortable with, but it is massively popular and has tons of libraries but at the same time somewhat counter-productive.

2. Use a language that I am most comfortable with, but it is very unpopular and library count is very limited but I can stay comparatively more productive since I know it well.

Sorry my man, just woke up
next time

No, this time.
Delete the thread.

Always pick C.

That's a weird way of spelling C++

>Always pick C.
Discarded. Serious answerers only, please.

>Use a language in which I am not comfortable with, but it is massively popular and has tons of libraries but at the same time somewhat counter-productive.
Sounds like the definition of Javascript

I'm serious. If you want your open source program to be taken seriously, it has to be written in C.

Depends on how capable your contributors are.
Good C++ > Good C > Bad C >>>> Bad C++

C++ can be counter productive if it's a one man show

nothing.

I need project ideas in C or Perl

Welcome to C, where we take pride in writing 50 lines for the program that are just one liners in other languages

machine learning DNN whatever thing that can detect whether a qt trap or a 3DPD is present in a picture

>no anime image

d r o p p e d
r
o
p
p
e
d

>Good C++
That's an oxymoron.

idea guy here

make an image board

gist.github.com/bkaradzic/2e39896bc7d8c34e042b

>C with classes
No, that's not good C++.

By definition all C++ code is terrible, so "good C++" can not exist.

Not big into web development

that sounds like something I'd need a decent server to get working properly, even if I knew how to make it.

Am I just making excuses? who knows.
I'd like to do operating system related stuff. What's some entry level project I could do to get into kernel development?

>All C++ code is terrible
>Thus all of the common C/C++ subset is terrible
>Thus the vast majority of C is terrible

>>Thus the vast majority of C is terrible
C and C++ have different semantics, even for what would be syntactically the same code.
They should not be considered the same program, because they are demonstrably not.

Also, most C programs does not compile as C++, idiot.

that's wrong. Many of them compile with warnings. C++ just forces you to be more careful with pointers usually, this is the main thing that wouldn't let it compile.

Andrei's anime

Can I write unit tests for C code in bash or Perl?

No, he's a necrophile.

Proofs?

negrophile?

He's been "working on" the same corpse for 15 years.

>unit tests
I guess you technically can, but it would need to generate code that compiles and links with your own code, so it's going to be more complicated than to just use one of the existing C unit test frameworks that already exists.

But for integration testing, validation testing and system testing (as well as regression testing), it's preferable to use some form of scripting language.

>C and C++ have different semantics, even for what would be syntactically the same code.
Rarely. Outside of void* usage, the C constructs which are not C++ constructs or behave differently as C++ are all edge cases.

Do you believe that the only code which is good C code is the code which does not compile as C++?

...

D's not dead though

AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHHAHAHAHHAHHAHHAHHAHHAH

It's worse than dead, it's stillborn.

What is the best programming language, and why is it Python?
>Highly readable
>Fantastic range of libraries
>Elegant integration of OOP features
>Smaller memory footprint than C++ and Java
Guess I answered my own question.

>>Smaller memory footprint than C++ and Java

>>Elegant integration of OOP features
dude self lmao

Error: Argument not found

>Elegant integration of OOP features
>self, self, self, self
>Smaller memory footprint than C++ and Java
>
I lol'd

You can count the total number of D users using 2 bits.
If that's not dead, I don't know what is.

Proofs?

What language do you suggest?

...

argumentum ad populum

...

>I fucking asked
Don't ask.
Just post.

This guy does it in Python youtube.com/watch?v=zW_HyDTPjO0 so I thought why not bash.
I'd like to change my C code as little as possible. Any bash or Perl tools to load a function given its name, whether from the compiled code or source, run it with given parameters and output its output? Something like cffi, I guess, as used in 4:30.

We're not talking about it being good, we're talking about it being dead.

not an argument

>Highly readable
>source uses tabs
>you use spaces
>I N D E N T A T I O N E R R O R

Languages are not alive

Just google it.

Thanks for the video, I wasn't aware that any non-C unit test frameworks existed.

This is going to make my life a lot easier.

...

Well shopped my friend

What is the best programming language, and why is it Haskell?
>Dude monads lmao
Guess I answered my own question.

Did you think it's going to be funny?

I didn't edit that picture, aside from cropping my screenshot.

I think this is possible with any group of languages that can call one another's functions.

Also there are unit test frameworks for bash so all I need to test C code in bash is basically to load C functions.

say i have a multidimensional array A [i,p]
in c#, is it possible to access the A[p] and change the value of A[p] only?

Suuuuure, all you did was "crop" it

you do not understand what a multidimensional array is

Do I think what's going to be funny?

I'm struggling to understand interfaces and abstract classes in Java. I know those rules of them, but I just don't understand them in terms of the 'bigger picture' kind of thing. Like, when would I be using them? Why would you use them over inheritance, nested classes, or 'protected' classes/fields/methods? I don't know what to do with them and I can't seem to piece it together in my head.

Are there any good books or videos that explain this stuff for idiots? I just can't get my head around it.

a n-dimensional array is basically just a floor(n/2)-dimensional array of floor(n/2)+1-dimensional arrays

Anyone got an idea for a project that would be useful for me to do? I'm thinking about doing rust or javascript.

create your own esoteric language and write an interpreter (+IDE) for it

yes i don't
any good links so that i can understand multidimentional array and jagged array?

>No mention of skill level and fields interested in
Write an x86-64 emulator.

Get a non-trivial pull accepted into Linux.

U S E F U L

In a Lua program, I need to make a hundred buttons response to mouseovers.
This means binding a hundred events.
How can I do this iteratively?
All the buttons are in an array.

The difficulty lies in binding those events iteratively such they produce unique responses.

You can do:
buttons[i].MouseOver:connect(function)
But this will mean that there is no way to tell which button your mouse was over.

But you can't do
buttons[i].MouseOver:connect(function(buttons[i]))
Because you can't connect a function with arguments, only one without.

All three are valid and mine is also trivial to do

Why wouldn't an x86-64 emulator be useful?
Make it target ARM, and even have dynamic recompilation from x86 assembly to ARM assembly.

Really though, if you're not going to mention skill level, people are just going to throw out EXTREMELY difficult programs to write.

Interfaces are easiest to understand when you look at Java's collection framework.
Say you want to use a List. List is an interface which specifies certain methods. You can add items to the end of a list or remove them, among other things.
List myList;
...
myList.add(new Object());
myList.remove(myList.size() - 1);
The important thing is that we don't care how the list is implemented, all that matters is that it has these methods. The two most common ways to implement a list are the ArrayList and a LinkedList. Both of these implement the List interface (which can be thought of as a limited form of inheritance), but they are unrelated otherwise. An ArrayList uses an array to store its list contents, while a LinkedList uses a sequence of nodes with pointers to each other.

But for our purposes, none of that matters. It's just a List, so let's use it like one.
List myList = new ArrayList();
myList.add(new Object());
myList.remove(myList.size() - 1);
If I wanted to write a method that finds the biggest number in a list, I shouldn't care what kind of list it is. All I should care about is that it has List methods.
public static findBiggest(List myList)
{

}

You can't make a List, since it's not a real class. It's just a contract saying what a class implementing it needs to be able to do.
List myList = new List(); // does not compile

As much as I love Rust, it feels just as counter-productive. Conversion to and from &str and String, lifetimes, trait generics make it harder. I have high hopes for Rust but it still needs a lot of syntax sugar (like a way to distinguish a &str quotation and a String etc. Like """this""" should return a mutable String and "this" should return a &str, or, a more intuitive module system, a built-in readln!() etc comes to mind). Coming from D, Rust's Generics (in combination with with traits) do not seem all that helpful/comfortable to me. (though it might change over the time). Rust only reached v1.0 a while ago so I believe there be polishing to come.

>Because you can't connect a function with arguments, only one without.
buttons[i].MouseOver:connect(function() fn(buttons[i]) end)

Skid shit belongs to >>>/wdg/

Lua has nothing to do with webdev.

Lua is for skids, skids don't belong here

>skids
You clearly don't know what the word means.
Also, if I had to apply it to a programming language, it would definitely be python.
import solution
solution.run()

>skids don't belong here

Are_you_sure_about_that.mp4

I know exactly what that means. Your trash scripting ```language``` is not programming. Take that pseudo programmer garbage out of here

Yes, skids don't program. Scripting is not programming

Ah, I see. Thank you. But why would I choose an interface over an abstract class, or vice versa?

You can only extend one class, but you can implement as many interfaces as you like. Since you can only extend one class, you better make it count.
Abstract classes can contain variables and implementations of methods while interfaces only contain declarations of methods that must be implemented later*. A class (abstract or not) can do strictly more than an interface.
Some other languages (e.g. C++) don't have limitations such as this. You can inherit from multiple classes freely. Java is trying to force you to write code a certain way.

*default methods added in Java 8 allow you to define method implementations inside interfaces too. But no variables.

Trying to stay awake on 24 hours no sleep, I'm not even programming I just watched Dragon Ball yesterday/today. I'm reading this though

Python is an amazing language, but it's slow as fuck. There always seems to be a better alternative. For the smallest scripts you can use python, but you might use any of the million scripting languages at that level. For www you use php and javascript, for heavy calculations you use c. What do you actually use python for that wouldn't be better done with something else?

Holy shit she's Qt
youtube.com/watch?v=QZD2nRqVoKg

so this... is the power... of blogposting..... incredible...

yeah man, haha like, dude, thumbs up.

Do you guys procrastinate towards the end of writing a bit of code? When I've been working on a project for a couple of weeks and it's finally wrapped up I get cold feet and just don't write enough code I should be.

>2017
>Still watching dragon ball

>Do you guys procrastinate towards the end of writing a bit of code?
Of course. Everyone does it. It's easy to write in the start, since everything is clean and simple. Towards the end, everything is chaotic, shitty and buggy, so you just wish to already dump the project over for some poor cunt who has to maintain it.

Too true.

See that is one of the problems with python, they should have never allowed spaces to be used.