/dpt/ - Daily Programming Thread - Terry Davis edition

What are you working on, Jow Forums?

Previous thread:

Attached: 1525985319124.png (480x640, 535K)

Other urls found in this thread:

tutorialspoint.com/python/python_environment.htm
blog.rekawek.eu/2017/02/09/coffee-gb/
codetriage.com/
up-for-grabs.net/
firsttimersonly.com/
openhatch.org/
codemontage.com/
bountysource.com/
bountify.co/
issuehub.io/
pullrequestroulette.com/
twitter.com/NSFWRedditVideo

first for rust
and this sexy beast

Attached: file.png (400x400, 282K)

I'm trying to learn how to program as a complete beginner as of yesterday and struggling.

I downloaded Python for Windows 7 and am running in to all sorts of issues with trying to start a project. (Some web scraper tutorial project) just so I can learn by doing, etc.

Anyway, I have Anaconda too but I'm struggling.

1. How do I know if something installed correctly? (a dependency or whatever)
2. What are the differences between the Python I downloaded, and Anaconda? Why do people give conflicting advice on how to begin?
3. I Installed Python in C: Python36 but seem to still be having issues with installing shit like for example pip didn't install but I managed to fix that now
4. Is there a way I can, like, generally test that the install is working and everything is working how it should before I begin trying to do anything else or starting to try and learn or begin a project?

Basically troubleshooting shit pissing me off. And this is only the beginning I'm guessing, ffs.

And how do I know when I'm supposed to use CMD, Idle, or the Python shell thing which looks like CMD?

I might be retarded

Should I unironically start making up SJW shit for myself to get more interviews, or does that only work for Silicon Valley type gigs?

I'm an engineer btw, not a programmer, but I can work software eng. jobs too (CompE)

Just use PyCharm. Easy to use IDE which takes care of dependencies for you with a few simple mouse clicks. No build chains either. Just click a big green (BUILD) button to run your code. Really beginner friendly.

>running turtle on windows

Attached: 1526839281120.gif (400x400, 1.71M)

I don't know what that means
Give some good advice or fuck off

wrong

it looks a complete mess when they're not on their own line.

when they are you can clearly see what code belongs to what function and thus easily read the code... easilier

Why is python called a "turtle" when most interpreted languages are slower?

While learning by doing is a valid methodology, you should at least do SOME fucking reading before starting, and some more along the way. Any beginner book or website on python will tell you how to install python and verify it is working, and they usually touch on pip as well.

Honestly I like JavaScript, I like how it looks and I like the freedom it lets me have
What's a language like JavaScript but better for backend work? Java is too verbose, C++ Is hideous, Rust is almost the same as C++ from what I've played with

trying to get a crash course on ember.js before my new job starts :S

I wouldn't recommend starting with python. Start with something more simple like C instead

>each sentence on separate line
opinion discarded

Attached: 1234.jpg (680x622, 68K)

I know c minimally, syntax, linked list, trees, what have you.

I want to help a open source project but I don't know how to.
As in I don't even know how to tackle a bug on a program who's source I hardly know.
I would understand the syntax but couldn't tell you anything else.

Any help is appreciated.

2 months into web programming(actually working, already done with 5 projects)
I want to kill myself

wrong

it looks a complete mess when they're in their one line

>readability is bad

get out already.

in what possible sense?

C#?

Yeah, I followed a book but it didn't. Then I looked for advice and the only advice I got is "Use Anaconda instead," then..PyCharm, then Panda. Then ">Windows"
ThenDo any of you fuckers give useful advice?

Yes, when your question is something more worthy than "dude how do i install python". Even stackoverflow would laugh your ass out for that shit.

my advice - please leave this garbage lingo alone. it's really bad.

There are other interpreted PLs? lol
I've heard of JS but it is much faster than pyladies

Attached: 1527079290996.png (849x1200, 1.2M)

This plus the async/await doesn't fuck your ass with endless nesting levels to keep up with promises

>tutorialspoint.com/python/python_environment.htm
For your credit, two tutorials with most hits on google, including Python's official tutorial, don't go over installing it at all.

JS is JIT-compiled on most modern browsers. And Ruby is definitely slower.

I didn't ask how for that. I said I had issues and am troubleshooting. Couldn't find an answer online specific enough, the book/s I'm using didn't help, and since I don't know enough because, you know, I'm a beginner, it's obviously frustrating. And you know it's quite difficult navigating through all of the conflicting advice as a beginner because people are too busy wanting to show off how clever they are by saying how much of a pleb you are for using Windows, or simply not knowing
Also suck my dick faggot

What am I some fucking soccer mom?
You honestly think I didn't read that and more? None of them answer my question/s

DO NOT start with python. python is too easy. Python will give you the wrong impression of programming and teach you habits that will ruin the rest of your career as a programmer.

I wonder if there will ever be a better language than Java masterrace.

Okay I can appreciate that. What would you recommend? I would rather it take more time to learn in the beginning if it is beneficial later

I'll look into it

There already is, it's called Go.

Java/C/C++.
There's just no other way. these 3 are the staples, pick one and get confortable

Ruby is for girls. Also, MS made a JIT for Python based on .net core clr so it should be faster than JS

I'm making an Android app and server to coordinate data collecting for biological research. Basically, a map tells you to go somewhere and take pics of snails. It's lit.

>implying java and C++ won't give you wrong impressions and bad programming habits.

C is the One True Language, but it's not suitable for the youth of today that's accustomed to instant gratification, since you need a significant amount of work to do anything but the simplest of applications.

>since you need a significant amount of work to do anything but the simplest of applications.
>what are libraries

Attached: 1510089672618.png (867x436, 116K)

They'll give you the right impressions of """enterprise""" programming.

>let me look up a library for what I want to do
>I guess I should google it?
>which of these ones do I pick
>okay I got this one, where's the tutorial on how to use it?
>w-what do you mean just read the function definitions and figure it from there?
>what's a context? where do I get it?
>oh my god why is this shit not working, I can't find any help online
>you know what? fuck it
>pip install dostuff

>Calculator
>OCaml
type op = Number of int
| Sum of op * op
| Sub of op * op
| Mult of op * op
| Div of op * op
;;

let rec calculator op =
match op with
| Number(n) -> n
| Sum(s1, s2) -> (calculator s1) + (calculator s2)
| Sub(s1, s2) -> (calculator s1) - (calculator s2)
| Mult(m1, m2) -> (calculator m1) * (calculator m2)
| Div(d1, d2) -> (calculator d1) / (calculator d2)
;;

>Draw a square
>Python
def square_print(x, y): #Apparently, squares have independent width and height now
for i in range(0, x):
for j in range(0, y):
print("*")
print("\n")
print("\n")

Alright I'll expand a little more on why you shouldn't start with python.
Python is way too easy for a beginner's good. Anything that you'll have to struggle with in some other language is already handled for you at the python standard library and all you have to do is write

>how much of a pleb you are for using Windows
How's that working out for you? Everyone starts somewhere. Some people get help from school/mentors. Others teach themselves.

>Read bytes, perform some bitops, save them
>C
#include

void shifter(unsigned char *ptr, int length) {
int i;
for(i = 1; i < length; ++i) {
unsigned char prev_byte = *(ptr + i - 1);
prev_byte

>am youth of today
>know C
thanks for making me feel special

>>w-what do you mean just read the function definitions and figure it from there?
What? Every sane library has some sort of documentation, be it in the code (in header files next to declarations, not definitions) or provided separately.

>implying

int main(argc int, argv **char) {
if(argc != 3) {
printf("Usage: ./%s \n", argv[0]);
return 1;
}

unsigned char bytes[argc];
FILE *r_fp, *w_fp;

r_fp = fpen(argv[1], "rb");

feek(r_fp, 0, SEEK_END);
size_t length = ftell(r_fp);
feek(r_fp, 0, SEEK_SET);

fead(bytes, 1, length, r_fp);
flose(fp);

shifter(bytes, length);

w_fp = fpen(argv[2], "wb");
frite(bytes, 1, length, w_fp);
flose(w_fp);

return 0;
}

Apparently, Jow Forums refuses to let you post code with fopen/fclose/fwrite/fread/fseek? I kept getting a connection error when I tried to post this function specifically.

Anyway, the last one:
>Calculate the triangular sum
>Java
---- TriangularNumberProducer.java ----
/**
* @author - Dominic Petroff
* @date - 23rd of May, 2018
*
* Calculates triangular numbers.
* Considers that the triangular number sequence starts at 1.
*/
public interface TriangularNumberProducer {
/**
* Calculates the nth triangular number.
*
* @return The nth triangular number.
*/
public abstract int triangular_number(int n);
}

---- TriangularNumberProducerWithCache.java ----
/**
* @author - Dominic Petroff
* @date - 23rd of May, 2018
*
* Calculates triangular numbers.
* Implementing classes should cache computed values for performance.
*/
public interface TriangularNumberProducerWithCache extends TriangularNumberProducer {
/**
* Flushes the cache.
*/
public abstract void flush();
}

---- TriangularNumberProducerWithCacheImpl.java ----
import java.util.Map;
import java.util.HashMap;

/**
* @author - Dominic Petroff
* @date - 23rd of May, 2018
*/
public class TriangularNumberProducerWithCacheImpl implements TriangularNumberProducerWithCache {
private Map cache;

public TriangularNumberProducerWithCacheImpl () {
this.cache = new HashMap();
}

@Override
public int triangular_number(final int n) {
Integer possible_result = cache.get(n);
if(possible_result != null) {
return possible_result;
}

return n * (n + 1) / 2;
}

@Override
public void flush() {
this.cache = new HashMap();
}
}


What does my code say about me?

Just dual boot Linux or use VM and install development-tools
If you get into programming you'll do this sooner or later, might as well do it at the start

>mom hacked Jow Forums using fopen

cancer

#define flose fclose
#define fead fread
#define fpen fopen
#define frite fwrite
#define feek fseek

Those are valid php functions

} else {

is comfy, it's like else is getting a hug!

unreadable garbage especially when there's layers and layers of it. I'll never understand muh LOC autism

Programming should be cold and harsh, not warm and "comfy".

Attached: __hong_meiling_and_izayoi_sakuya_touhou_drawn_by_piyokichi__30ae4b4baa8a1c5ba20d8469bdd7ee1b.jpg (748x800, 471K)

}else{

Attached: elsehug.jpg (1024x768, 202K)

the alternative is degenerate pajeet shit:
}
else{

*vomiting noises*

if (cond) {
// things here...
} else {
// more things here...
}

Objectively the most readable

the only way:
}
else
{
...
}

literally nothing wrong with that, it's the only way to be consistent

What's a good book to learn about operating system development?

go poo in the street pajeet

/dpt/-chan, daisuki~

>What are you working on, Jow Forums?
reading this
blog.rekawek.eu/2017/02/09/coffee-gb/


kotlin?

codetriage.com/
up-for-grabs.net/
firsttimersonly.com/
openhatch.org/
codemontage.com/
bountysource.com/
bountify.co/
issuehub.io/
pullrequestroulette.com/

dart

please use the webm version, this is the technology board so we inspect you to at least use the said technology.

not everyone in the valley is sjw. Palantir Technologies, for example.

>What are you working on, Jow Forums?
please use an anime image next time.

Attached: shoehead.webm (1280x720, 1.23M)

comfy

this is fine...

poo

This man knows.

I disagree. Thats like saying driving a car is too easy, it will give you wrong idea and you'll forget how to walk total bs. Hes not going to learn to program in a day and the best thing to start with is whatever allows you to great useful interesting programs as easy and quick as possible. Learning "include stdio.h" pointers argv memory management. These are not essential to understand basic ideas of programming and only get in the way of the real points for a beginner.

You should not need if/else in 2018. If your system is properly designed, all conditionals can be transformed into dynamic method calls through inheritance.

>inheritance

Attached: 1525620295458.jpg (447x363, 54K)

>dynamic method calls through inheritance.
lol doesnt even know about monads map filter and pattern matching. Thats really what makes if pointless

>lol doesnt even know about monads map filter and pattern matching. Thats really what makes if pointless
Monads, map and filter are leaky abstractions. They expose implementation details. A map is no better than a for loop.

Inheritance, interfaces, objects, etc... These are the real winners in the programming world.

pattern matching is just conditionals in disguise

>A map is no better than a for loop.
except one's infinitely more flexible.

let's not confuse a concept with its implementations, please.

I've heard Terry say that TempleOS is made for learning purposes of Operating Systems and systems programming. Does he have really good documentation or something? Has anyone actually played with it? Would it be worthwhile for me to check it out if I haven't gone through a "proper" OS course/book?

If you were a teacher how would you teach programming classes differently from how most colleges teach them as highly language focus java mills?

Attached: Edhappy.png (621x480, 270K)

small classes
systems with --betterC
high level with idris
class project is implementing your own eso lang, and writing an interpreter for it in idris.

Hey guys, I'm a SQL noob and I'm wondering if someone could give me
some help with the folowing problem:
So I have two tables "Schools" and "Teachers".
the "search_key" column of the "Schools" table is one big string that
combines teachers name and other elements (example: "ENGLISH | JANE | [90, 56])
So what I'm trying to do is match the string from the column "name"
of the "teachers" table with that previous one, getting the cells that have a match.


This is what Ive been trying to do, substring and try and match, but no luck so far.
Any ideas?

Attached: Sem Título.png (475x94, 3K)

Not uppercase keywords. DIsgusting.

>learning common lisp
> ' and ` are syntax and mean different things
Are you fucking kidding me.

you can do without them, they are just syntactic sugar

focus on types, type classes, and small composable functions using haskell. Then gradually build up to higher level abstractions by making students implement common patterns very specific to the problem and over time make them more and more generic to apply to more situations

>java
They just teach the wrong ones.

Attached: 4547457754.png (1033x276, 23K)

like I said, kinda noob
no help?

First use uppercase keywords.

I have a file with data lines in it. it has a pattern of
`timestamp:id>expr`
And I'd like to sort of keep track of the things that happen per id.
I can currently loop over the data, but I don't know how to best write it a robust way.

the first expression on a specific id is #start, then there's two different scopes that have similar sub-scopes. But I don't know how to make it less "loopy over the lines"

Makes it easier to read, I agree

Attached: ff.png (466x92, 4K)

What do you mean by keep track of? Is this for large program or do you want small script?

It's a small script and i need the data to create a graph and then exit.

Why nobody doing this?
}else
{

This is the most intuitive style, since it mimics the while part of a do while loop

easier to discern scope quickly if everything is on separate line.

Oh I would probably use python extract the fields using a regex and then create graph with some library shouldnt be too hard unless you mean graph data structure which mind be little bit more difficult

Well, that's pretty much what i do. I think i just overcomplicated things because i'm doing this in rust. Barely written anything in that.

I'll probably get totally shit on for this for the pajeet that I am, but is it REALLY worth it to work through and learn data structures like linked lists, binary trees, hash tables, etc? I learned Big-O today and that actually felt very helpful and useful.