[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/prog/ - Programming

Programming board

Catalog

Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


File: 1439697368517.jpg (179.29 KB, 480x710, 48:71, 9780262019347_0.jpg)

2db90e No.3034[Reply]

This guide assumes you forgot everything from highschool. No you don't have to learn any of this in order to program you can just start hacking around every .c file in your kernel.org git source clone and see what happens. Why would you want to learn math? Because it will change your thinking. You won't be easily fooled by bullshit, you will have tools to sort through obvious logical fallacies. You will be able to optimize programs and create your own algorithms. You will be able to estimate. Above all, you will be able to solve problems using computation which is what computer science is all about. And least of all, you will get paid more than anybody else without this knowledge so if your goal is shekels then read on. Note: DO THE EXERCISES. You won't learn otherwise. Books instead of video lectures were chosen because they've lasted 30+ years some of them in relevancy in the field, also lectures disappear all the time like when MIT nuked all one prof's Physics OCW lectures because he tried to pickup a student, setting a precedent that at anytime this information can disappear. Read a book nigga.

Math Preliminary

Basic Mathematics by Serge Lang

Buy/Pirate this book (he's dead). It's highschool math, from the perspective of a Mathematician. You will learn up Pre-Calculus and be prepared for rigorous proofs later.

An Introduction to Mathematical Reasoning" by Peter J Eccels

This changes you from rote drilling and being a human calculator in highschool to learning what math actually is, and what proofs do. Excellent, excellent book.

How to Solve It by G. Polya

How to do proofs, written in 1940s and still for sale in every Chapters/B&N bookstore to this day because it's the best proof helper that exists.

Welcome to Proofs

Calculus" by Spivak

Actually, you are learning ANALYSIS, in addition to calculus. Torrent the 3rd edition w/the answer book. This is a fucking hard assed book, you may be bePost too long. Click here to view the full text.

85 posts and 13 image replies omitted. Click reply to view.

3f73fc No.3960

>>3921

Cryptocoin trading is still sort of profitable, even if mining isn't that efficient anymore. The 2013 bubble burst seriously proved the doubts of Bitcoin's critics.

I would advise browsing some forums and reading up on economics, if you're new to the field that is. Other than reselling clearance stuff/auctioning off your weebshit there aren't many other (legal) get-rich-quick schemes.




File: 1411372549161.jpg (64.52 KB, 447x553, 447:553, 23456456789.jpg)

76e847 No.60[Reply]

Does /prog/ need images?

http://strawpoll.me/2622392

Also you can suggest changes (rules, dashboard).
64 posts and 4 image replies omitted. Click reply to view.

5018ba No.3254

>>60

I don't think it NEEDS images, but it's nice to have them for many reasons. In other words, I can see no reason to get rid of them. Keep it all optional, allow people to post/make threads without images, but allow them to do that if they wish.




c39e21 No.1351[Reply]

RULES

No advertising.

Stay on-topic.

No questions like "can someone do my homework?".

Use code tags for code and $$ for math.

No shitposting.

Don't do anything that requires to add more rules.


http://8ch.net/prog/rules.html
1 post omitted. Click reply to view.
Post last edited at

743e9b No.1359

>>1351
If you want to contact the admin of this board you can send a mail to prog@8chan.co



5be28b No.4010[Reply]

Is Java too hard to learn as a first language?

e05e0d No.4011

Not really, what's hard is getting good at programming in general.


b78a03 No.4017

>>4010

Java is one of the simpler languages so it is often used to teach programming. other simple good teaching languages are python, ruby, and javascript.

but for next time you should know programming is a skill and the programming languages are the tools. asking if Java is too hard for a first language is like asking if photoshop is too hard to learn how to edit photos.


cf4516 No.4042

>>4017

An analogous problem would be is a Land Rover too hard to drive as a first car.




File: 1458269312215.gif (122.01 KB, 350x435, 70:87, watson and holmes discussi….gif)

4b97cb No.4025[Reply]

Rot13 thread!


key = 13
U = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
L = 'abcdefghijklmnopqrstuvwxyz'
rot13 = str.maketrans(U + L, U[key:] + U[:key] + L[key:] + L[:key])

print('rot13 is cool!'.translate(rot13))

00ecae No.4027

type 256 ohssre: gnoyr
: genafyngr ( p -- p' ) gnoyr + p@ ;

mnexre renfr
: genafyngr! ( p p' -- ) fjnc gnoyr + p! ;
: vqragvgl ( n-gnoyr -- ) 256 0 qb v qhc genafyngr! ybbc ;
: ebg13-gnoyr ( n-gnoyr -- )
[ pune z ] yvgreny [pune] a qb v qhc 13 - genafyngr! ybbc
[ pune Z ] yvgreny [pune] A qb v qhc 13 - genafyngr! ybbc
[ pune m ] yvgreny [pune] n qb v qhc 13 + genafyngr! ybbc
[ pune M ] yvgreny [pune] N qb v qhc 13 + genafyngr! ybbc ;

vqragvgl
ebg13-gnoyr
renfr

: ebg13 ( 'fgevat' -- )
obhaqf qb v p@ genafyngr v p! ybbc ;

fbhepr 2qhc ebg13 type

A pretend-generic solution. You could make any kind of ASCII translation with that table, or write a "maketrans" that maps one string's characters to another, or a "rotate" that maps characters to a rotation of themselves.

But since you only want rot13 it's a lot of wasted code. Not Forthy. Which is why it's erased from the dictionary after use. That way, if an executable is built, it'll just have the translation table as set up for rot13, and none of the code that set it up.

The last line prints itself out, rot13'd. 'glcr' is the rot13 of 'type', the Forth word that prints a string. Yes, the source code is modified so that 'glcr' becomes 'type' before Forth looks at it to run it.

Source is copyright protected and is encrypted. Breaking encryption is a violation of the DMCA and FBI FBI FBI fucko


07a276 No.4039

File: 1458537062815.webm (3.27 MB, 320x240, 4:3, wow.webm)

>>4025

>>4027

read a book, rot13 is trivial.


#include <bits/stdc++.h>
using namespace std;
int main() {
string l;
while(getline(cin, l)) {
for(int i = 0; i < l.size(); ++i) {
if(isalpha(l[i])) {
cout << (char)(((tolower(l[i]) - 'a') + 13)%26 + (islower(l[i]) ? 'a' : 'A'));
} else {
cout << l[i];
}
}
cout << '\n';
}
return 0;
}


75440c No.4041

>>4039

Ugly code.




File: 1428446513706.png (175.93 KB, 300x296, 75:74, picture1.png)

c24ed2 No.1961[Reply]

What is the best and worst programming language you've ever used?
168 posts and 13 image replies omitted. Click reply to view.

799d6c No.4030

Hot.


799d6c No.4031

>>2764

>implying they teach real programming in highschool

Nice meme

Gonna go learn some more MS Word

Cya


799d6c No.4032

Best/Worst language at all times forever is LISP and all of its dialects. Aside from Scheme and Common LISP, which are ALWAYS good.


1870d4 No.4033

Best: C, I love working/contributing with projects written in C whether it's Windows or Linux. I like Go as well.

Worst: ASP.NET


280bfa No.4040

>>3200

You might want to chill up a bit.




File: 1458163888008.png (111.39 KB, 1634x2224, 817:1112, 68747470733a2f2f7261772e67….png)

a44253 No.4021[Reply]

What do you think about Go, anons?

da33d3 No.4023

I'm not a Go dev, but I'm thinking of learning Go, have written a few tiny applications with it.

From what I gather:

It is strongly typed and compiled, which should make it faster and cleaner than the likes of ruby and python

It uses packages, always statically compiled and garbage collected, which should make it simpler than the likes of C++

Still has a lot of weirdness though, like error handling or lack of inheritance

It was created as a general purpose language but I think it's mostly used in webdev for some reason


57895d No.4029

The object system is shit, the lack of generics is retarded.

The syntax for specifying the type of a variable is my favorite ever.

The channel system for async/multi threading is amazing.

4/10 use Clojure instead.


9c4dd3 No.4038

File: 1458515819043.png (2.77 MB, 1698x1131, 566:377, 1426516998116.png)

>>4021

Go?

More like Go to the trash!




File: 1458359244569.png (4.95 KB, 230x230, 1:1, haxe-logo.png)

5b592e No.4036[Reply]

I have never in my life seen anybody talk about this programming language.

Personally I love it, since its syntax, libraries, and cross-compile features are amazing.

Is it just because it is unpopular or do I most people dont like it and thats why they dont talk about it.



File: 1457891881754.jpg (11.89 KB, 189x267, 63:89, grey fox.jpg)

ebad9d No.4013[Reply]

HURT ME MORE SNAKE, MAKE ME FEEL ALIVE AGAIN!



import numpy

"""training data"""
x = numpy.array([[1,1,1,0,0,0],
[1,0,1,0,0,0],
[1,1,1,0,0,0],
[0,0,1,1,1,0],
[0,0,1,1,0,0],
[0,0,1,1,1,0]])

correct_label = numpy.array([[1, 0],
[1, 0],
[1, 0],
[0, 1],
[0, 1],
[0, 1]])

"""initializes weight and bias as zero vectors"""
weight = numpy.zeros((6, 2))
bias = numpy.zeros((6, 2))

def softmax(a_vector):
"""Compute a logit for a vector."""
denom = sum(numpy.exp(a_vector))
logit = numpy.exp(a_vector)/denom
return logit

def softmax_a_set(a_set):
"""computes logits for all vectors in a set"""
softmax_set = numpy.zeros(y.shape)

for x in numpy.nditer(a_set):
x = softmax(x)

return softmax_set

def cross_entropy(logit, label):
"""generates the cross entropy between label and logit"""
return -1*sum(numpy.log(logit)*label)

def train(x):
"""walks the function closer to the best value"""
pass

y = numpy.dot(x,weight) + bias

6dcd5d No.4034

what is this shit?


4a0d42 No.4035

>>4034

someone who's seen docstrings but doesn't know how they work.

also looks like neural network stuff.




e7c64c No.4028[Reply]

hey is there anyone willing to do my alice homework, will pay in bitcoin



File: 1456330412889.png (1.01 MB, 1702x2471, 1702:2471, 1453330426481.png)

947390 No.3978[Reply]

hi /prog/

I'm an extremely average programmer and my code is shit. I started looking into ways to improve my code but couldn't really find any legitimate methods.

then I found pic and it opened my eyes.

my code got a little bit better over the past month of crossdressing and I'm not exactly sure why, maybe it's because it puts me in a good mood,

or maybe it's the determination to get it over with and do the best I can so I won't have to keep trying to explain to my mom why I'm wearing my sister's clothes.

but the real question

is what girl clothes will give me both comfort and improve my ability to program really well?

I expect it to be a few months before I'm really good but I'll never get there without the proper outfit.

thanks.

2 posts and 1 image reply omitted. Click reply to view.

947390 No.3984


fcf577 No.3987

School girl uniform for algorithm heavy stuff

Maid uniform for refactoring

Necliché for low level stuff

Untested: Cheer leader outfit when optimizing for speed


c731a7 No.3989

>>3978

This thread is shit and not about programming.

Mods, please delete this thread and ban OP for life.


7ef199 No.4026

>>3987

do you have an example of Necliché?

I looked it up but couldn't find anything…

>>3989

>not about programming

yes it is…

>delete this thread and ban OP for life

no.


d5dd47 No.4037

>>3978

So you wanna look like a female because everybody who is a programmer is 92% male?

So that means, you want programmers to be gay?

Are programmers gay now? What am I looking at right now?




File: 1457894670130.jpg (25.87 KB, 498x321, 166:107, why.jpg)

dc2b18 No.4014[Reply]

Windows forced me to update so I turned automatic updates off. And it restarted before I hat save.

dc2b18 No.4015

Windows will still restart by itself even if you don't want it to. I have now to rewrite everything. I'm now forced to be up at night for this stupid shit.


534305 No.4022

Save often, brother, this is like computer literacy 101


9d40df No.4024

>>4014

>>4015

Why not not use windows?




File: 1428855176548.jpg (76 KB, 500x362, 250:181, kid_programming.jpg)

3c1daf No.2017[Reply]

Write a program that takes a string of digits and prints them back out in LED style.
./led 1234567890
_ _ _ _ _ _ _ _
| _| _| |_| |_ |_ | |_| |_| | |
| |_ _| | _| |_| | |_| _| |_|


My solution in Python3.
#!/usr/bin/env python3

from sys import argv
from sys import exit

if argv[1].isdigit():
digits = argv[1]
else:
Post too long. Click here to view the full text.
50 posts and 5 image replies omitted. Click reply to view.

d59bd7 No.4003

:- module led.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module list, string, char.

:- pred draw(char, string, string, string).
:- mode draw(in, out, out, out) is semidet.
draw('0', " _ ",
"| |",
"|_|").
draw('1', " ",
" | ",
" | ").
draw('2', " _ ",
" _|",
"|_ ").
draw('3', " _ ",
" _|",
" _|").
draw('4', " ",
"|_|",
" |").
draw('5', " _ ",
"|_ ",
" _|").
draw('6', " _ ",
"|_ ",
"|_|").
draw('7', "_ ",
" | ",
" | ").
draw('8', " _ ",
"|_|",
"|_|").
draw('9', " _ ",
"|_|",
" _|").

:- pred draw(char, {list(string), list(string), list(string)},
{list(string), list(string), list(string)}).
:- mode draw(in, in, out) is semidet.
draw(C, {T,M,B}, {[T1|T],[M1|M],[B1|B]}) :-
draw(C, T1, M1, B1).

:- pred led(string, string, string, string).
:- mode led(in, out, out, out) is semidet.
led(N, Top, Mid, Bot) :-
string.foldl(draw, N, {[], [], []}, {T, M, B}),
Top = string.join_list("", list.reverse(T)),
Mid = string.join_list("", list.reverse(M)),
Bot = string.join_list("", list.reverse(B)).

:- pred led(string::in, io::di, io::uo) is det.
led(S, !IO) :-
(
led(S, T, M, B)
->
io.write_string(T, !IO), io.nl(!IO),
io.write_string(M, !IO), io.nl(!IO),
io.write_string(B, !IO), io.nl(!IO)
;
io.format("Sorry, I didn't understand ``%s''\n", [s(S)], !IO)
).

main(!IO) :-
io.command_line_arguments(Args, !IO),
( Args = [Arg] -> led(Arg, !IO) ; usage(!IO) ).

:- pred usage
Post too long. Click here to view the full text.

9d9960 No.4004

>>2904

This is fucking amazing. 10/10


32613a No.4012

>>4002

I've always wondered… does Java not allow you to pass by reference?


ffbedc No.4016

>>4012

Nope. It's by-value only, but objects are passed as pointers, so you could do it if your ints were wrapped in a class, but not as primitives.


091d56 No.4020

Ruby implementation


strAy = ""
row1 = []
row2 = []
row3 = []
top = []
mid = []
bot = []
nums1 = {"0" => "313", "1" => "333", "2" => "313", "3" => "313", "4" => "333", "5" => "313", "6" => "313", "7" => "313", "8" => "313", "9" => "313" }
nums2 = {"0" => "232", "1" => "323", "2" => "312", "3" => "312", "4" => "212", "5" => "213", "6" => "213", "7" => "332", "8" => "212", "9" => "212" }
nums3 = {"0" => "212", "1" => "323", "2" => "213", "3" => "312", "4" => "332", "5" => "312", "6" => "212", "7" => "332", "8" => "212", "9" => "332" }
puts "Enter a fucking string of numbers and only fucking numbers you fucking fuck."
userinput= gets.chomp
for i in userinput.to_s.split('') do
puts i
row1.push(nums1[i.to_s])
row2.push(nums2[i.to_s])
row3.push(nums3[i.to_s])
end
for j in row1 do
for i in j.split('') do
if i == "1"
top.push("_")
elsif i == "2"
top.push("|")
elsif i == "3"
top.push(" ")
end
end
end
for j in row2 do
for i in j.split('') do
if i == "1"
mid.push("_")
elsif i == "2"
mid.push("|")
elsif i == "3"
mid.push(" ")
end
end
end
for j in row3 do
for i in j.split('') do
if i == "1"
bot.push("_")
elsif i == "2"
bot.push("|")
elsif i == "3"
bot.push(" ")
end
end
end
puts top.join('')
puts mid.join('')
puts bot.join('')




File: 1441181852069.jpg (66.74 KB, 573x459, 191:153, heart.jpg)

80c2ea No.3182[Reply]

>C without pointers

>Haskell without monads

>Java without exceptions

>Python without whitespace

38 posts and 3 image replies omitted. Click reply to view.

d52f83 No.3986

>any functional language

>no tail recursion


80c2ea No.4001

>>3974

>Nglsh wtht vwls


653c50 No.4005

>>3184

>goto

Just use while loops, you fucking newfag.

>if statements

They're called conditionals, and they're not required.


653c50 No.4006

>>4005

>>3184

Me again, here are some while-loop pseudo-conditionals.


#include "stdio.h"
main(void) {
int x=1;while(x<101) {
while (x%3==0) {
printf("Fizz"); break;
}
while (x%5==0) {
printf("Buzz"); break;
}
while (x%3 && x%5) {
printf("%d", x); break;
}
printf("\n");
x++;}
}


1aee25 No.4018

>>4006

>that indentation style

are you a wizard or an idiot?




File: 1455762555193.png (15.43 KB, 1354x79, 1354:79, Screenshot.png)

17dcfb No.3963[Reply]

I dont know why this is, I have the idea in my head however when I try I seem to develop autism.

17dcfb No.3965

>>3963

No one? really!


b0ed83 No.3967

>>3965

Dude this board has like two posts a week and five active users I saw your post only because I'm subscribed to the board's rss.

Besides what do you want us to tell you? Practice more. Don't be an autist. Work out the things you need to do in your head and then write the code.

Writing a program is like traveling to a destination. You decide where you want to go, you decide how you want to get there and then you depart.


62c6c3 No.3970

File: 1455842157913.png (48.19 KB, 1000x420, 50:21, 03-10.png)

You need to formalize your idea, unless it's a library you probably should analyze it top-down. Get the general idea, split it into problems, subproblems, etc. then implement the small parts. Start practicing with simple programs, since you're having trouble with it you should write your analysis down on paper. Post an idea you're having trouble with.


027cb1 No.4008

Yo, OP, I used to have this exact problem. I knew all the syntax, general rules, etc., but I just could not write anything down. The way I fixed it was that I kept looking at better programmer's code, copied it down word-by-word (don't copy and paste), and then compiled it.

Now you're thinking "but that won't work, I'm not creatively thinking if I do that". While it's true that you won't be thinking creatively, it will make you "get" how their code works intricately. It forces your brain to look at the code closely line by line, rather than trying to read it like a normal book.

Once you do this long enough, you will start predicting what needs to be written next without looking at their code. Keep going, and you'll start noticing ways you could have written it to suit your own preferences. Then, you will actually start thinking like a programmer, and be able to come up with original code.




Delete Post [ ]
[]
Previous [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
| Catalog
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]