/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0568r0.pdf
youtube.com/watch?v=zBkNBP00wJE
docs.python.org/3/library/gc.html
channel9.msdn.com/Events/Seth-on-the-Road/Codemash-2017/Why-Rust-is-Awesome-with-Carol-Nichols#comments
github.com/carols10cents/cargo-open/commits/master
twitter.com/SFWRedditImages

Factories did nothing wrong.
Sup Forums memelords a shit.

Mostly reading parts of the JLS to learn obscure tricks like :: and whatnot. I have to do OOP in Java next semester so why not.

>What are you working on, Sup Forums?
Inventory system for a client in C#
Personal and payroll system for a client in C#
Budget and cash flow system for my personal use in C#
Cryptocurrency trader in Python
An RPG in C#-Mono/C++/Lua (Maye change the C#-Mono to another language soon)

t. never finish anythin

class FizzFactory implements BuzzFactory

Employed anons
do you have at least a basic understanding of every part of your product?

what's the point of making an instance of a class just to call one function

It's the OOP way.

Possibly the instance stores some result of the function. If there is no need for an instance, just make the function static.

Why did python become so popular.
It's such a fucking mess.

brainlet friendly

it's a brainlet enabler

Almost impossible for leaking stuff

>imblying not ever realworld language isn't a fucking mess

doesn't python use a refcounting gc

So what has C++ done for Embedded Programming

Well the first 2 I have to finish. budget thing is my main priority now, the crypto thing is lagging behind. the RPG ive been working on for 12 years so no rush (only started to code it 3 years ago though, my design document and other notes is written in a book that's 2.5 inches thick, if people thought dwarf fortress is autism this is going to blow them away).

there is no sane way to use C++ for embedded programming

almost all of C++ is garbage in any circumstance. Exceptions, OOP, RAII are all broken yet all of C++ is dependent on them
the two good features of C++, templates and constexpr, both depend on vague linkage. You do not want this when programming for an embedded system.
So the only features left to use are the ones from C.

Because perl was atrocious in comparison.
I am not kidding.

rate
#!/usr/bin/perl

use warnings;
use strict;

my @acronyms = ("imo", "lol", "lmao", "rofl","senpai", "desu", "tbqh",
"baka", "smdh", "wtf", "omg", "bbq", "ngr", "linux");

my @long = ("in my opinion", "laughing out loud", "laughing my ass off",
"rolling on the floor laughing", "faggot", "to be honest",
"to be quite honest", "shaking my head", "shaking my damn head",
"what the fuck", "oh my god", "barbeque", "nice guy right", "GNU/Linux");

while () {
my $line = $_;
for (my $i=0; $i

Are there any languages with the same machine learning and numerical libraries as python, but not shit?

Good for writing quick scripts or bindings to lower level stuff for things like data analysis (tensorflow?) or web stuff I guess and got picked up by people who didn't want to learn a different language to do x
It's not as if you see many desktop programs written in python

Rust++

except nobody in their right mind ever thought it was a good idea to make mid-sized frameworks in perl.

>more than 3LOC
> my $line = $_
> for()
> two arrays
> scalar @acronyms
2/10

open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0568r0.pdf

>2/10
write a better version please

I just learned about church numerals and did the exercice where you gotta implement them.

That's so fucking awesome. I didn't knew lamb-duhs could be this fun. Shit's awesome.
Thank you /dpt/ for meming me into reading this book.

>wg21

k dork

you can do anything with lambdas
tuples, lists, etc

is she the only programming waifu?

>I didn't knew lamb-duhs could be this fun. Shit's awesome.
You ain't seem shit yet, young Haskellina.
(define (inc n) (lambda (f z) (n f (f z))))
(define (add a b) (lambda (f z) (a f (b f z))))
(define (mul a b) (lambda (f z) (a (lambda (s) (b f s)) z)))

(define (succ n) (cons n n))

(define (_0 f z) z)
(define _1 (inc _0))
(define _2 (inc _1))
(define _3 (inc _2))

((mul _2 _3) succ '())

also gif saved

C11 included _Generic which expands to stuff based on variable type. If they are going to implement this shitty piece of shit feature which requires that compiler can reason about the the variable type why not include other features like gnu extension ({ }) or typeof?

>C++ is dependent on them
No, and that's the point

at least use a hash table (or hash dictionnary ? or w/e it's called)

and do something like
$line =~ s/$_/$long{$_}/gi for (keys %longs

w-why ?

It's weird that C11 requires the preprocessor of all things to reason about the type of an expression.

In Python list comprehensions, is it possible to nest loops without nesting lists?
[list[i][j] for i in list[j] for i in list[i]]

I wouldn't get your hopes up.

_Generic is a compiler construct, but it doesn't make sense to use it outside of a macro.

>trying to multiple inheritance java style ABC POOP without an IDE

Yes. Literally what you typed unless I'm retarded.

Oh, my mistake then.

To combat type autism and keep Haskellers in their containment language.

Ruby is better than both but only appeared on the scene in 2006 when rails put it on the radar and by then it was 10 years too late.

*blocks your path*
youtube.com/watch?v=zBkNBP00wJE

Ruby is just Perl with fewer punctuation. It's much as bad semantically.

What am I doing wrong?

wordList = [word for word in line.split() for line in input]

Results in "NameError: name 'line' is not defined"

reverse them. write fors in the order you would write them if you were writing normal fors.

#!/usr/bin/ruby
acronyms = ["imo", "lol", "lmao", "rofl","senpai", "desu", "tbqh", "baka", "smdh", "wtf", "omg", "bbq", "ngr", "linux"]
long = ["in my opinion", "laughing out loud", "laughing my ass off", "rolling on the floor laughing", "faggot", "to be honest", "to be quite honest", "shaking my head", "shaking my damn head", "what the fuck", "oh my god", "barbeque", "nice guy right", "GNU/Linux"]

mapping = acronyms.zip(long)
while string = gets
puts mapping.each_with_object(string) { |(r,s),acc| acc.gsub!(r,s) }
end

fors are this way in list comprehension examples.

How would I reverse this?

Only dorks use lambdas
I think I'm gonna beat you up, loser

[word for line in input for word in line.split()]
looks retarded but it works

Got it, thanks I'm a brainlet.

At this point the mentally ill people are too deep in their own bullshit I think that C some room to expand without getting rustfags interested in C.
You still have to manually manage memory and know your shit which is too much for some people and works as great barrier.

The only truly bad thing about Ruby is the library system. Python's modules truly are superior. The rest is awesome. Saying Ruby is just a nicer Perl is ignorance.

In Python this is just:
import acronyms

yeah there is something about that exercise
just truly awesum

import myass

>not using a hash

Why?

I'm working on mastering the ancient arts of procastrinating. After that, I'll be writing an RSS/Atom feed reader in Rust.

What is the best way to display multiple line list in ncurses?
I have an array of string, each string could take 1 or 2 line.
then I need to display all string as much as possible, and if there is more line than the display area, print as much as possible.
For example:
I have 5 string : "This\nis", "only", "a test"
and the display only fit 3 lines.
then the the display should be:
+----------+
|This |
|is |
|only |
+----------+

My current implementation is by print all of them in the display window, then redraw the border to cover it, and refresh other window to hide the overflow
Is there any way to do this properly?

>rust coders being unproductive procrastinators
Is anyone surprised?

yes
not that hard really

so then doesn't this cause a memory leak
def foo():
bar = []
bar.append(bar)
foo()

implementation defined. cpython has a full gc that detects cyclic referencing.

It shouldn't. Bar is unreachable after foo returns.

see docs.python.org/3/library/gc.html

objects like integers or native types are ref counted but objects composing with data (eg: user defined classes) are handled by the gc.

I see. So they're only refcounted if they hold no references and thus can't participate in a reference cycle.

I wonder what those produce for the following input
I got in the limo quite angry because somebody stole my lolipop.

I got in the lin my opinion quite anice guy righty because somebody stole my laughing out loudipop.
Apparently.

c++ is the greatest language of all time

then why does it need cmake autism?

almost every C++ feature was a mistake

to scare away pajeets and soyboys

rust is the greatest language of all time

B was a mistake that spawned the curly brace horror genre, with produced masterpieces of bad design like C++, JavaScript, Rust, Java etc.

What is lighter for my python script, a mysql table to manage a small amount of data (3 columns, avg 50 lines) or save it all on a json file (avg 50 write function calls)? Also, the mysqld service usage doesn't come in account, I have another project on my server that uses mysql 24/7 so the only think that matters for my python script is inserts and selects.

Why not SQLite?

I totally forgot about it, actually I never used sqlite that much to remember of it as an option but thanks for freshing my mind, user.

>import csv

Who is this Carol Nickols woman and why does she sound like an idiot?
channel9.msdn.com/Events/Seth-on-the-Road/Codemash-2017/Why-Rust-is-Awesome-with-Carol-Nichols#comments

I wanted to earn some money while learning things and signed up on upwork. However, they keep declining.

What's the best alternative where it's not such a pain to join?

>she

Is... is that a Jewish tranny? Only at Rust, folks.

i think i'm hitting a wall with using vanilla vim for programming. when i work on larger projects it's a pain to sift through folders and files. is thereva good file explorer addon i could use? or maybe a good linux ide that's minimalistic and has proper vim key bindings?

Did you expect her to be on par with Simon Peyton Jones?

emacs.

Networking.
Upwork and similar sites are filled with pajeets and slavs, you will not be able to find anything that is worth your while.

Alright guys. I have a conditional directional partial mesh where each vertex is unique. I need to find (and save or log) all paths (no repeating vertices or edges) between vertices from a list of vertices and vertices from another list of vertices (The same vertex may be present in both lists). Some of the conditionals can be known at compile time, others run time. But some of them would require a decent amount of effort to calculate.

I'm pretty sure I should use a depth-first search and should construct 'wormholes' between vertices in series with no branches when first traversed during the search. Is there anything else obvious that I should try to plan to do to decrease the complexity of coding this and/or increase the performance?
Also, I'm thinking that rather than try to calculate some of the harder conditionals, it's probably better to just assume it can traverse and attach the conditional assumed to the vertex identifier in the path. Does that sound right?
I keep debating on whether I should do the same for easier conditionals too, because if the easier conditionals use information propagated from a vertex in the first list I can't mark the vertex as being unable to reach a specific vertex for later traversals because conditionals that were calculated to be can't-traverse might be can-traverse for another vertex from the first list. But then again I wouldn't be able to mark a vertex as unable to reach a specific vertex in the first place unless I traversed into it from a one-way edge, or traversed into it from the same edge.

Too much stuff that I can't figure out whether it'd make it harder and/or take longer or easier and/or run quicker. Halp!

Yes. Apparently she co-wrote the most popular book on Rust.
Also, check how productive she is:
github.com/carols10cents/cargo-open/commits/master
She makes a lot of commits.

And your point is?

Oh, each edge is unique too. But edges connect two or more vertices and the connection to a vertex can be one way in one direction, the other direction, or bi-directional.

I've been setting up a Linux (Mint) notebook for college the last couple weeks. Before that I only messed with Visual Studio and a bit of QtCreator. I'll use several languages throughout the year (C/C++, Java, Python and maybe Javascript), and was wondering which route should I go:

1- Different Net Brains IDEs for each language (they seem to have similar structures and functionalities)
2- Eclipse for literally everything
3- Visual Studio Code + a lot of setting up and fiddling to make it work kind of like an IDE for all of them.

VSCode looks okay, but it feels like a hassle having to setup everything manually via JSON files and project settings every time. No one seems to like Eclipse and its ugly face. And wasting time "learning" to use half a dozen proprietary IDEs sounds like a bad time/money investment.

What do? Right now I'm leaning on just using Eclipse.


pic unrelated.

why cant cmake find boost? I downloaded the
newest boost binaries from the webpage. I even updated cmake. I even set the BOOST_ROOT variable but still...

Just use Atom. In my experience VSCode has been pretty buggy and the only reason for that is because it's Microsoft's side project.

C++, Cmake, and Boost are all cancers.

in C++, if I make a pointer to some mess of crap, then I pass the pointer to a function, then the function uses the pointer to do operations on the mess of crap, but doesn't declare any new variables in the function body, there's no chance of memory leak right? Memory leak with pointers can only occur if I declare new pointers inside the function and don't delete them by the end of the function?

Is there some scripting language that can just import C header and let you call the functions without you having to declare every type and prototype again for the ffi?