[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 321
Thread images: 33

File: K&R himegoto waifux2.png (1MB, 1000x1400px) Image search: [Google]
K&R himegoto waifux2.png
1MB, 1000x1400px
old thread: >>60135137

What are you working on, /g/?
>>
File: 1491718414755.png (441KB, 1048x587px) Image search: [Google]
1491718414755.png
441KB, 1048x587px
Creating a program which will detect and destroy all forms of OOP and OOP languages.
>>
>>60139439
>himegoto
Stop posting your stupid fag agenda.
>>
>>60139435
That is about the dumbest thing I've ever heard
>>
>>60139466
Same here. Might be in my top 5.
>>
>>60139466
it's not that dumb
even in C, the va_args macro only exists as a compiler hack
you used to be able to implement completely in in pre-ansi C but not anymore
>>
File: 1475803858342.jpg (46KB, 480x456px) Image search: [Google]
1475803858342.jpg
46KB, 480x456px
Programming challenge:
/pol/ tard simulator. Make a program that imitates /pol/ speak

$redpill Install Gentoo
= (((Install)) (((Gentoo))

$redpill David Icke
= (((David))) (((Icke)))
>>
File: 1493252602425.jpg (129KB, 1280x720px) Image search: [Google]
1493252602425.jpg
129KB, 1280x720px
>>60139456
ganbatte karen-senpai!
death to object oriented programming!
>>
>>60139478
It's outright false. How is that not dumb?
>>
>>60139457
hime isn't gay
>>
ruby is ass
>>
>>60139479
redpill x = "((({x})))";
redpill cuck
>>
File: corruption.png (3MB, 1920x1080px) Image search: [Google]
corruption.png
3MB, 1920x1080px
I'm making a computer game!
>>
>>60139456
stupid (non) functional autist
>>
File: anime urine dispenser.png (533KB, 580x773px) Image search: [Google]
anime urine dispenser.png
533KB, 580x773px
Can someone explain C++ nested types to me and why they're not a total abomination?
>>
File: 1350594293765.jpg (111KB, 500x500px) Image search: [Google]
1350594293765.jpg
111KB, 500x500px
In Java I can do something like

for(String myString in strings) {
// Do things with myString here
}


Is there something similar I can do for a C++ vector?
>>
>>60139534
I'm terribly sorry for the failure you call a life. I truly am.
Why does your kind seem to think that OOP is somehow the opposite of FP?
>>
>>60139457
himegoto is a /dpt/ tradition and just because one random fag strolls in one day and complains doesn't mean we're going to stop our ways
>>
>>60139540
What's a "nested type"?
>>
>>60139564
class Foo {
class Bar {
}
}

The definition of Bar is nested inside the definition of Foo. It's a type of object used by Foo.
>>
>>60139562
>/dpt/ tradition
Are you fucking serious? Its very obvious that you haven't been here for very long.
>>
>>60139580
Forgot
code tags
but you get the point
>>
>>60139580
>class
It's impossible to explain how this is somehow not an abomination.
>>
Can somebody rationally explain why OOP is no good without foaming at the mouth?
>>
>>60139633
https://mollyrocket.com/casey/stream_0019.html
>>
>>60139633
Yes.
>>
>>60139638
So inheritance get messy when applied to real world problems?
>>
>>60139666
>real world
What is a "real" world?
>>
>>60139479
use std::env;

fn main(){
let inputs :Vec<String> = env::args().skip(1).collect();
for input in inputs {
print!("((({}))) ", input);
}
println!();
}

user0@primary:~/devel/proj/test-rs/test1/src$ redpill le communism
(((le))) (((communism)))
user0@primary:~/devel/proj/test-rs/test1/src$ redpill Stalingrad
(((Stalingrad)))
>>
>>60139670
>le
>>>/r/abbit
>>
>>60139669
"real world" = "tangible problem"

there.
>>
>>60139676
redpill \>\>\>\/r\/abbit
(((>>>/r/abbit)))
>>
>>60139666
Object oriented programming more often than not distracts from the problem at hand, and causes programs to become far more expansive than required.
>>
>>60139680
>tangible problem
What do you mean by this? How can a problem be "intangible"?
>>
>>60139676
>>60139676
>>60139676
>>60139676
>>>/i/rony
>>
>>60139479
Just scrape /pol/ and train a markov chain on it.
>>
>>60139688
I've recently come across a joke program that was called 'hello world - Enterprise Edition'.

Would this be a parody of what your talking about?
>>
File: title1.gif (13KB, 495x96px) Image search: [Google]
title1.gif
13KB, 495x96px
How is it that pic related is ranked 9 in the TIOBE index, yet hardly anyone seems to talk about it? I've yet to meet a single Delphi programmer.

>>60139701
We will bring back Tay.
>>
>>60139479
redpill =  eachWord (\word -> "(((" ++ word ++ ")))")
where
eachWord f x = unwords $ map f (words x)
>>
>>60139719
Indeed! That, and the corporate edition of FizzBuzz. Basically, object oriented programming does to relatively simple problems what big business does to simple products: overdevelop it, complicate it for no real reason, and jack up the (development) cost.

Note that this is not always the case, but something I've encountered a LOT of times.
>>
>>60139739
"No type signature"
"Ugly newline after 'where'"
"Ugly camelCase"
5/10
>>
>>60139557
Yes
>>
>>60139745
>"No type signature"
>"Ugly newline after 'where'"
>"Ugly camelCase"
Who said these?
>>
>>60139761
>Who said these?
(>>60139745) did.
>>
>>60139557
Yes.
#include <string>
#include <vector>
#include <iostream>

int main()
{
std::vector<std::string> op = { "is" , "a", "fag" };

for (const auto& s : op)
{
std::cout << s << '\n';
}
}
>>
>>60139761
"" is quotation introduction. I said all of that out loud.
>>
File: C5S95ikWIAAS_zg.jpg (36KB, 809x390px) Image search: [Google]
C5S95ikWIAAS_zg.jpg
36KB, 809x390px
>>60139769
Thank you!
>>
File: 1462016971721.jpg (54KB, 444x399px) Image search: [Google]
1462016971721.jpg
54KB, 444x399px
>>60139670
>
Stalingrad
>>
>>60139740
>overdevelop it, complicate it for no real reason, and jack up the (development) cost.

Isn't this a good thing for programmers in the job market? I mean, sure a lot of the time it's not the most efficient form of programming but my first reaction to this is thinking that it's a genius way of keeping yourself employable: Create a knot that only you can untie.
>>
>>60139769
in Haskell this is just

main = mapM_ putStrLn (words "is a fag")
>>
>>60139778
I demand my thank you too. Why didn't you thank me?
>>
>>60139730
>I've yet to meet a single Delphi programmer.
Russian students.
>>
File: 1493452667221.png (2MB, 697x8275px) Image search: [Google]
1493452667221.png
2MB, 697x8275px
>>60139791
And that is the exact reason why OOP is the primary thing being taught at programming colleges and universities.

More often than not you'll want personal projects to not take forever, though.
>>
File: Flora.jpg (450KB, 1710x1368px) Image search: [Google]
Flora.jpg
450KB, 1710x1368px
>>60139808
Thank you, too, anon!
>>
>>60139580
This would make sense if Bar is only needed by Foo. That way you're not polluting the global namespace with an unnecessary type.
>>
>>60139557
In Rust it's just
for words in strings {
// Do things with myString here
}
>>
File: 1485261762847.gif (727KB, 500x500px) Image search: [Google]
1485261762847.gif
727KB, 500x500px
>>60139819
Not him, but thank you too! (for posting these anime images)
>>
>>60139841
Ignore Karen posters
Hide Karen threads
Don't reply to Karen posts
>>
Figured I might as well ask here, as SO isn't as useful as it used to be ever since they made registration mandatory. I'll post there anyway but you fags will be my backup I guess.

I'm in the middle of writing a C++ program designed to take in a plain .txt file, a 9x9 grid of sudoku, and solve it.

Below is what I currently have, and I can attach a .zip of the whole damn thing if any of you want for the necessary dependencies and header files. I've already had a friend who's more competent in programming than I am looking at it and he's not even sure on where I should go from here. I've removed as many comments as I can so you just see how the program works. I'm aware there's unfinished sections, that's where you come in.

https://pastebin.com/3p5gxbNL
(code was 2000 characters too long; had to post it on pastebin instead)
>>
>>60139540
They are used for namespacing, take vector::iterator for example.
>>
>>60139791
That's why I only look for C++ jobs with huge OOP codebases. Job security guaranteed.
>>
>>60139862
>uses preincrement everywhere possible to avoid temporary variable creation

niiiice
>>
>>60139874
He didn't say this.
>>
>>60139862
>I'm aware there's unfinished sections, that's where you come in.
No one is going to write your program for you. Unless you come back with a specific question/problem you're not sure how to deal with, you will receive 0 help.
>>
http://steve-yegge.blogspot.no/2010/12/haskell-researchers-announce-discovery.html
>>
>>60139862
>>global scope static

Disgusting.
>>
>>60139876
I looked at the pastebin dumbass.
>>
>>60139914
That phrase doesn't appear anywhere in the pastebin.
>>
>>60139914
Just report him.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead, and she's super duper cute! Say something nice about her, /dpt/!
>>
>>60139862
>unnecessary wrapper class around a single function
>uses a global variable anyways
>capitalized function names
>one function responsible for I/O and all parts of the algorithm
>char[] instead of string
>takes filename parameter, discards it and just uses a hardcoded value

-1/10
>>
File: 1492807463807.jpg (92KB, 1280x720px) Image search: [Google]
1492807463807.jpg
92KB, 1280x720px
>>60139862
Great, now I have cancer again. Thanks anon.
>>
>>60139945

she looks like a boy
>>
>>60139990
(D)ick only makes it better!
>>
What are the best implementations for the following?
1) Fortran
2) Pascal
3) Ada
>>
>>60139589
fucking commie
>>
>>60139990
>>60140000
WRONG
dlang is a healthy tomboy language!
>>
>>60140033
What does the c*mmunist "class" have to do with set theory?
>>
>>60140047
it is a joke because communism wants to abolish all classes because they think it is bad, like your comment that said class is an abomination but you were talking about programming and i made it look like you were talking about social classes, it was a joke sorry if it made you confused
>>
>>60140059
My post itself was a triple-layered joke. But now it's double-layered since I have revealed it.
>>
File: IMG_0275.gif (3MB, 500x500px) Image search: [Google]
IMG_0275.gif
3MB, 500x500px
>>60139439
is oop basically just having methods inside structs instead of having static methods to modify structs?
>>
>>60140077
>IMG_0275.gif
I don't want reddit/frogposting stink nearby. Fuck off.
>>
>>60139804
That is pretty nice. I was playing around to see what is possible right now with anonymous objects in C++1z:

cat iter.cpp && ./a.out 

#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

int main()
{
std::vector<std::string> op = { "is" , "a", "fag" };

for (const auto& c : {"op", "is"})
{
std::cout << c;
if (std::any_of(op.cbegin(), op.cend(), [c](const std::string& s) { return s == c; } ) )
{
std::cout << " found";
}
std::cout << '\n';
}
}

op
is found
>>
>>60140077
dumb frogposter
>>
>>60139439
Ive done gui programming for android and its easy. Is swing just as easy for java. C++ qt is shit.
>>
>>60140077
Classes are literally structs but with private inheritance.
>>
>>60139487
It's not false at all. Generics in java don't exist beyond compile time. They just get resolved to static types.

https://en.wikipedia.org/wiki/Generics_in_Java#Problems_with_type_erasure
>>
>>60140136
don't respond to frogposters in earnest.
>>
>>60140142
how do you know he is a frogposter?
>>
File: incredulous.png (25KB, 187x146px) Image search: [Google]
incredulous.png
25KB, 187x146px
>>60140147
???
Are you blind, anon?
>>
>>60140152
His homemade cli 4chan interface doesn't have the resolution to let him recognize anything, leave him be.
>>
File: vomit.jpg (90KB, 650x650px) Image search: [Google]
vomit.jpg
90KB, 650x650px
>>60140116
>>
>>60140139
Java code also doesn't exist beyond compile time, so according to your logic, the language itself isn't a language feature, it's just a compiler "hack".
>>
I'm writing a program in C which needs configuration in files. Sould I go with JSON (json-c), YAML (libyaml) or something different (my own parser?)?
>>
>>60140227
JSON
>>
>>60140234
Why?
>>
>>60140238
Well established standard
>>
>>60140116
>>60140177

Less verbose:
#include <iostream>
#include <algorithm>

int main()
{
auto op = { "is" , "a", "fag" };
for (const auto& c : {"op", "is"})
{
std::cout << c;
if (std::any_of(op.begin(), op.end(),
[c](const auto& s) { return s == c; }))
{
std::cout << " found";
}
std::cout << '\n';
}
}
>>
>>60140241
Good point. I don't like in JSON that it doesn't support comments.
>>
>>60140227

.ini format

* Also established
* Supports comments

Alternately, if you're not above plugging the lua interpreter into it, you can use that as well, depending on how powerful you want the comments to be.

Easier than writing a parser
>>
>>60140227
TOML works better for configuration files, in my opinion.
It's very similar to .ini, but is more flexible like JSON.
>>
https://www.reddit.com/r/golang/comments/68dy2k/why_im_leaving_go_by_the_side_of_the_road/
>>
>>60140275
TOML is pretty nice actually
>>
>>60140276
>reddit.com
Please kill you'reself.
>>
>>60140139
Are you retarded? He made a universal statement about generics.
There are languages with generics, but without compilers. Therefore generics are not a "compiler hack".
>>
I've almost finished writing a program which takes as input a field of view algorithm and an autoexplore algorithm and allows for testing of the algorithms with visual feedback and variable run-time parameters, and spits out statistics at the end.

If I were to make this public in a week or two when it's finished, and write good instructions for how to implement your algorithms to work with this (you basically just inherit a class and put it in the right namespace), would anyone be interested in trying it out?
>>
File: 1483950421233.gif (993KB, 490x375px) Image search: [Google]
1483950421233.gif
993KB, 490x375px
Small programming challenges?
>>
>>60140262
Thanks, I'll try iniparser then.
>>60140275
I've never heard of that. Indeed looks like INI. Is there a C parser for this?
>>
>>60140291
He specifically mentioned java.
>>
>>60140327
Fizzbuzz, Eratosthenes sieve, 99 bottles.
>>
>>60140330
>Is there a C parser for this?
They link some off of the TOML github page.
>>
>>60140182
False equivalence.
>>
File: professor-dwarf.png (440KB, 531x800px) Image search: [Google]
professor-dwarf.png
440KB, 531x800px
>>60140327
Solvers for https://en.wikipedia.org/wiki/Des_chiffres_et_des_lettres
>>
>>60140339
Done 'em all. Any others?
>>
>>60140342
I missed that, thanks.
>>
>>60140327
Given two positive integers passed to your program, calculate the GCD and print the result.
>>
>>60140361
#!/usr/bin/env ocaml

let rec gcd a = function
| 0 -> a
| b -> gcd b (a mod b)
;;

let () =
let a = int_of_string Sys.argv.(1) in
let b = int_of_string Sys.argv.(2) in
let d = gcd a b in
Printf.printf "%d\n" d;
flush stdout
;;
>>
>>60140353
Brainfuck interpreter.
>>
>>60140353
Implement some sorting algorithm like quicksort or mergesort, or some graph algorithm like Dijkstra, Floyd–Warshall.

Or a library for manipulating linked lists or some kind of trees.

Or, implement a prefix calculator using the Shunting yard algorithm (also by Dijkstra).
>>
>>60140353
Solve sodokus using simulated annealing.
>>
>>60140353
Make it so that I can make love to vim with an anal vibrator.
>>
>>60140415
If you used emacs, you would already have this feature.
https://www.youtube.com/watch?v=D1sXuHnf_lo
>>
>>60139670
>>60139769
>>60140116
>>60140246
> all these plebs using C++

Kill yourselves.
>>
>>60140473
emacs is for fags with bad taste.
>>
how to match VARIABLE in appname-VARIABLE and do commands for all VARIABLEs in bash?
>>
>>60140485

>>60139670 here, it's not C++
>>
>>60140653
My bad
>>
>>60139730
tiobe index does not measure the number of programmers in language X.
>>
>>60139562
>original content in OP image instead of forced memes is a /dpt/ tradition and just because one random fag strolls in one day and complains doesn't mean we're going to stop our ways

It's just (You) though.
>>
>>60140611
Consider using Python instead of Bash.
>>
>>60139479
>24MB of RAM in 2001
>reaching 150GHz by 2034
>>
>>60140611
for all app-VAR do commands using VAR ?
>>
>>60140611
input=appname-VARIABLE
for i in $(sed 's/^appname-\(.*\)$/\1/' <<<&input'); do echo $i; done

fails if VARIABLE contains a space tho
>>
>>60140855
My own very reliable sources.
>>
>>60140855
The image: read it.
>>
What does /dpt/ think about entity-component-system architectures? It seems quite useful, as it replaces complex OO hierarchies by using composition to equip entities with the desired components. Seems really useful to me (esp. in gamedev, where I started to use it)
>>
>>60140892
its bretty gud but the performance and complexity overhead is not negligible
most modern game engines uses a combination of both
>>
>>60140892
Its good for performance if you do it right (ie. tightly packed, small structs in arrays), but its more complex thank just packing everything into one thing.
If I have large amounts of objects whose parts need to be updated quickly, I use it.
>>
>>60140883
The image doesn't say "reaching 150GHz by 2034"
>>
Is this a good video to learn coding?
https://www.youtube.com/watch?v=u9VYglJAfxM
>>
>>60140976
Can you try harder when you bate?
>>
Best learning resource for Python?
>>
>>60141003
https://docs.python.org/3/
>>
>>60139670
You don't need to collect the iterator, you can just use the original args iterator as the argument of the for loop.
>>
File: 1470686721967.jpg (36KB, 528x519px) Image search: [Google]
1470686721967.jpg
36KB, 528x519px
>>60139804
>mapM_
>>
File: 1472651418836.gif (445KB, 178x180px) Image search: [Google]
1472651418836.gif
445KB, 178x180px
>>60140361
use std::io::Write;
use std::str::FromStr;
fn main() {
let mut numbers = Vec::new();
for arg in std::env::args().skip(1) {
numbers.push(u64::from_str(&arg).expect("error parsing argument"));
}

if numbers.len() == 0 {
writeln!(std::io::stderr(), "Usage: gcd NUMBER ...").unwrap();
std::process::exit(1);
}
let mut d = numbers[0];
for m in &numbers[1..] {
d = gcd(d, *m);
}
println!("The greatest common divisor of {:?} is {}", numbers, d);
}

fn gcd(mut n: u64, mut m: u64) -> u64 {
assert!(n != 0 && m != 0);
while m != 0 {
if m < n {
let t = m; m = n; n = t;
}
m = m % n;
}
n
}

#[test]
fn test_gcd() {
assert_eq!(gcd(2 * 5 * 11 * 17,3 * 7 * 13 * 19), 1);
assert_eq!(gcd(2 * 3 * 5 * 11 * 17, 3 * 7 * 11 * 13 * 19), 3 * 11);
}
>>
File: 1458588190310.jpg (37KB, 348x342px) Image search: [Google]
1458588190310.jpg
37KB, 348x342px
>>60141059
What do you mean?
>>
File: 1477859712876.png (167KB, 1920x1055px) Image search: [Google]
1477859712876.png
167KB, 1920x1055px
>>60141126
Forgot to show output
>>
File: 1460306854328.png (228KB, 358x408px) Image search: [Google]
1460306854328.png
228KB, 358x408px
>>60141126
>having tests for mathematical functions
>>
>>60141157
Because after all, I made the gcd function myself
>>
>>60141126
I'm gonna need sauce on the gif.
>>
>>60139804
(mapc 'print '("is" "a" "fag"))
>>
>>60141162
You should prove that your implementation is indeed the gcd function.
>>
>>60141126
>Rust Programmer (male)
Is this the new meme?
>>
We need a new programming language called Lust.
>>
>>60140353
Visualization of the Mandelbrot set with infinite zoom.
>>
File: 1482157200784.jpg (72KB, 960x960px) Image search: [Google]
1482157200784.jpg
72KB, 960x960px
>>60141243
I'd be intrigued
>>
>>60141126
Rust is ugly. Why deviate from a winning formula (C-like syntax)?
>>
>>60141256
C-like syntax is an abomination.
>>
I have a picturebox, which upon clicking should update, but it doesn't, it only changes once, but it should alternate between the two images.
What am I doing wrong?
private void Form1_Click(object sender, EventArgs e)
{
PictureBox p = (PictureBox)sender;
if(p.image.ToString() == Properties.Resources.image1.ToString())
p.image = Properties.Resources.image2;
else if(p.image.ToString() == Properties.Resources.image2.ToString())
p.image = Properties.Resources.image1;
}


The images are generated by user input, so he decides how many there will be, but it only changes 1 to 2, but if it's 2, it doesn't change to 1.
>>
>>60141126
Your code is not idiomatic enough.
Please write more safely.
use std::str::FromStr;

fn gcd(a: u64, b: u64) -> u64 {
a.checked_rem(b).map(|a| gcd(b, a)).unwrap_or(a)
}

fn main()
{
println!("GCD is {}", std::env::args().skip(1).filter_map(|a| u64::from_str(&a).ok()).fold(0, |d, n| gcd(d, n)))
}
>>
>>60141310
Add print statements to try to understand what's actually happening, like everyone does.

Are you sure ToString is the best tool available to identify image objects?
>>
>>60141243
So it would be a Lispy Rust, akin to Liskell.
>>
Currently setting up a script to capture videos and images downloaded to my phone by using mitmproxy. I've been wanting to do this for a few months, and today I finally got around to doing it.
>>
>>60140948
Yes, it does.
>>
>>60141390
Nope, the word "reaching" simply isn't in the image.
>>
Can someone explain JSON to me? If there's a website API that just returns pure JSON in the form of "{"item":"true"}", does this mean JSONP method is impossible and if so, what do I do to retrieve that JSON? I have no trouble with local JSON, but I just don't know what to do about JSON from an external URL, all the info I found on google just got me more confused.
>>
>>60141353
It never goes into the else statement. ToString is probably the best, as with .Equals it doesn't go in any statement, and if I just compare the image in the pictureBox to the saved image, the code does nothing.
Just for reference, the user inputs a number, and then the program generates arrows (up or down). If the user clicks on one, it should change to the opposite and if he clicks again, to the opposite (original) position.
>>
>>60141412
What? All you have to do is make an HTTP request to the API to retrieve the data and proceed as usual with it.
>>
>>60141417
What does ToString yield on image1?

That's Java right? in which case I don't see how == could fail, if you do
p.image = Properties.Resources.image1
, how can
p.image != Properties.Resources.image1
immediately after? That would imply
Properties.Resources.image1 != Properties.Resources.image1
which makes no sense. Are you sure you are initializing p.image to one of image1 or image2?
>>
>>60141409
So you can't extrapolate that 'reaching 150GHz in 2034' is a paraphrasing an image set in 2034 with a 150GHz computer in it?

No wonder you're engaging in quotation pedantry on 4chan.
>>
>>60141430
yeah but when I tried that I got " Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource" error
>>
>>60141488
Then it's an internal API used by the service rather than one that's supposed to be used by other people.
>>
Catching up on some work, which mostly consists of webdev and some server management after I finally got my sturdy elitebook. They are a pleasure to work with.
>>
>>60141514
Is there anything I can do? I can see the json itself when I go to the link myself, is there a way to scrape that info?
>>
>>60141533
>webdev
>>>/g/wdg
>>
>>60141534
Depends, what's the allow origin header on the server?
>>
File: 1484873707855.jpg (30KB, 384x539px) Image search: [Google]
1484873707855.jpg
30KB, 384x539px
Why does Rust have to make everything so overly complicated with it's safety features?
>>
File: 1469209292576.png (72KB, 180x530px) Image search: [Google]
1469209292576.png
72KB, 180x530px
>>60141556
You'll get used to it. It's a good habit to develop
>>
>>60141249
How do you do infinite zoom though? You're limited by the precision of float/double. Do you mean to use something like GNU mulitprcesision library?
>>
Twitter sentiment analysis ticker. First some basic Bayesian later full RNN.
>>
>>60141455
Sorry, posting from phone so I don't see the whole code.
Even if I remove the second if statement and only put else it doesn't work.
Both images should be the same, since there's only two saved in the resources.
However, if I remove only the else, and leave the if, it goes through and changes the arrow to up, which is obvious, since this should work.
But I don't know why this is not working correctly if I use if and if else.
>>
>>60141613
I just gave the task. You solve it however you want.
>>
>>60141574
>good habit to overcomplicate stuff
Nope it isn't a good habit, only for Rust maybe but programming in general should always take the easy route with safety in mind.
>>
>Learn horrid Java and develop for Android only

or

>Learn React Native and develop for iOS android

Hmm.. what's the point of learning java when React Native can do both systems with one code?
>>
>>60141653
>posting from phone
Not gonna tire myself answering some fuck who can't even ask for help properly. Post actual code or leave.

>Both images should be the same, since there's only two saved in the resources.
define "being the same"

>However, if I remove only the else, and leave the if, it goes through and changes the arrow to up, which is obvious, since this should work.
I don't know what image contains an up arrow and I shouldn't have to know that in order to troubleshoot your incompetent ass. Be precise.

>But I don't know why this is not working correctly if I use if and if else.
Neither do I.
>>
>>60141687
Did someone say that? I don't see it in the thread.
>>
>>60141703
see
>>60141310
There's nothing else to the code, except when the image is generating, it just randoms the image to 1 or 2. On every click, it should change to the opposite image, but it only changes to one image, that is the one, which is in the first if statement.
>>
>>60141703
>Not gonna tire myself
But anon, we are all already tired.
>>
>>60141748
>it should change to the opposite image, but it only changes to one image, that is the one, which is in the first if statement.
We want to understand why your if-clause does not work. Answer >>60141455:
>What does ToString return on image1?
>>
>>60141686
You missed where I also implied that safe programming practice is a good habit to develop.

I feel you though. I've started with Rust last week and I still prototype with D and then think of ways to implement the program in question to Rust.

Might I ask you what feels complicated?
1. It's multi paradigm: You can practice both functional and imperative programming. Since many people (including me) don't have FP background, the FP code snippets look unreadable.

2. Too much writing? Not liking
let mut numbers = Vec::new();
for arg in std::env::args().skip(1) {
numbers.push(u64::from_str(&arg).expect("error parsing argument"));
}
?
These are building blocks, anon. Behind every fgets(), there is an ugly looking underlying function as well. Rust is not hiding it because primarily, the language is still at its infancy --they haven't came up with standard macros/functions to do these.
>>
https://dpaste.de/JOgv
what do
>>
>>60141556
Are you referring to my ultra-safe code in >>60141321?
>>
Hey /dpt/
Which license are you using if you want a truly nonrestrictive, free one?
I like WTFPL but I don't want to copy paste the no warranty clause in every source document.
>>
>>60141773
System.Drawing.Bitmap
I'm guessing it's the same on the second image, but the problem is, if I don't compare strings, the images don't change at all.
>>
>>60141687
if you are comfortable with js go for react
>>
>>60141687
>>60141818
Wrong thread.
>>>/g/wdg/
>>
>>60141794
I don't think any sensible court is going to subvert your intent if you have a LICENSE.txt and every file has just two line like
// Copyright 2017 Anon
// Released under MIT license, see LICENSE.txt

Lots of projects do it, and no lawyer can twist it into meaning anything besides what it actually means.
>>
>>60141778
>the FP code snippets look unreadable
I strongly disagree. FP is just programming done right. The "FP is hard" myth needs to die.

>I still prototype with D
This is an appalling habit and you should stop it immediately.
>>
>>60141794
>Which license are you using if you want a truly nonrestrictive, free one?
Boost License or Apache
>>
>>60141794
You should always use the most recent version of the GNU GPL.
>>
>>60141853
>FP is just programming done right.
Agree
>>
>>60141806
>I'm guessing it's the same on the second image, but the problem is, if I don't compare strings, the images don't change at all.
Comparing strings is NEVER gonna work because all strings returned by ToString() are the same according to you, so every comparison is true This explains your results with >>60141310, it only changes to 2 because the first branch is taken each time. Now take the == or .Equals route and debug it.
>>
>>60141838
JS is not web only language anymore my good lad. And appdev is not webdev
>>
>>60141853
> FP is just programming done right
This might be true. But the current compilers we have are not really efficient with FP practices.
>>
>>60141860
https://www.gnu.org/licenses/why-not-lgpl
The same reasoning applies against the Boost, Apache, MIT, etc. licenses.
>>
>>60140611
"${VARIABLE#appname-}"
>>
Dunno if this really fits here, considering it's mysql, but I keep getting an error when trying to insert.

The error is apparently that I'm trying to insert a duplicate value for a primary key. The problem is, the primary key consists of rows A and B. A different entry has the same A but different B. If I change A to be different too, inserting works. But that's not what I want: I want to be able to insert entries with the same A but different B or the other way around.

Any tips?
>>
>>60141863
But what if he is human?
>>
>>60141917
If what you describe is true, then I think your schema has not been implemented correctly on the database.
>>
>>60141890
My compiler is pretty efficient.
>>
>>60141925
What does that have to do with anything?
>>
>>60141934
Mine isn't
>>
File: français.png (32KB, 1000x700px) Image search: [Google]
français.png
32KB, 1000x700px
>>60141794
Consider the LP RÀB, it's the WTFPL in offensive French, it's like wiping your ass with silk.

                LICENCE PUBLIQUE RIEN À BRANLER
Version 1, Mars 2009

Copyright (C) 2009 Sam Hocevar
14 rue de Plaisance, 75014 Paris, France

La copie et la distribution de copies exactes de cette licence sont
autorisées, et toute modification est permise à condition de changer
le nom de la licence.

CONDITIONS DE COPIE, DISTRIBUTON ET MODIFICATION
DE LA LICENCE PUBLIQUE RIEN À BRANLER

0. Faites ce que vous voulez, j’en ai RIEN À BRANLER.
>>
But we should not listen to these temptations, because we can achieve much more if we stand together. We free software developers should support one another.
>>
Rust will never have HKTs, therefore Rust will never be useful.
>>
>>60141935
He wouldn't be able to use the GPL if that condition holds.
>>
>>60141949
Why not?
>>
>>60141126
OMG sauce please.
>>
>>60141940
Norsk > engelsk > fransk
>>
>>60141876
Neither works, somehow the image from the resource and the picturebox image are not the same and I do not know why.
Is there any other way I can change the images, such as creating a bool variable?
>>
>>60141956
It's Rust.
>>
>>60141936
>Rust Programmer (male)
No.
>>
>>60141944
Higher-order dependent types imply HKTs.
>>
>>60141962
Do you have LP RÀB, Harald ? I don't think so.
>>
>>60141943
We should have some sort of guild or union, with no shitlangs allowed.
>>
>>60141791
how do this for all $version tars present in the dir? how into $version?
>>
>>60141964
Give up programming and kill yourself.
>>
>>60141982
Last I checked Rust didn't have those either.
>>
>>60141944
No useful languages have HKTs
>>
>>60141953
That's not possible without contradicting the assumption that he is human.
>>
>>60142013
I use the GPL and I'm human.
>>
>>60142008
It will pretty soon, I'm adding them to it. I will be removing all loops though, so it won't really be the same language.
>>
>>60142019
Using the GPL implies being non-human, therefore you can't be human.
>>
>>60142022
>I will be removing all loops though
I forget, does Rust optimize tail calls?

Also can I see your work so far?
>>
>>60142031
>implies being non-human
That's where you are wrong
>>
>>60141818
I;m more comfortable in JS than Jawa

So React Native is my spice then?
>>
File: IMG_1013.jpg (79KB, 700x933px) Image search: [Google]
IMG_1013.jpg
79KB, 700x933px
>>60142031
Oh shit, ya got me.

But seriously. I'm not seeing what prevents a human from using the GPL. So expound or fuck off, mate.
>>
>>60141944
https://gist.github.com/freebroccolo/81f99ecd9923bf0845b4
>>
>>60142059
Nope.

Do HKTs properly, or admit that Rust is not a useful language and stop recommending its use.
>>
>>60142034
>does Rust optimize tail calls?
No, the compiler is a complete joke. But you wouldn't need TCO without any way to use recursion or looping.
>Also can I see your work so far?
As of right now most of the work is in my head and/or in my notebook.
>>
>>60142002
So is that a yes?
I tried it and it works somehow, except you sometimes have to click twice, because it is either set to true or false and you have to click twice to set it back to the original value.
Thanks.
>>
>>60142045
>Jawa
What the fuck is Jawa?
>>
>>60142076
>Do HKTs properly
It is done properly, or admit you have no idea what you are talking about.

Also see >>60142009
>>
>>60142036
Me being wrong while pointing out a simple truth would be impossible.
>>60142048
It's a basic law of logic.
>>
>>60142090
>pointing out a simple truth
That's what you think
>>
>>60142085
It's an inside joke for pajeets

they pronounce Java is jawa,

Try it. Get an indian man with an accent and ask him to pronounce 'video', and he will pronounce his 'v' with a 'w' ending up as wideo
>>
>>60142076
>Rust is not a useful language
You just contradicted yourself by accepting that it's a language.
>>60142086
>Also see
But that information is false.
>>
>>60142076
lol some autist actually did it, HKT for rust. But no one cares about HKTs.

Because HKTs are for brainlets
https://crates.io/crates/hkt
>>
>>60142081
>>does Rust optimize tail calls?
>No
And people are unironically recommending this garbage?

It's too late to change this sort of behavior/restriction now, the language has necessarily begun to ossify. Change it and someone will complain that it breaks their code. I can't believe TCO wasn't in there from the start. What a bunch of amateurs.
>>
File: 6f608ecb0714db0469729732833c6bb0.jpg (747KB, 788x1113px) Image search: [Google]
6f608ecb0714db0469729732833c6bb0.jpg
747KB, 788x1113px
I finally made something
https://youtu.be/rmdgSiVQkzs

A-Are you p-proud /g/?
>>
>>60142108
>But that information is false.
It's not. HKTs are useless abstractions
>>
>>60142108
>You just contradicted yourself by accepting that it's a language.
The unit language, consisting of a single term (), is a language, but it is not useful.

>>60142110
The sort of people who don't think HKTs are necessary are just like the Go programmers who don't think generics are necessary.

>>60142086
>It is done properly
No, it isn't. That is obvious from the code.
>>
File: 1489268801010.jpg (38KB, 250x250px) Image search: [Google]
1489268801010.jpg
38KB, 250x250px
>>60142120
Good job, anon.
>>
>>60142122
Found the aspiring Go user.
>>
>>60142045
It is still a highly controversial topic tbqh. Various corps pushing their own way of writing crossplatform things. Some people say that going native Java/Swift is the only true way. They might be right. Or they just have a ton of experience with native app development and don't want to learn React/Js. Some say that React Native is the shit. They also might be biased because they already know react ecosystem and can shit out an app bretty fast. And there are Xamarin C# fellas who say that MS investing a lot of dollars in Xamarin and C# is powerful and all. Oh, and there is codename one with java for ios. Mobile gamedevs are another group with Unity and other stuff

I don't know man, it heavily depends on your task. Try RN, see for yourself if it is suitable for your needs
>>
>>60141791
>>60141996
Something like this:

dir=mozilla-bins

pushd ~/Downloads
mkdir -pv "${dir}"

for file in firefox-*.tar.bz2; do
version="${version%.tar.bz2}"

tar -xvf "${file}" "${dir}/${version}"

for i in 16x16 32x32 48x48; do
# ...
cp -v "${dir}/${version}/browser/..." ...
# ...
done

# ...
done

popd
>>
>>60142142
The kind of people that think HKTs are necessary are the kind of people that lack the IQ enough to grasp what meta programming means
>>
>>60142120
neat
>>
>>60142164
Using these crossplatform tools does a disservice to your users. Look at electron and its drawing and performance problems.
>>
>>60142156
Found the jobless SHITKELL beta tester
>>
>>60142114
>And people are unironically recommending this garbage?
Yeah, I have seen at least a couple of non-joke recommendations.
>I can't believe TCO wasn't in there from the start.
That isn't surprising considering they didn't have HKTs right away.

>>60142122
>HKTs are useless abstractions
I will interpret this is a universal statement. In which case it's obviously and blatantly false.

>>60142142
Saying "x is useful" is the same as saying "x can be used". It's pretty obvious that every single language is useful.
"x is useful for doing y" isn't somehow the same as "x is useful".
>>
File: thanks!!.jpg (103KB, 600x600px) Image search: [Google]
thanks!!.jpg
103KB, 600x600px
>>60142149
>>60142175
>>
>>60142174
This can only be true if these two things are somehow mutually exclusive.
>>
>>60142182
HKT = Useless abstractions made for brainlets

Get over it
>>
How easy is it go from c# to java? Is it worth it? What is better what is worse, and should I do it?
>>
>>60142173
*
version="${file%.tar.bz2}"
>>
>>60141926
Turns out you're right. Dunno what caused it, exactly, but I dropped the table and added it again, and now it does work.
>>
>>60142182
>Saying "x is useful" is the same as saying "x can be used".
I bet you're the sort of fuckface that would defend a double-clawed hammer. You need to be able to evaluate your tools and decide whether they're fucking shitty or not.
>>
>>60142174
>b-but you can write macros!!!
Yes, and forgo the utility afforded by a good type system.

>b-but macros can be checked too!!!
No language in existence actually has this on a level anywhere near good enough.

>>60142191
What's the matter, did you fail your Haskell class?

>>60142194
They're the same language.
>>
>>60142213
I have evaluated HKTs and they are extremely useful to me. They're only not useful if you enjoy writing the same code over and over again.
>>
>>60142216
>Haskell class?
Try not to pretend you ever graduated your home "school"
>>
>>60142225
>I have evaluated HKTs and they are extremely useful to me.
Probably because you are a brainlet
>>
>>60142191
>x = useless
I have shown in the very post you're replying to that this is impossible.
>>60142213
>You need to be able to evaluate your tools and decide whether they're fucking shitty or not.
Exactly. Saying that "x is useful" or "x is useless" is literally worthless, since everything which can be used is by definition useful. You need to add another variable for that to have any value.
>>
>>60142216
>b-but you can write macros!!!
>b-but macros can be checked too!!!
Who said those?
>>
>>60142225
>I have evaluated HKTs and they are extremely useful to me.
I actually don't give a shit about HKTs. I was just attacking your weak justification as to why they're good.
>>
>>60142243
>Exactly. Saying that "x is useful" or "x is useless" is literally worthless, since everything which can be used is by definition useful. You need to add another variable for that to have any value.
Functional "programming" is useless though
>>
>>60142216
Macros are more useful than types.
>>
>>60142261
It seems like you didn't read my post. No matter what you substitute for x in "x is useful", it will be true as long as there is at least one way to use it, or in other words as long as it exists.
>>
>>60142228
Oh, was your CS program so shit that it didn't teach FP? I'm terribly sorry, but I wouldn't hire you. Ever.

>>60142252
There's at least two of us defending HKTs in this thread.

>>60142232
Have fun getting carpal tunnel from writing the same code over and over again because you don't see the utility of HKTs.

>>60142275
Nope.
>>
Can someone explain to me why Python developers have to be so fucking autistic.

BeautifulSoup, I wanna use CSS selectors.

.h1 > span:nth-child(1)


That's the CSS selector. Why the fuck can't I juse use that?

soup.select('h1')[0].get_text(strip=True)


This is what works but I still don't get why I have to take an already good CSS selector and then translate it into their nonsense.
>>
>>60142281
>Have fun getting carpal tunnel from writing the same code over and over again
Learn how to use macros and functions properly. Not that I would expect a brainlet to understand.
>>
>>60142281
>There's at least two of us defending HKTs in this thread.
Wrong. HKTs are merely a side effect of a good type system. I would never defend a deficient type system which has only HKTs.
>>
>>60142292
It's because nobody with critical reasoning faculties would ever willingly use Python.
>>
>>60142281
>I wouldn't hire you.
No one wants your non existent theoratical job that pays $0
>>
>>60142281
>There's at least two of us defending HKTs in this thread.
So there are two brainlets ITT. Do you also watch cartoons?
>>
>>60142295
HKTs are necessary, but not sufficient.
>>
>>60142315
>HKTs are necessary,
Wrong
>>
>>60142281
>Nope.
Wrong.
>>
>>60142294
Macros are the tools of morons who can't meet the incredibly low bar of writing code that typechecks.
>>
>>60142281
I wouldn't hire anyone with Haskell repos with recent commits on github. It almost always smells like autism and social ineptitude.
>>
>>60142301
Then why the fuck does everyone keep recommending it for a Interpreted language with a bunch of support and EVERYBODY is fucking developing on it.
Then why the fuck does it keep spreading like a cancer
Then why the fuck does it have 30 million versions with each developer preferring their own shit.
Then why the fuck do I have to get the most ABSOLUTELY up to date answers.
>>
>>60142216
>C# and Java the same
Do you want to know how I know you're a pajeet?
>>
>>60142315
Yeah, you could say so.
>>60142321
A good type system implies HKTs, therefore the statement "HTKs are necessary [for a good type system]" is true.
>>
>>60142328
HKTs are for hand holding "features" for newbies that haven't learned how to use macros properly
>>
>>60142339
>A good type system implies HKTs,
Wrong again
>>
>>60142343
>are for hand
are hand*
>>
>>60142334
baited for that exact response
>>
>>60142343
This is only true if you can prove that they are mutually exclusive. Which is clearly not the case.
>>60142352
Nope.
>>
>>60142321
Wrong.

I'm amazed by how little programming knowledge there is in /dpt/ sometimes.

>>60142334
Because we let any idiot with a pulse have a computer.

>>60142338
I'm someone who hasn't wasted their life on trivial languages with trivial differences between them.
>>
>>60142366
>I'm amazed by how little programming knowledge there is in /dpt/ sometimes.
Same. If a brainlet thinks HKTs are useful by any means it should give up right now.
>>
>>60142378
You not understanding a concept does not imply that it is not useful.
>>
>>60142364
>This is only true if you can prove that they are mutually exclusive. Which is clearly not the case.
Which actually IS the case. Only newbies want hand holding features like HKT
>>
>>60142391
>Understanding the concept
I understand the abstraction put in place to accommodate brainlets to program as they wish
>>
>>60142366
When you say trivial, it just shows that you haven't worked for any other companies other than startups. In reality people don't care what language you use as long as it gets the job done. The only people who care are other programmers.
>>
>>60142394
>hand holding
You seem to be laboring under the misapprehension that types are only for rejecting invalid programs. They're not.
>>
>>60142394
>Which actually IS the case.
You can add macros to any language which has HKTs, and vice versa. Which clearly shows that it is not the case that they are mutually exclusive.
>>60142405
Is function application "abstraction"?
>>
>>60142408
Then I trust you'll be happy writing everything in x86 assembly. Language doesn't matter, right? You can still get shit done in it! I'm sure you'll be just as productive in it!
>>
>>60142417
>They're not.
But they are, why don't you go and use python if you like those newbie friendly "features"?
>>
>>60142420
You can add HKTs to any language with macros, but not the other way around
>>
>>60142428
Spotted the lazy brainlet JS code artisan
>>
>>60142447
I don't see why that would be the case.
>>
>>60141940
where's the no warranty clause that frees me from any liability?
>>
Anyone can help out with database design? Say I have a user entity in my database and users can make transactions to other users. How should the transaction entity be laid out to ensure efficient look-ups?

The initial thought was to have two foreign keys to sender and receiver user entities in the transaction table, e.g.

 
TransactionTable:

id
SenderID
ReceiverID
money
date



but would this be alright? Cannot remember if the foreign keys will somehow fuck it up or not.
>>
>>60142516
Not programming related.
>>>/g/sqt/
>>
>>60142447
No you can't
>>
>>60139479
redpill = lambda x: ' '.join(['((' + str(word) + '))' for word in x.split(' ')])
>>
>>60142428
You retard. I obviously meant that language doesn't matter for the user, not the programmer. If you say that you will have the program ready in one week you can write in JS for all I care, but when the week is up, you better have the program ready. Higher ups won't care in what it's written in, they will care if you didn't make the deadline.
>>
New thread when? I'm too lazy.
>>
new thread
>>60142581
>>
>>60141962
The Scandifags are back!
Thread posts: 321
Thread images: 33


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.