/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

docs.oracle.com/javase/tutorial/
youtube.com/watch?v=X36ye-1x_HQ
en.wikipedia.org/wiki/UTF-8#Description
twitter.com/SFWRedditImages

First for Java

Programming in a language without I/O
is the ultimate proof that you actually program purely for fun.

OOP = pOOP

...

With the risk of sounding like a retard I will ask this question:

I am a NEET who doesn't want to leave the house. All I do is read books, but a writing career is almost impossible so I can't bank my hopes on that.

I have tried learning programming before, but I just couldn't wrap my mind around it and gave up. I guess I was just being an idiot, getting frustrated, and then quitting. I would like to pick it up again, but with the express reason of getting a job. The language must meet the following criteria: fast to pick up, makes me money.

What should I look into?

Java

Java

Idris > Haskell > other languages

Lisp

Hey Sup Forumsuys i want to learn how to start in programming, where should i start if i don't know literally anything?
>starting from the bottom
>any tips for a beginner?

mcdonalds application

Idris < Haskell < Python < other languages

Python

>Idris
Trash.
>Haskell
Trash.

Can you tell me more?

God no.

docs.oracle.com/javase/tutorial/

Way back in the day for fun I programming a toy OS. I could just write the binary to floppy and boot a machine. I tried to look into making a toy OS again, and I was looking at using GRUB so I could use it to handle the dirty work of getting into a standard environment, but I couldnt even figure out how to get GRUB to boot it. How the fuck do you install GRUB and make it able to boot your kernel?

Reminder that if you can't program in C then you're not a true programmer.

LISP is very good for improving your programming skills,
but Java has the most jobs and is fast to pick up.

but python is not a programming language

s/C/C++

>Other languages
Trash.

>I have tried learning programming before, but I just couldn't wrap my mind around it and gave up.

how did you try? did you try coding? what language? what books did you read how many hours did you spend trying? we need details

So I should learn Java, get a job with Java, and then learn Lisp if I want?

...

I think you can just write it to a partition on your harddrive and run update-grub and it should detect it (maybe).

I suggest checking out job sites browsing job postings in your area and observe the different languages requirements. Like for example in your area some languages the posts may require a lot more like degree than versus other languages.

Tell me about Idris.

t. Python/Ruby/Javascript trash

I'll let its creator elucidate you.

youtube.com/watch?v=X36ye-1x_HQ

...

>So I should learn Java, get a job with Java, and then learn Lisp if I want?

it's not quite that easy

I tried, yeah. I tried Python and C. A bit of C# too. Someone said I should try to program a video game, so I downloaded a lot of different books on how to do different things. Mostly the "learn X the hard way" book series. I legitimately didn't like it. I would try for a few hours each time and then get frustrated, but I was also going through stuff in my life that frustrated me and added to the frustration of not being able to make something work.

Makes sense. I was actually about to do that before this post even but I got distracted.

>The language must meet the following criteria: fast to pick up, makes me money.

html/css

nothing is easier to learn and htmlmonkeys are always in demand

I had trouble grasping programming until I worked through 'learn python the hard way'. Most people talk shit about it but it was really great for me. And it was pretty quick also.

>I tried, yeah. I tried Python and C. A bit of C# too. Someone said I should try to program a video game, so I downloaded a lot of different books on how to do different things. Mostly the "learn X the hard way" book series. I legitimately didn't like it. I would try for a few hours each time and then get frustrated

did you get as far as making a "hello world" program?

where did you run into trouble

a few hours is nothing user

>thanks lawds, i will be start as soon as possible, it's time to get into the business
>long live to lizard king

Can you write compilers in it?

even front end web devs need to know javascript and it's a lot more design-oriented. web dev is a shitty line of work to go into if it's not already your specialty or your passion

Nope, but you can certainly write trash in it.

>even front end web devs need to know javascript

I worked for 2 years as a web dev and only used html5, css and like the smallest ammount of ruby

just depends on what kind of sites you are working on, I know people who make $40,000 per year doing nothing but adding photos and text to wordpress sites for small businesses

Yes!

t. webshit

The Learn X The Hard Way books are shit.

Read The C Programming Language. It's a good logical progression through a language with exercises to make you think and not do this stupid monotonous task because you're too stupid to actually logically model a system and implement it.

What should I be using to do that?

If your language can't evaluate forms during read-time, it's trash.

TCPL is written for people who already know how to program.

Probably Haskell for anything serious, Idris is still immature from what I understand.

I didn't get any internships and I'm graduating next semester. Am I fucked?

I second that the "Learn X the hard way" books are garbage if you aren't mentally challenged. Zed Shaw is a hack.
If you want to learn python try "automate the boring stuff instead.

Haskell, or OCaml, or Idris

Idris might be awkward, since you need to formally prove to the Idris compiler that your program fits some specification

it's not ideal but what can you do, don't take extra semesters just to get internships, you just gotta hustle and work on projects for your resume and try to get your foot in the door

How do you know an Idris compiler is formally verified? On that note, how do you know if Idris tells you a program is correct, it isn't lying or incorrect?

Alright. Honestly I feel like I learned a ton this past year so I could probably make some cool projects over summer.

Any advice for job hunting? Are there any websites that are good for finding jobs?

Java, pic related is my recommended book
Beginners should be taught strongly typed languages to begin with so they know what is what rather than being thrown into something like Python where they won't understand or care about half the concepts they used.

It's not really that straight forward but if you put your mind to it, you could make it happen.

Anyways, if you do get Java down, try taking Clojure for a spin after. Basically Lisp with the benefits of Java and the JVM.

I used the "Learn Python the Hard Way" book but I just couldn't put up with it. I also don't understand why he thinks Python 2 is still good to teach to people when the industry is trying to move towards Python 3.

What are the main differences between Haskell and OCaml? I'm only familiar with the former.
>since you need to formally prove to the Idris compiler that your program fits some specification
What do you mean? Is there some theorem prover mode?

It is possible that there are bugs in the Idris typechecker, but they are just that, bugs, and not a problem with the language.

Because Edwin.

Haskell is pure and OCaml is not
OCaml has polymorphic variants and records (row polymorphism), Haskell does not
OCaml's module and record system is allegedly pretty good, Haskell's is not
GHC Haskell adds a ton of extensions, especially type and syntax stuff, some of which are not found in OCaml

Haskell has type classes and ad hoc polymorphism (overloading), OCaml does not

That disclaimer is only there because they didn't want the expectation that they'd go over simple, universal concepts, and then disappoint, nor was it their goal. However, if you've actually read TCPL you'd know in most cases they end up giving a (very) brief explanation of what concepts are before showing the C implementation.

>Now, for some explanations about the program itself. A C program, whatever its size, consists of functions and
>variables. A function contains statements that specify the computing operations to be done, and variables store
>values used during the computation.

>One method of communicating data between functions is for the calling function to provide a list of values, called
>arguments, to the function it calls.

>A sequence of characters in double quotes, like "hello, world\n", is called a character string or string
>constant.

Similar statements are found throughout the book, so yeah, it's not explicitly written for new programmers, but it's certainly written in a way that new programmers can easily follow, and I find the avoidance of the "you don't know what the fuck you're doing so I'll spell it out for you" attitude to be beneficial, as the text encourages you to think and solve problems using the tools and methods that have been proved to you.

If you can't extend your language's syntax seamlessly, it's trash.

>I also don't understand why he thinks Python 2 is still good to teach
Yeah, what the fuck? The ONLY valid reason to have used Python 2 for the past seven years is if you're working with a legacy codebase that can't be easily converted. If you're learning it new, learning 2 over 3 has been full retard for the past nine years.

Could a kind soul post a snippet of how to iterate over an utf-8 string in C?

Sure.
HACKING MODE...
C...
iterate over an utf-8 string

i see your point, and i will thank you for it.
>start hardcore and it will be easy once you get it

(loop for x across foo)

completely fucking new to HTML and just trying to do something basic

Close your tags.

...

Thx also How do I change the color as the color:#ffcccc;> didnt work

en.wikipedia.org/wiki/UTF-8#Description
just skip any byte that has the two high order bits set to 10.

close your tag properly and it should work

>Volume 1
Fuck me. It's not that big of a language.

building a quiz app and need to have the editText string compared to the answer string and the total score increase by one... i know im stuck on something stupid.

EditText answerQuestionOne = (EditText) findViewById(R.id.answer_question_one);
String answerOne = answerQuestionOne.getText().toString();
if (answerQuestionOne == "rotary") {
totalScore = totalScore + 1;

It's a verbose book, but I got through it by taking notes from it and other sources and studying those rather than studying directly from the book.

If that's java you need to use equals() to compare strings
>"a".equals("b")

Use .equals for strings or compareTo, not ==

Okay. Good luck.

rotary is the answer. answerQuestionOne== "rotary" does not work. need them both to be strings?

thanks

I'd also need to add cases for 110, 1110, 11110.

Yesterday I found 3 libs in C: utf8proc, MicroUTF-8 and libutf. But I don't know how to use any of those three

what a load of shit, the program is written by hand, just because it has strong typing doesn't mean it does exactly what the programmer (or the specification) had in mind

if ("answerQuestionOne".equals("rotary") ) {
totalScore = totalScore + 1;

The types are the specification.
Very strong type systems like Idris allow you to express almost any specification to the typechecker.

learn the basics of java and how to look things up on google before you start making apps

Store each UTF-8 character in a data type large enough to fit any UTF-8 character. Make a pointer to each character, Put these pointers in an array. Iterate over the array of standard sized pointers.

Can I construct the Y combinator in it?

provided you first construct the lambda calculus

Anyone code a compiler or assembler? Have to code a MIPS32 assembler in C for my CS class and it sucks yo

Trash.

Isn't an assembler just a glorified find and replacer?

Bretty much. Except there are some pain in the asses such as psuedo instructions and the passes required to elide comments, build the symbol table, etc.

>need them both to be strings?
yes
"rotary" is a String
answerOne is a String

and to compare strings (or compare any object by value rather than object identity), do answerOne.equals("rotary")

>no one told him he needs to .equals() for objects

see

I mean his book/prof/learning resource

>objects

A tool to keep track of my color palette, that boots up as fast as an image viewer. Currently working on the schema for how the custom file should look like.
Instead of making my own schema would it run faster if i used xml or json? my schema would be compressed alot more and be much much shorter

Strings are objects in java. I have no doubt the implementation uses arrays of chars