/dpt/ - Daily Programming Thread

Anime edition

Previous thread: W-What are you working on senpai?

Attached: sister_reading_sicp.jpg (2236x1600, 730K)

Other urls found in this thread:

fortinet.com/blog/threat-research/satori-adds-known-exploit-chain-to-slave-wireless-ip-cameras.html
en.wikipedia.org/wiki/Number
en.wikipedia.org/wiki/Unit_testing
github.com/tuckerpo/real-time-cv-filters
paulgraham.com/avg.html
doc.rust-lang.org/rust-by-example/variable_bindings/mut.html
doc.rust-lang.org/rust-by-example/variable_bindings/scope.html
mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html
youtube.com/watch?v=CtbckFw0pJs
youtube.com/watch?v=eTXd89t8ngI
twitter.com/NSFWRedditImage

NEW /DPT/ RULES

>no windows
>no oop
>no nvidia

making a new nvidia driver for windows using sepples, lads.
wish me luck.

get out

Kek

what's satori?

I'm supposed to implement a Gender data type for my company's Haskell system... will this work?
data BodyType = Male | Female | Androgynous deriving (Eq, Show)
data Gender = Boy BodyType | Girl BodyType deriving (Eq, Show)
astolfo = Girl (Male)

>two genders
it isn't the fucking fifties any more user

>says two genders when there are clearly six possibilities
csgrad.jpg

gender is independent of "body type", whatever that is

fortinet.com/blog/threat-research/satori-adds-known-exploit-chain-to-slave-wireless-ip-cameras.html

even traps agree there are only two genders. All the rest is either political horseshit or a practical convenience to describe people en route to either "male" or "female."

You have to overcome a lot of internalized bullshit before you can say "I'm a girl" and believe it 100%, and it can take years. So in the meantime you can use "genderqueer" (or whatever) to describe yourself as being:
(1) not a boy
(2) not yet a girl except maybe in some vague intellectual sense

100% of people who identify as genderqueer/bigender/pangender/etc. will eventually end up as either male or female. And usually very close to the archetypal version of that gender (e.g. trad trap waifu).

newtype Gender = Gender { isMale :: Bool }

data Gender = Girl | NotYetAGirl
seems less bad than the usual dichotomy

I like it.

based and redpilled

data Gender = Male | Girl Gender deriving (Eq, Ord, Show)

>no matter how many times someone is a girl, deep down somewhere they have to be male
I like it

Recommendations on C and/or Perl Editor?

Looking for:
More than two panes, with tabs, and can use hotkeys to jump tabs and panes
Easily customizable or theme already present (Vibrant Ink)
Recognizes when a file on disk changes - I wouldn't think I'd have to specify this
Zoom levels per-document or global

Notepad++ : Great editor, Vibrant Ink, only two panes

Atom: Easily customizable, Vibrant Ink theme, doesn't recognize file changes (package file-watcher is fucking broken out the wazoo)

I was looking at Sublime 2/3. I know it's nagware, or I could pirate it.

Epsilon: Could probably find a version, might have decent theming support, don't think it has zoom. Most customizable.

you don't understand lazy evaluation, she can be a girl with not fixed point

I feel old

Attached: Screenshot_20180829-205649.png (1080x237, 99K)

What if I don't have a gender?

omg so true!!! #devrant #Jow Forumsprogramminghumor

see this is a big difference between least and greatest fixed point
ω = Girl ω

Is zero a number?

>not using #include every time you twit

en.wikipedia.org/wiki/Number
but we're talking about genders, not numbers, unless you mean to say there are uncountably infinite genders?

this is also fix Girl btw

There is literally nothing wrong with Hungarian Notation.

Notate THIS Hungarian

>add 10 lines of code to project
>a bug immediately arises and stops everything

How can I avoid this? It becomes annoying because every new project I start is always slowed by these, I feel like brainlet, Coming up with the algorithm is easy but when implementing it I always find little bugs or unexpected behaviour .I tried concentrating and "testing" the code in my head but I wanted to know what do you do to avoid bugs; do you just write 1k lines and just have minimum bugs like writing i instead of j or encounter a little more difficulty ?

Obviously, you should first test in toy programs rather than applying your entire project to new code. Run some more-or-less expected data against the new code in some small new "instance" (that is, new file, new project, or whatever the fuck it may be for your workflow). If it runs well against those expected tests, it'll probably run well in your actual program, barring some modifications.

this is probably obvious, but why doesn't this do anything?
from appJar import gui
app = gui()
app.addLabel("Progress")
def p():
for i in range(100):
app.queueFunction(app.setLabel("Progress", "%s/100" % i))
app.go()
app.thread(p)

commit to a test branch them merge when you know it's stable

I think there's """officially""" 64 genders.

Sauce?

en.wikipedia.org/wiki/Unit_testing

lisp languages are easier to read and understand than blub languages

Attached: 1530338055873.jpg (1637x2048, 335K)

Lisp is one of the biggest blub languages.

How the fuck to I get a struct to send and receive Data from a another struct and update a Dictionary in python. God this is killing me.

Attached: 1535581574477.png (852x944, 69K)

dumb frogposter

Vim. There probably is a plugin for noticing disk changes, though can't guarantee it since I've never had a need for bloat like that. Zoom levels you'll get from whatever your terminal is.

How about something that isn't autistic garbage?

How about you fuck off and choose a different hobby that is more for you such as finger painting or something.

if any of you autists are into computer vision and shit feel free to contribute


github.com/tuckerpo/real-time-cv-filters

There are actually 4 genders, XY, XX, XXY, XYY

Based, thanks.

What's a blub language?

never heard of it before. seems alright to me.

post code apu with comments on what you want to do. I will help

What's the best book for learning ASM? Preferably x86 to start but x64 is fine too.

Either Intel or AT&T syntax is fine.

paulgraham.com/avg.html

Decided to give rust a try but this is retarded, or I am

use std::i64;

fn main()
{
for i in 0..i64::MAX {
let last_two: i64 = i % 100;
if last_two == 11 || last_two == 12 || last_two == 13 {
let o = "th";
println!("{}{}", i, o);
} else {
let last = last_two % 10;
let o = match last {
1 => "st",
2 => "nd",
3 => "rd",
_ => "th",
};
println!("{}{}", i, o);
}
}
}


When placing the println outside the if block it throws an error saying o hasn't been found, or if I define o as empty beforehand it will cry about the first instance never being used. What do?

Programmed myself a command-line calculator that embeds a small programming language. Operator overloading, partial function application, and GMP for precise number handling. Been using it for my uni hw for the last few days, works well.

Attached: Screen Shot 2018-08-29 at 10.12.59 PM.png (196x132, 15K)

Post the sauce d00d

doc.rust-lang.org/rust-by-example/variable_bindings/mut.html
doc.rust-lang.org/rust-by-example/variable_bindings/scope.html

Both o's only exist for the scope of the surrounding { }. You'll probably want to make o mutable and define it before the if/else.

t. not a rust user at all

Like I said defining it beforehand makes it throw a warning that the first instance never gets used. The solution I posted is the only one without warnings.

>t. reading comprehension of a 5 year old

example of a non-blub language?

You didn't necessarily say you used the mut flag for it -- an easy thing to assume you didn't do, given that you said you're a new Rust dev. In any case, it's just a warning. Like the warning says, you can disable the "unused assignments" flag.

Similarly, you can format it like this:
use std::i64;

fn main()
{
for i in 0..2500 {
let last_two: i64 = i % 100;
let mut o = "th";
if !(last_two == 11 || last_two == 12 || last_two == 13) {
let last = last_two % 10;
o = match last {
1 => "st",
2 => "nd",
3 => "rd",
_ => "th",
};
}
println!("{}{}", i, o);
}
}

That is, make "th" the default case.

Eh, I don't know if you'd like it, and it's on my private git. It would be a pain in the ass to clone.

If I hadn't used the mut keyword it wouldn't given the issue I mentioned, it would've said "help: consider using `_o` instead", but thanks for clearing that up anyway.

It's not possible to avoid 100% of bugs, and proving something has no bugs is non-trivial or impossible for large enough problems. Knowing this, test aggressively. Test first to make sure that the intended cases work. Then test to make sure unintended inputs fail in a sane manner. Test to make sure that insane or malicious inputs also fail.

Where you are testing a single function taken out of context of the entire program, this is called a unit test.

Where you are testing how functions work with the rest of the program, this is called an integration test.

Both unit and integration tests are helpful tools, but you should also be aware that you can't test for all inputs, only the ones that you think are relevant.

One other tool you should not discount is the programming language itself. If you have say in the choice of language you are using, you should prefer strongly, statically typed languages for any large-scale programs. Ignoring the performance concerns of dynamic languages, the nature of strong static typing is that it lends itself to static code analysis. Anything your compiler can catch before you even run the program is a case you don't even have to test for.

How the fuck do you effectively test a kernel.
You can test the syscalls with user programs, but testing internal stuff is sometimes just so fucking delicate and there's so much shit to think about.

I'm looking for resources to learn Java.
I remember someone had a site where he hosted lessons for python, and after each lesson you would have vague instructions to create something which used the thing you just learned - he had similar things for other languages but i just cant remember the name

pls i need the source

Pick a Java framework or architecture and learn it.

You can't really learn Java (or any other modern language) for its own sake.

mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html

Is Swift the most based programming language?

import Foundation

var lit = ""
print(lit)

Any powershell fags out there? Recently had to start doing windows dev in C++ and I have cmake & make so I just write build scripts manually. Used to bash but writing shit for tech illiterate retards so just telling them to run cygwin or something is not an option.

Should i change my course at uni if i still don't really understand much about programming after 1 year? I'm stuck on this supposedly simple task in c++ and i cant even google it because i don't know the correct terminology for the problem.
I couldn't really give basic definitions of a lot of programming words if someone asked, feels like im just copying a lot of stuff from online.

If you're a year in and you can define the following:
- encapsulation
- inheritance
- polymorphism
- is-a
- pointer
- reference

it's time to drop out

hate*, not have, whoops.

Why are tech illiterate retards running your build scripts?

Hmm i know all of them except is-a, maybe not as bad as i thought.

maybe with that mindset. or you could like, you know, just stop copying stuff you find online and actually put some effort in. if you don't understand a concept, read about. if you don't have the words to describe something, ask your peers or instructors or the internet. stop abusing your tools and actually empower yourself.

do you really? show me.

What are you stuck on

I'm an experienced programmer, and I've never heard of is-a before. I never bought into the POO memes, though.

How do I program in Python on Android?

>experienced programmer
>has never used OOP
>doesn't know that literally 95% of all jobs in the modern world are OOP
>experienced programmer

Why is she sniffing her finger?

>hate cmake and make
Okay, protip: if you are using C++, just use CMake. It's the closest thing it has to a standard build system. I used to not really like CMake, so I hand-wrote a lot of makefiles and tried using a semi-convoluted makefile that wouldn't need updating.

CMake makes everything easier as soon as you sit down with it and learn how it works.

1. Install Termux
2. apt install python3 (assuming it isn't installed in Termux already)

>>has never used OOP
I didn't say I've never used it. I just don't buy into the idea that OOP is actually good.

>kernel development is hard
Wow

CMake is fucking shit. Use Meson; it's significantly better.

Name a better standardized paradigm then.

Could a commercial facial recognition system be written with Python or would it be to slow?

Procedural programming favoring pure functions where possible,

... without making my phone an autism machine, like the helmet guy.
I just want to code when I'm away from home and I got a 'great' idea.

Maybe some sort of a browser ide? But are these free?

>Could a commercial facial recognition system be written with Python
Yes.
>would it be to slow
Too slow for what exactly?

Not really sure the best way to explain it, i have an array and im trying to create a function that references the array, i get you use pointers and dont just recreate the array but my function keeps returning no value.
i didnt mean copy verbatim i just meant copy their method. I guess you are right though im not really understanding it that well.
im busy

>Too slow for what exactly?
To be a viable commercial product for high traffic areas

What kind of traffic?
People? Automobiles? Freshly baked goods?

>facial recognition
Oh fuck, I cannot read apparently.
So yeah, I'd imagine that organizations interested in facial recognition have a lot of money to throw at this thing,so I would guess that they can always throw more computers at it if it gets kinda slow.
Also commercial viability in this area would probably be more about people you know.

Stop being pedantic, your not funny

your're not funny
FTFY

Where have you been James?

when i find solutions to my problems on so or elsewhere i take the time to generalize them and make them my own. i also take notes about any potential caveats and my use case. i wouldn't ever add to my source, something i don't understand.

and busy you may be but it truly helps comprehension and retention to verbalize ideas to others. also remember that you're dedicated at least four years of your life to this. make time.

repl.it

Python:
youtube.com/watch?v=CtbckFw0pJs
Java:
youtube.com/watch?v=eTXd89t8ngI
Hindi is the secret sauce to master these two.