/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

tutorialspoint.com/java/util/hashmap_put.htm
nongnu.askapache.com/pgubook/ProgrammingGroundUp-1-0-booksize.pdf
en.wikipedia.org/wiki/List_of_language_bindings_for_Qt_5
cplusplus.com/reference/algorithm/reverse/
github.com/rust-lang/rust/blob/master/src/librustc_typeck/collect.rs
youtu.be/5W7NkofUtAw?t=1783
twitter.com/AnonBabble

I did my first haskell !

nice

a dynamic website that shows you how many USD and a few other currencies the BTC you have is worth. It'll show the USD price on a few markets and also EUR, ethereum, monero and whatnot using API's

M A K E A P I
desu

Actually a conversion API isn't a bad idea. One that encapsulated all forms of conversions

Which one is better, ordinary object literal or module pattern?

// ordinary object literal. full of "this"
const fn = {
start: function() {
console.log("start");
},
init: function() {
this.start();
}
};
fn.init();


// ultra-private vars + methods
const fn = (function () {
function start() {
console.log("start");
}

return {
init: start
};
})();

fn.init();

is this what idiomatic JS looks like?

module

not enough
});
});
});
});
});
});

lmao, is this ur first time koding?

for (int i = 0; i < 6; ++i)
});

nigger

var t = new var[] {"nigger"};
console.log("You're all a bunch of fucking weebs.");

wow edgy

What's the best way to initialize a Map in Java?

char[] r = new char[] {'b', 'i', 'n', 'g', 'o'};

for (int j = 0; j < r.length; j++) {
System.out.print(r[j]);
}

HashMaps or what?
HashMap hashmap = new HashMap();

what language is this? it doesnt look like english

Or treemaps, it doesn't matter. And I'm not just talking about instantiating it, I mean filling it with values. There doesn't seem to be any elegant way.

You said
>how to initializing in gustavo
i respondo
if u seek to place value use gergle pls and okay
tutorialspoint.com/java/util/hashmap_put.htm

Use a roop my flen:
int key;
String value;

for (lengthofmydick) {
myChodeMap.put(bingo, bango); //bongo
}

like he said, just use gustavo

bump

I am currenctly making a SEO (search engine optimizing) bot. This means that it will create blogs, social bookmarks, accounts, etcetera.

I want the program to do multiple of these things at the same time. Currently I have to select what is does by a input menu (1. Forum posting 2. Account creation, etcetera.). I want to be able to select more options that would all run at the same time.

The tasks all contain different functions and classes and do not need to interconnect with one another.

- Threading - but there seems to be many problems with the GIL if you run to many tasks.

- Multiprocessing - this might work if the process would only do the task it gets. This is however resource expensive.

- Eventlet or gevent - this looks very interesting but I am not sure if it can do the tasks I described. But I am uncertain how it will handle multiple files (otherwise 1 greenlet for each task would be perfect).

I have googled this question but most of the answers are from 2010/2013 and lots has changed in the meantime.

What is the best way to get this done?

Why aren't you helping make vichan better?

What will we do if hiro buttfucks us and we have only a crappy software to use for new image board?

I am using Python btw, for some reason I forgot to mention the most important thing.

What's the fastest (not necessarily easiest) practical way to learn low level programming for purely educational reasons? I just want a proper mental picture of how software works.

I found nongnu.askapache.com/pgubook/ProgrammingGroundUp-1-0-booksize.pdf on hackernews, but hackernews is full of retards so I'm skeptical. I've also heard of some games that supposedly teach it like TIS-100 but even more skeptical there

Diving into C++ because of Qt

QT has bindings to other languages

Tell me more.

en.wikipedia.org/wiki/List_of_language_bindings_for_Qt_5

I say it's to break down whatever program you have into low level detail.
It may be very difficult to do in some languages like python because of how many layers you have to the machine code. A language like C makes it easy though.
But I don't know what detail you care about. If you disasm a C program you have a decent idea of what's gonna actually happen. But you still won't know platform specific details like how the CPU will prefetch data, utilize caches and predict branches. I assume you have some practical goal with learning. Perhaps it's not all that specific but you should have some clue. There's more fun things to learn if it was purely to learn for entertainment.
>hackernews full of retards
user you're better off going there than here a lot of the time. But for this topic I think I agree.

>No C binding

Move on, user.

How do I get good at C++? What resources are the best to learn?

start with c

Learn Java and learn C first.

Bjarne, Meyers, Sutter, Alexandrescu
read erryday
hackerrank, codewars, topcoder, leetcode, codeforces etc
solve erryday

write a real project everyday

and you're GOLDEN my lad

>Intellisense BTFO

Tell me about this.
auto add(auto x, auto y);
Are the auto parameters deduced later based on how it is called, or is it a function template in disguise?

If I read() off a socket does the next read() start at the beginning or where the last ended

Template

Neat, I should use that more often.

Nice, thank you. Is basic knowledge of C necessary?
Can I expect to know advanced C++ in a year or so?

>Andrei is the final level boss
And then you meet D

>Is basic knowledge of C necessary?
You'll write seriously shit C++ otherwise.
>Can I expect to know advanced C++ in a year or so?
If you keep up you'll be able to write good C++ in that time, but it's a very big language with lots of weird obscure shit.

>and you're GOLDEN my lad

yeah it only takes years if not decades

>You'll write seriously shit C++ otherwise.
hmm, straustrup says the exact opposite thing. whom should user trust?

>it only takes years if not decades
To know the entirety of C++ yeah

do not take advices from g. this guy could've ruined your foundation.

Where to take advice from then?

stroustrup is a faggot. C++'s features are not magic, you'll only truly understand them and their pitfalls unless you know the C primitives they are built out of.

>boost

There's nothing wrong with this code.

>the entirety
half of the*

std::beta you mean

I'm making a very minimal personal website as a React app. Kind of overengineering it, I know, but I don't care that much; I expect to add more dynamic functionality to it in the future, and it has very little content so rewriting the whole thing from scratch is not a problem, if it has to come to that.

Have any of you used PostCSS or CSS Grid? I want to get started on those and use them in my website.

what are the best websites or free online courses to learn php and sql?

Don't bother, just jump in. You'll learn more from hacking together garbage than you will from any course. By the end of it you'll hate PHP.

So past year I have fucked around my programming educational and today thought to take it serious.
Only used Google for oracle docs on Scanner.

Simply shit took me a few hours...
I welcome feedback


/*
* Purpose: Reverse users (Str)input and output the reversed string
* Arthor: Perseus
* Version: 0.1
*/

import java.util.Scanner;

class ReverseString
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);

//User input (Str)
String userString = in.next();
System.out.println("Output: " + userString);

//Reverse input
char[] reverseUserString = userString.toCharArray();
for (int i = reverseUserString.length-1; i >= 0; i--)
{
System.out.print(reverseUserString[i]);
}
}
}

Working on yet another 2D game engine this time in C and Scheme fo make it more interesting, performance sensitive bits in C rest in scheme and all that in linux in w10 using xming...

Java's IO libraries are shit I don't blame you.

whats it like to have a job, /dpt/?

thx, I'll do it. just out of curiosity, why am I going to hate php in the end?

>I assume you have some practical goal with learning.
Basically, I want to be able to program properly instead of being a goon that writes inefficient bullshit.

PHP makes it very easy to start writing toy scripts but difficult to write anything large and robust.

It's nice to get paid

What could be the equivalent to myString.reverse() in C++? Or do you have to write a paragraph for simple shit liike this?

>PSD
Well it's designed to promote adobe software. Of course it's inconvenient.

Boy, Ruby is fun..

def car(a) a[0] end
def cdr(a) a[1..-1] end
def cons(a, b) [*b].unshift(a) end


car (cdr (cons 1, (cons 3, 4)))

You can get reverse iterators .rbegin() and .rend(). If you want to build a new string, just pass those to the constructor.

>PHP makes it very easy to start writing toy scripts but difficult to write anything large and robust.
There's nothing in PHP making it hard to write big projects if your code doesn't use something from php4. The problem is that most PHP developers are fucking shit.
I have worked on 2 different project and both of them had over 100k lines.

teach me your secrets of how to gain meaningful employment, user

>myString.reverse()
This could be any number of languages with any number of implications.
Does this reverse the string in place? Is the .reverse() a generic function to reverse things with an inherent order? What's the semantics here?
cplusplus.com/reference/algorithm/reverse/
Here's what you're looking for, probably. It's inplace reversing a range.

What said, it's supposed to be convoluted and inconsistent so only Adobe will be able to fully support it without issues.

Forgot to add:
This isn't in defense of C++, you're just very bad at asking.
Sepples delenda est

Something similar to
use std::io;

fn main() {

let mut x = String::new();
io::stdin().read_line(&mut x);

println!("{}", x.chars().rev().collect::());

}

>.collect::
the fuck is this

Collect a range into string

Break down the syntax for me, what's the :: doing next to ?

I am not the best guy to teach that, eh
>be me
>study cs/softdev in uni
>suddenly a wild ceo appears
>"hey kids, wanna code and get money"
>ok.svg
>work

From what I hear though, it's important to send your shit to employers regularly. Don't get intimidated by "we want a guy with 100+ years of experience in literally every language possible", of course they want that. They also need to get shit done, so.

Industry wage slave here, fuck "design patterns". So many idiots blindly follow them; group think is rampant in this industry

collect() can take anything iterable, and turn it into a relevant collection. This is one of the more powerful methods in the standard library, used in a variety of contexts.

The most basic pattern in which collect() is used is to turn one collection into another. You take a collection, call iter on it, do a bunch of transformations, and then collect() at the end.

collect will infer the type iff you have specified the type in the rvalue.

let x: String = .....collect(); // works
let x = .....collect::(); //works by itself without type inference

The :: grants access to a ``namespace ``

How does one make the jump from codemonkey to /ascended/ programmer

I kinda agree
One can't land a job in your usual webdev shop without knowing mvvm/mvc though

I assumed everything else already. What I don't understand is this.
>collect::
>The :: grants access to a ``namespace ``
So is a member of collect's namespace?

Collect module
github.com/rust-lang/rust/blob/master/src/librustc_typeck/collect.rs

This:
Any one interested?

youtu.be/5W7NkofUtAw?t=1783
>watch talk about webassembly
>a guy in charge of googles webassembly pushing says cpython is fast
Heresy must be purged. (also he's wrong)

Change your background image, dude

>red aletr
>aletr

When I hear seo it makes me wanna vomit

>The power of C++
#include
#include

int main ()
{
std::string str ("now step live...");
for (std::string::reverse_iterator rit=str.rbegin(); rit!=str.rend(); ++rit)
std::cout

Whats the difference between that and some Anime background/program?

>++rit
>preincrement in the iteration expression
Why. It's adding additional concerns.

>uses let in rust
>does not use auto in c++
Such a fair comparison

>cplusplus reference out of date

for (auto rit = str.rbegin(); rit != str.rend(); ++rit)

Is there any way to draw simple shapes on screen with Autohotkey? I tried using GDIP, but I can't seem to get it to work (then again I am pretty new to AHK).

C++ got UFCS? When?

What does UFCS have to do with this?