/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

github.com/microsounds
gwan.ch/blog/20160405.html
geeksforgeeks.org/amazon-interview-experience-set-137-assessment-test-sde/
twitter.com/NSFWRedditGif

First for D

Friendly reminder that a purely functional programming language by definition cannot touch stdin/stdout.

Whats the easiest way to make an infinite print in python that will never stop even if someone does ctrl break/ctrl c? I remember my prof showing us once and the only way to stop it was thru task manager. Anyone know it? Just curious thats all.

./forever.py &

please respond

Everything clicked for me around the 5 month mark.
I'm self-taught.

x86 can't run proper functional code anyways because the instruction pointer keeps being mutated

void Printer (int x){
int turns = 1;
string spacing1 = "";
for(int i=x/2;i>0;i--){
spacing1 ="";
string spacing2 ="";
string line = "";
for (int z = 1; z

Ask someone (me) finishing a coding bootcamp anything

Hey Sup Forums, what should I do after I feel as though I am proficient in the current language that I am in (Java)? Should I branch off to other languages or should I master that language before I start trying to learn other languages?

How does it feel knowing that you paid thousands of dollars to learn something you could have learned for free?

The same applies to CS graduates, but at least they get a little piece of paper so that employers don't trash your resume on contact.

What do you get?
Fucking nothing.

based

EE major. Only taken 3 courses. Everything has always clicked for me, thank god too because I dont think I wouldve been able to learn programming at all if it wasnt in a formal setting. Just the discipline needed to put it in the hours needed seems haunting if you arent in a class sometimes.

Eh, got me a job and forced me to work with others. Would have probably taken me twice as long to learn on my own so it'll pay for itself in wages once I start.

How was the job placement conducted?
Were you promised a job if you paid them money?
This sounds like a racket.

They have a hiring network. I went in knowing I'd be top of the class and therefore was guaranteed a junior position at one of the best employers in the metro area, or they'd pay me back my tuition.

It's a racket if you're not up to the task of gaining competency in a few months. I feel very bad for my classmates who have no aptitude and are going to get hired anyway to do jobs that they will not enjoy.

haskell or scheme. SICP uses scheme and is better for teaching concepts than Learn you a haskell, which teaches haskell. I recommend you finish whatever goal you're doing in java, then do SICP once over (lightly), then do LYAH. then maybe do SICP a second time, more thoroughly. you'll find java tiring by then, fair warning. java is extremely verbose and bothersome to work with

ValueError: unsupported format character ' ' (0x20) at index 695

help

What language?

python

i'd say around 2 years of full-time programming to really start getting good. work on different things and challenge yourself to write top-notch software in real languages like C++, don't just throw some half-assed shit together in python and call it a day.

Post the code that's throwing the error

def apiGetHeadlines(feed_id, offset=0, limit=200):
sql = "SELECT entry_id AS id, encode(digest(CAST(doc -> 'link' AS text), 'sha1'), 'hex') AS GUID, entry_unread AS unread, false as marked, false as published, CAST(extract(epoch from published_stamp) as bigint) AS updated, false as is_updated, doc -> 'title' as title, doc -> 'link' as link, feed_entries.feed_id, '[]' as tags, doc -> 'media_content' as attachments, doc -> 'content' as content, '[]' as labels, feeds.feed_name as feed_title, 0 as comments_count, '' as comments_link, false as always_display_attachments, doc -> 'author' as author, 0 as score, null as note, '' as lang from greyreader.feed_entries, greyreader.feeds WHERE feed_entries.feed_id = feeds.feed_id AND feed_entries.feed_id=% LIMIT % OFFSET %;"
data = (feed_id, limit, offset)
cur.execute(sql,data)
return cur.fetchall()

Traceback (most recent call last):
File "", line 1, in
File "db.py", line 164, in apiGetHeadlines
cur.execute(sql,data)
File "/home/noko/Projects/greyreader/env/lib/python2.7/site-packages/psycopg2/extras.py", line 223, in execute
return super(RealDictCursor, self).execute(query, vars)
ValueError: unsupported format character ' ' (0x20) at index 724

Am I a noob or is that a gigantic query?

i am augmenting features that api clients may or may not expect hence all the aliased columns. I thought about doing it in python instead of postgres but decided postgres would likely be faster than python

what do you mean by using postgres vs python, like writing the logic solely with sql/stored procedures?

each row of the query comes out as a dict and all the entire query is wrapped around in an array. this array is then placed into another dict which is then json encoded and sent off to the api client.

i just had one of those moments while reading someones code that i started to like the language just because they were really good at it

then i remembered that C# is fucking cancer and submitted a merge request replacing all their comments with trigger warnings and gender neutral pronouns

this way the api response can quickly be sent out without much fiddling about. if i only query exactly what i need and then have to loop through the array enter each dict and add all the necessary elements it would likely be slower than just using postgres

So im doing my java hw, still a beginner but for problems that aren't complicated, is it fine to just do it all in main or does it go against some type of format?

methods exist for a reason

methods are what you want. then you call the methods from the main

Alright, thanks

I am a python beginner / intermediate. give me something to make that i can do in 2-3 weeks

>The same applies to CS graduates,
Only in Murica :^)

My company is looking to hire a front-end specialist in Los Angeles. I've been tasked with finding someone good enough. Link your portfolios. Weebs preferred.

dont have a portfolio
tell me something to make and leave an email. ill link you in 2-3 weeks

Damn that is an awesome quote. Too bad he's just a fucking business man and will never win against Hillary.

A neural net based ocr software, without libraries

>beginner / intermediate

Have a github/Bitbucket?

empty.

What kind of skills do you need?
My qualifications include a small portfolio of C89 programs and a folder with hundreds of pictures of akari akaza.

That's unfortunate. I don't want to put any information up here. I've been coming here for years and every time someone puts any of their info out they get fucked with. I'm not in the mood.

use a throwaway you jerkoff

> C89 programs

Very cool senpai, but we're looking for more hipster javascript developer types.

> hundreds of pictures of akari akaza

Those are some good qualifications.

Not worth it.

How far did you get at the 5 month mark though? What concept made it all click?

Why is programming so hard? I thought you guys said I didn't have to do math yet all the apps I'm doing for hw are literally math questions. I can't imagine programming in the real world... This was a mistake... Also i'm only doing C#.

You would be better off asking /wdg/. Most of /dpt/ doesn't do a lot of work with HTML/CSS/JavaScript stuff. I've seen plenty of Python, C, C++, C#, and Haskell stuff here though.

If you don't want to do math, then get into web development. Or at least front-end development.

this

what book are you using? Nothing should be harder than linear algebra, which is easy to learn. Unless you bought a book specifically on programming for domain specific things (physics, etc.)

>math questions
You mean logic. Math is also logic, so they sometimes get confused for each other.

Yeah, I asked there too. It's hard to find competent web devs man. Most of them just build wordpress sites for restaurants and call it a day.

Academic computer science is not necessarily like the real world work you'll be dealing with, unless you're doing some shit like compiler development or AI. That said, you should have a firm understanding of basic mathematics regardless of what you choose to write programs for. It is not so much that advanced mathematics is required for a good programmer, but it is the mathematical mind that is required to write good programs.

I don't like javascript very much, but I'd be willing to commit to it more if I was being paid to use it.
How do you feel about using C for backend web development?

>competent web dev
oxymoron

No book. Just teacher throwing questions and following along with examples in class. I think the writings on the wall. If I'm having trouble with programming C within MS Visual, i think this is the end of road. I just wanted a one way ticket to getting bachelors in IS and work in IT or business related job but I think I might have gone over my head... Mad respects to you CS people

At around 5 months, I figured out the value of hiding complexity behind simple interfaces (abstraction), and then I wrote an ID3 metadata parser and tag writer in C.

I should note that I started off very slow, my first attempt at programming had me spending 5 hours trying to do fizzbuzz without looking it up.

I already built the backend myself with Django. I actually built the front end as well using React, Webpack, and NPM. Thing is, I had to learn how to front-end specifically for this application, so it's not really the best code. We have some more money available now, so we can actually afford a specialist.

I've always wanted to try using C for a backend toy project. For the most part though, C isn't really suited to web stuff.

They exist. It's mostly that they are programmers who happen to like working on web stuff.

I'm a math person. It gets better--the CS courses deeper in the major are more about design and core CS concepts and less about math.

What course are you taking?

I would be lying if I haven't at least given some consideration to learning some webdev shit purely for the money, but I'm thinking that with the kind of work I'm doing for my research right now, I might be able to get more interesting jobs (I might be able to get a Microsoft position purely based on the fact that by the time I have graduated, I'll have a good amount of experience with their driver stack).

Curious though, what kind of a portfolio would you consider hire-able for a web developer?

>competent web devs
A competent programmer won't do webdev desu

Were you struggling to do it efficiently, or at all?

>Curious though, what kind of a portfolio would you consider hire-able for a web developer?

I don't even care about years of experience. I just want to find someone that is competent with a couple of languages and frameworks who knows the difference between an integer and a float. You'd be surprised how difficult that is.

I look at a resume where the person says that they know javascript and when I take a look at their "projects" all I find is a single badly written jQuery function that toggles a CSS class after an onClick event or something.

There's also a huge amount of people that consider web development to be working with Wordpress. It's like they've never even heard of anything else.

In short, If I take a look at a person's projects and they have 1 or 2 sites built with clean code and some interactive functionality, maybe an AJAX request or 2, I'll contact them. That is so uncommon it's ridiculous. That's specifically for front-end though. Back-end developers need a lot more understanding of more traditional programming. They also need to understand a bit of server administration and database schema design. Things like when to denormalize a schema and such.

I'd be surprised if 90% of the people I looked at today could even fizzbuzz.

i couldn't get it to display FizzBuzz
my mistake was having the if (!(i % 3)) && (!(i % 15)) case at the very end of the loop

Your standards are surprisingly low.
But then again, I never knew how low the bar was for "web development".

Do you have an email or something, or do you just wanna see people's githubs?

>Your standards are surprisingly low.

I wish they didn't have to be.

>Do you have an email or something, or do you just wanna see people's githubs?

Just seeing some githubs or portfolios of any sort would be great.

So sounds like something I could probably pick up in a week if I'm trying.

Trying to overload operators in C++

Quick question,, what does this mean?
Object& operator=(const Object& src)
{
//Deep Copy
return *this
}


What does *this do?

Does it return a pointer, or is it working as the de-referencing operator?

well if you want
github.com/microsounds

"this" is a pointer to the current object so yeah you're essentially dereferencing it

Unfortunately, not really the skillset we're looking for, but cool shit none the less.

How is it possible for someone to not be able to fizzbuzz when even at the lowest level you can just use a ton of conditionals?

Maybe you should actually describe the skillset you want?
Because you're not being helpful.

It's called Fundamentals of Application Programming. Basically creating apps using forms and stuff through MS Visual.

But if I'm returning a reference, why does *this return a reference?

This goes without saying, but I'm not a good programmer

I did above. I said specifically a front-end web developer. Javascript. Specifically Vue or React, Single Page Application, experience with designing an application around a REST API. Experience with CSS, and modern HTML.

Returning a value returns a reference. That's just how reference syntactic sugar works. Under the hood though, it's just returning the pointer this.

Oh, speaking of jobs and shit. I posted about the Amazon online assessment a few threads ago and never posted how it went.

Coding part was pretty easy, I choked on two though. They were probably easy, but the pressure man.

The logic/reasoning part was kind of bullshit. The logic part was pretty straight forward and kind of easy, but some of the reasoning stuff was really fucking vague and ambiguous.

Don't expect to hear back.

>front-end framework
>REST
Are you building some kind of porn aggregator site that scrapes content from other websites on the client-side?

Okay... I guess that makes sense

What are some examples of questions on the logic and reasoning tests?

Do they have anything to do with programming?

That sounds fun. Nope.

Most of them were pretty much the same as the ones on google/glassdoor if you look those up.

Should I just ignore that the C Programming Language book doesn't really explain the purpose or use of EOF?

Indicates end of file, not much to it

You mean questions like these?
gwan.ch/blog/20160405.html

There's more to C than blindly accepting input from the command line.
EOF is just a specific flag condition of a FILE pointer.

I meant if you google it, not literally googles lol.

geeksforgeeks.org/amazon-interview-experience-set-137-assessment-test-sde/

That aptitude question was the same as one of mine

>1) Some based on finding relationships between given number/strings and find the missing one
this seems arbitrary as fuck
>Given two words, find if second word is the round rotation of first word.
>For example: abc, cab
I don't even know what this means.
Does it want me to keep shifting letters to the right until the string matches?
>2) Given two hexadecimal numbers find if they can be consecutive in gray code
What's a gray code?

I'm pretty sure I would have failed your dumb test.

>1) Some based on finding relationships between given number/strings and find the missing one

Basically find the pattern.

>Does it want me to keep shifting letters to the right until the string matches?

ABC slide the elements forward and wrap so CBA is a rotation.

>What's a gray code?
Check to see if they are neighbors, didn't have a question like this

it's like '\n' but for files instead of strings

I meant \0

interesting okay.
I feel almost alittle overwhelmed going into this book with no real programming knowledge. It really jumps right in.

i fuckin laughed

I wonder, why only today we have expressive low-level languages like Rust, ATS and others? Why C won back then?
In the early days computers were a thing of engineers, i.e. people who created first languages had to know math. Since programmers back then knew math, it could be easier to introduce "complex" things like GADTs, typeclasses etc. Why we ended up using "dumb" and unreliable languages?

I tried learning opengl months ago, but I stopped when it got to shaders because I didn't understand the vector math/trig concepts at all and it all went over my head, i learned how to use shaders and how to apply them when rendering vertex data in immediate mode, but I had no idea how to write a shader myself.

Is there a book or resource that teaches you the math concepts required for 3D graphics?
I don't even know what a dot product is.