/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

youtube.com/watch?v=BBbv1ej0fFo
paste.debian.net/895474/
github.com/blog/1986-announcing-git-large-file-storage-lfs
twitter.com/NSFWRedditVideo

Please use a (non-fag) anime image next time.

I don't suppose you'd be alright with posting your github for me to look at would you?

I have my first programming interview today. I'm studying everything, have no idea what I am doing and terrified.

Working on something that's taken 3-4 weeks when I could've gotten it done in 1 week if I had known the ideal design and not the fake BS of "Feel free to do what you want, I'll just add a tidbit ;)"

Had a similar experience--it WILL suck and you will freak out but you will learn a lot.

Just try to be as calm as possible and be confident. Assuming this is an internship interview, just chill and realize that by studying you are already ahead of the pack. Your interviewers should be forgiving and if they aren't you don't want to work there.

>implying le current year man blowing up the current year because he's been so thoroughly BTFO throughout the year with brexit and trump isn't funny af

I would, but it's tied to my identity and it's not good, to be honest.

ah no problem, I know exactly how you feel - well anyway I'm going to be but thanks for all your help

Reposting from previous thread. What should I do if I can't pick between C and C++?

Pick C.

What do you want to do? If you're not interested in high-performance, embedded systems programming, or working close to the machine level I would avoid C.

C++ has more applications and you'll be able to find more jobs with it as well.

It's ultimately depends on what you want to do.

also >learn both

C++

Otherwise master the language you already know. You should be able to pick up either fairly quick if needbe

Is this a confirmed post though?
>also >learn both
That's also a possibility. Which one should I start learning first?
I don't think I'm that interested in a programming job tb h but that might change.
I don't know anything but a little bit of C.

what do you do now? what are you interested in doing with programming if not getting a job?

I think python is a much better hobby language.

I love physical copies of books but goddamn why are they so fucking expensive. I understand that digital is better and free but physical really gets my dick hard. Is there anywhere selling classic good books for cheap?

I want to make an anime file sorter.

I do something not related to programming. Just for fun
>I think python is a much better hobby language.
In what way?

Just use python, it's way easier. You don't need to use C or C++ for shit like that.

Being able to abstract away garbage collection and other C/C++ difficulties is better if you just wanna do normal stuff.

Or just use whatever terminal language you have (bash if you're on *nix, batch on windows) if it's not complicated.

Oh, that post was a trole.

I like python because you can abstract away the parts of C++ and similar languages that prime those for performance. One of the people on the C++ standards committee once said (paraphrased) "we built this language for power grids etc."
Here's an interesting panel on systems programming languages you might be interested in for more information on these concepts: youtube.com/watch?v=BBbv1ej0fFo

Python is a scripting language with a large standard library, easy and natural syntax, and is really fun to use. The main drawback is that it's slow.

It's not unfortunately, but it's thankfully just focusing on regression testing and QA. I looked up my interviewers and every one of them is a PhD with a million publications and I am just some NEET who has made a few scripts.
If I can't answer the white boarding questions what should I do? Just walk through my thought process and hope they forgive me?

The experience I referenced was only a month ago. I have only one interview. There are people wiser than me on the internet who have discussed these issues at length. You should consider googling this or posting on /r/cscareerquestions or similar.

What I will say is this: keep in mind that you got through the resume screen so you must have something they are looking for. Be confident and don't be intimidated by their education.

But that's not an issue for me. I'm somewhat of a genius when it comes to learning things I'm interested in pretty fast.

Try a better OP next time.

that's kind of pretentious, to be quite honest.

learn what you want, ultimately. I just think that the intricacies of learning pointers, memory allocation and polymorphism will bore you if you're not interested in solving problems that need those concepts.

I'm only good with javascript but currently learning node, python, ruby, bootstrap, hoping to master mvc and build web apps.. I've been looking at coding bootcamps. anyone has any experience with them?

>pretentious
You just lost any degree of authority you had by using such meaningless words.
>learn what you want, ultimately.
That's obvious, but I wanted to ask about choosing C or C++
>I just think that the intricacies of learning pointers, memory allocation and polymorphism will bore you
I don't think that will happen since this is something I'm interested in.

I mean I explained to you which was a better choice for different stuff.

Why come on here if you're going to act like an asshole? If you're so goddamn smart just learn both anyways.

Why come on here if you're going to be so sensitive?
I didn't say I was smart. I just said I learn stuff pretty fast if I care about it, which is true and not "pretentious" as you put it.
>just learn both anyways.
Which one should someone learn first if that's what they are planning to do in your opinion?

learn C because it's the foundation of all modern computing

Wtf does "Write a program in java using a text stream from standard input..."

text stream from standard input??

Probably using the standard text stream interface (whatever that is in Java) using the stdio rather than a file or whatever.

so in python if I had
def a():
a = "b"
def c():
print (a)

c()

would that output "b"?

Yeah so wrote a base64 encoder/decoder just for the hell of it. (Posted it before, but there was a small bug).

paste.debian.net/895474/

>would that output "b"?
No, because you have a syntax error.

isn't that gonna throw an exception because of improper indentation?

ok let me rephrase, assuming I fixed it to have correct indentation and no syntax errors would it work?

>how do i google

well run it.
I did and it didn't work.

but can standard input just be like input from the console using Scanner?

>correct indentation
A Python program is meaningless without indentation.
It's literally the same as posting some C-like code without curly brackets.

There are many ways you can indent your code to create different "correct" programs.

Assuming you indent
def a():
a = 'b'

def c():
print(a)

it will print ""
because thats how it is within the scope of c

if you code c as an embedded function
def a():
a = 'b'
def c():
print(a)


then it will print 'b' as c is embedded in a and thus has access to its scope.

Try this
def a():
global a
a = "b"

def c():
print(a)

c()
a()
c()

What's a book on python3 for experienced programmers?

r8

That looks like Kode with Karlie

probably. Sup Forums couldn't write that much code.

Why not ORM?

Any interesting project ideas?

I feel like my other more mathy courses are taking too much of my programming time away. Maybe I'm just shitty at managing my time. Anyone have experience with that?

10 years from now you'll realize the mathy courses were the only ones with value

Try to enter the following gratitude:
'); DROP TABLE daily_gratitude;
The first character might have to be " instead of '.

>he fell for the ORM meme.

Why not fall for it?
We have a meme president now.
Plus, you know that in a few years you're gonna have a full uni course dedicated to memes.

is there an easier way of doing this

def goagain():
yesno = input('Want to go again? y/n ')
if yesno == 'y':
letsgo()
elif yesno != 'n':
print('Don\'t be a smartass.')
goagain()

def letsgo():
words = input('What do you wanna type? ')
words = str(words)
result = ''
for x in words:
if x.isalpha() == True or x.isnumeric() == True or x == '+' or x == '-' or x == '!' or x == '?' or x == ' ':
result += ':'
if x.isalpha() == True:
result += 'regional_indicator_'
result += x
elif x == '!' or x == '?' or x == '+' or x == '-':
if x == '!':
result += 'exclamation'
elif x == '?':
result += 'question'
elif x == '+':
result += 'heavy_plus_sign'
else:
result += 'heavy_minus_sign'
elif x.isnumeric() == True:
if x == '1':
result += 'one'
elif x == '2':
result += 'two'
elif x == '3':
result += 'three'
elif x == '4':
result += 'four'
elif x == '5':
result += 'five'
elif x == '6':
result += 'six'
elif x == '7':
result += 'seven'
elif x == '8':
result += 'eight'
elif x == '9':
result += 'nine'
else:
result += 'zero'
elif x == ' ':
result += 'black_large_square'
if x.isalpha() == True or x.isnumeric() == True or x == '+' or x == '-' or x == '!' or x == '?' or x == ' ':
result += ': '
if len(result) >=2000:
print('That\'s too long.')
else:
print(result)
goagain()

letsgo()

>Plus, you know that in a few years you're gonna have a full uni course dedicated to memes.
So social "sciences" don't exist in your timeline yet? Interesting

I was talking about CS-related degrees

>== True

>he fell for the falling for the meme meme

whats wrong with == True

What would be the best way to store a large amount of strings to be retrieved at any point? Could I just use a text file with some sort of numbering for retrieval?

Guess what the values of these expressions are.
True == True
False == True

what about if the value is 1? that's not equal to True.

help

you fell for the data science meme? LOLZ.

pivot tables wew

it looked good on the surface of it, now im rushing to meet a deadline on a fucking spreadsheet report because i couldnt be fucked to attend labs

>prolog
>2016
kek

prolog is comfy tho

You know what else is comfy, babe?

Does anyone know if github has a policy regarding uploading of binary files to a repository?
Also, is that generally viewed as bad practice, when working with version control?

go on, fgt

no, it's painful to program with.

github.com/blog/1986-announcing-git-large-file-storage-lfs
and yes it is

how so? i find being able to backtrack to find alternative means of doing things incredibly useful for certain tasks, and desu i should probably spend some time trying to figure out how to use it for non-AI programs.

>Is this a confirmed post though?
Not really sure what this means, but coming from another user who picked up C -> C++ -> Java: go with C first. It teaches you the fundamentals that you should be familiar with, so you know how the higher-level abstractions from other languages work.

It's not even good for cutting edge AI. Logic-based AI is cool and all but it's a dead meme desu, all about stats these days

>Also, is that generally viewed as bad practice, when working with version control?
Of course it is - a human readable binary diff is worth fuckall, because the binary code isn't a useful representation. Binary diffs are useful for deploying as patches, not for maintaining as a versioned changelog.

eh, AI sounded interesting, so i enrolled for the module on it, and prolog is what we were taught

so i have this:
#include
using namespace std;
int main() {
string input;
cin >> input;
cout

Thanks. What's the best C guide for beginners? And does this thread not have a FAQ type of page for different languages?

no operator ">>" matches these operands

C++ iostreams were a fucking mistake.

Actually it is.

The truth is right here.

Use getline, maybe.

std::cin interprets a space as a seperator. Try using std::getline to get it until the return. Also, don't put
using namespace std;

why not?

Only std::cin and spaces. std::cout, std::stringstream and file streams are all very useful

No, they're just as shit.
iostreams are the prime example for why operator overloading is just a fucking bad idea.

Please explain.

Not sure what I'm doing wrong.
First time trying to use timeit

A Tinderbot that autoswipes every girl and messages them from a pool of witty pickup lines if they're a match.

Automating my life, yo

I like it.

post source

Nice job user.
Also, /thread/

>/thread/
What?

The thread should now be about user's scripts.
Post your scripts anons !

this python script downloads all pictures from headp.at

Thanks user

Tuples + Inline functions + LINQ = my loins moistened

Chan.GetBoard().Boards
.Select(x => x.BoardName)
.Select(x =>
{
(string board, int postNumber) latestPost() =>
(x, Chan.GetThreadPage(x, 1).Threads.First(y => !y.Posts.First().IsStickied).Posts.First().PostNumber);

return latestPost();
})
.OrderByDescending(x => x.postNumber)
.Select(x => $"{x.board.PadRight(5)}: {x.postNumber}")
.ForEach(WriteLine);