/dpt/ - Daily Programming Thread

boards.Sup Forums.org/g/thread/57415525#top

Other urls found in this thread:

open.gl/transformations
en.wikipedia.org/wiki/Legal_status_of_cartoon_pornography_depicting_minors#New_Zealand
pastebin.com/xFkTU9VT
twitter.com/NSFWRedditGif

What the fuck is this shitty thread

>Created before the bump limit
>A URL
Delete this shitty, invalid thread, and kill yourself.

third for python 3

Are you the retarded linux fag that doesn't even know how to install an ide?

>tfw I have the doujin on harddisk
>tfw this is a blue board

source?

...

Coding conway's game of life in Javascript. Still lifes seem to work but glider guns don't glide so I know something's wrong. Anybody see a bug? Thanks Sup Forums.

var newState = window.gameState.slice();
for(var i = 0; i < 30; i++){
for(var j = 0; j < 30; j++){
var total = 0;

for(var k = -1; k < 2; k++){
for(var l = -1; l < 2; l++){
total += window.gameState[(i + k + 30) % 30][(j + l + 30) % 30];
}
}

if(window.gameState[i][j] == 0){
if(total == 3){
newState[i][j] = 1;
document.getElementById(i + "-" + j).className = "alive";
}
}else{
if(total < 3 || total > 4){
newState[i][j] = 0;
document.getElementById(i + "-" + j).className = "dead";
}
}
}
}
window.gameState = newState.slice();

Accidentally posted an old version so re-doing this post

does anyone know where i can get a scheme compiler for ubuntu.

Chicken Scheme compiles Scheme to C iirc

A cell is alive if there are 4 live cells in the 3x3 neighbourhood, or if there are 3 live cells including the cell itself.

how realistic is reading all of the art of computer programming with low math background?

You have the rules of the game wrong. A cell stays alive if it has two or three live neighbors. It dies if it has fewer than two or more than three. A cell is born if it has three live neighbors exactly.

I found the bug, by the way. It was annoying as hell. I'll leave finding it as an exercise to the reader.

Learning Python 3.4 in a rush to make some simple shit. I'm on chapter 2 of the tutorial but it's just telling me lots of useless shit instead of showing me simple programs. How do I take the input of the user as a variable? That's all I wanna know. Also I assume that interactive code and script code look the same right?

What's the name?

make tasteful crops to use as reaction images

Just look up what sigma notation is, and you're good to go.

>(C73) [Mieow (Rustle)] ~(^-^)~.exe 2007
That should help you.

No.

Are you not double buffering?

Is this legal?

Oh, yes you are, it's so fugly I didn't notice.

It's loli. I'd say you decide if it's legal or not.
>fuck the police

...

wtf I love lolis now

Don't blame your poor reading skills on me user.

Dynamic typing bothers me, especially in regards to how difficult it is to analyze someone else's code.

>favorite language
>language you're most familiar with
>language you've used the most at work
>language you've used the most not at work

Haskell, but it used to be Scheme
Java
Java or C++
Java or Scheme

you just revealed your normalfag powerlevels

C++
C#
C# or C++
C#

...

>favorite language C++
no excuse

DOOOO EEEEET!

Coq or Idris or something?
OCaml
C#
OCaml

M
OD
ERN
C++/CLI

C#
C#
C#
C#

C++
C++
JS
C++

C++
C++
NEET
C#

cubicaltt
Haskell
N/A
C++

userInput = input("Enter something: ")

C
C
C
Python

I've been telling you guys all along. Anime posters need to leave. And you all laughed at me. And now when an anime poster creates a shit thread like this, I'm the only one laughing now

Dynamic typed languages with insufficient tooling to do proper analysis of code are a real pain, especially considering Common Lisp shows a lot of ways to reduce the brain fatigue with good tools for peeking into the machine

I feel stupid. Does anyone know really good resources to learn about matrix transformations in the context of opengl, webgl and canvas transform operations?

The worst part is I can't tell if the matrices are column major or row major and what the differences are.

Common Lisp
C++
C++
C++

I'm building my tic tac toe check win state engine.

how big the grid (3x3, 6x6, 9x9, 19x19)? 3x3
--- --- ---
| || || |
--- --- ---
| || || |
--- --- ---
| || || |
--- --- ---
player 1 wins


I'm really liking to programing.

Python
Right now? C++. Before Python
AutoHotKey surprisingly
C++

open.gl/transformations
You are pretty much covered for the simple stuff.

In OpenGL it's up to you. The decision is ultimately made in the shader where you choose the order of multiplication during vertex transformation or whatever.

Literally no one who matters (those without severe autistic tendencies) care.

What are some of those tools?

does anyone know where i can get a scheme compiler for ubuntu.

In the trash 2bh.

nobody uses scheme anymore. Just download default-jdk

Python
Java
C++
Java

>before bump limit
it was made at 299 to be included in 300

Ada
C++
C++
Ada

sudo apt-get install chicken-bin

Trying to figure out why the multi layer perceptron from the sklearn package produces a memory error when it has only allocated 20% of the maximum size.

Conventionally, OpenGL uses column-major order, and performs transformations with the matrix on the left and a column vector on the right (DirectX does it the other way around).

Early versions only supported these conventions. Later versions added e.g. glLoadTransposeMatrix() so you can use a row-major matrix. GLSL lets you declare that a matrix is row-major via layout qualifiers. glUniformMatrix() has a "transpose" parameter to transpose the matrix.

In GLSL, multiplying a matrix by a vector treats the vector as a column vector if it's on the right and a row vector if it's on the left.

Note that (A.B)^T = (B^T).(A^T), so multiplying transposed matrices in the reverse order is equivalent to transposing the result.

If you use M.v (matrix on left, vector on right), the translation components should be in the right-hand column, while the bottom row should be [0,0,k,0] for a perspective projection and [0,0,0,1] for anything else. If you use v.M (vector on left, matrix on right), M should be transposed (translation on the bottom row).

C++
C++
C++
C++

How long did it take for you to read sicp, /dpt/?
I'm reading a subchapter a day, it's not always possible to finish all exercises in a day, but it's been a comfortable pace.

Bump limit is 310

About matrices. I tried to make a simple 2d matrix multiply function, however when looking at a "correct" solution (from glmatrix) it is different and I'm not sure why.

// glmatrix function
multiply = function (out, a, b) {
var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
out[0] = a0 * b0 + a2 * b1;
out[1] = a1 * b0 + a3 * b1;
out[2] = a0 * b2 + a2 * b3;
out[3] = a1 * b2 + a3 * b3;
out[4] = a0 * b4 + a2 * b5 + a4;
out[5] = a1 * b4 + a3 * b5 + a5;
return out;
};

// my function
var a00 = this.matrix[0], a01 = this.matrix[1],
a10 = this.matrix[2], a11 = this.matrix[3],
a20 = this.matrix[4], a21 = this.matrix[5];

var b00 = matrix[0], b01 = matrix[1],
b10 = matrix[2], b11 = matrix[3],
b20 = matrix[4], b21 = matrix[5];

// a02, 12 and 22 are 0, 0, 1 respectively
// a02
this.matrix[0] = a00 * b00 + a01 * b10;// + 0 * b20;
this.matrix[1] = a00 * b01 + a01 * b11;// + 0 * b21;

// a12
this.matrix[2] = a10 * b00 + a11 * b10;// + 0 * b20;
this.matrix[3] = a10 * b01 + a11 * b11;// + 0 * b21;
// a10 * b02 + a11 * b12 + 0 * b22;

// a22
this.matrix[4] = a20 * b00 + a21 * b10 + b20;// + 1 * b20;
this.matrix[5] = a20 * b01 + a21 * b11 + b21;// + 1 * b21;

Is it because I put a on the left instead of on the right?

>Here are some examples of poor wacky hash functions I've seen suggested in forums on the internet.

>md5(sha1(password))
>md5(md5(salt) + md5(password))
>sha1(sha1(password))
>sha1(str_rot13(password + salt))
>md5(sha1(md5(md5(password) + sha1(password)) + md5(password)))

>have issue with code silently failing to do what I intended for half the day
>ended up just being me failing to allocate an object to the heap instead of stack and it dying too fast

oh my god

That's just stupid. Everyone should do
int n=63;
while( n )
{
password = md5(password);
n--;
}

i dont feel like studying but exams are soon, what should i do. Its not like i need to study much anyway

C++
C
N/A
Probably C but soon to be C++

install gentoo

>md5(salt)
y

>password
B C R Y P T

It's not difficult, people.

Rust
JavaScript
JavaScript
Rust and JavaScript

Yes. Yours calculates b*a, glmatrix' is a*b

hard, but doable. all math in it is explained from basic principles, but in a really difficult way.

try concrete mathematics, it's the book by knuth&co and is basically extended introduction to math section of taocp.

racket
racket
c
haskell

Coq is not a language.

cubicaltt is barely a language, it's just an experimental implementation of a specific flavour of lambda calculus. The performance is also completely shit.

Fuck you double nigger, it's still the coolest programming language there is at the moment.

nigga what? are you retarded?

Fixed my solution to exercise in previous thread to allow non-unique a,b,c,d.

; EXERCISE: write a program to find all a, b, c, and d; where a^3 + b^3 = c^3 + d^3; where all a,b,c,d are a thousand or less

(define (cube x)
(expt x 3))

(define all-possible
(let* ((number-range (range 1 1001))
(lst (append number-range number-range number-range number-range)))
(combinations lst 4)))

; takes a list of four elements
; if a^3 + b^3 = c^3 + d^3, where a is car, b is cadr, c is caddr and d is cadddr,
; is true return #t
; else #f
(define (cube-sum-equals? lst)
(let ((a (car lst))
(b (cadr lst))
(c (caddr lst))
(d (cadddr lst)))
(if (= (+ (cube a) (cube b))
(+ (cube c) (cube d)))
#t
#f)))

(filter cube-sum-equals? all-possible)


lambda calculus is programming language, if extremely primitive.

Depends on whether you live in a draconian shithole or not.

US: Depends
Commonwealth: Illegal as fuck
EU: Legal

Tfw commonwealth

fuck my shit up cunt

Move while you still can.

I'm in hecking new zealand. I mean it's comfy and chill, but I don't want to get thrown away for looking at cute girls or drawing cute girls. I'm not going to rape a child god damn it.

Doesn't matter, you're still a criminal.

en.wikipedia.org/wiki/Legal_status_of_cartoon_pornography_depicting_minors#New_Zealand

I know, I know. Some dude was arrested for it once too.

So move while you still can.

Northern europe or northern US is still somewhat reasonable (just avoid Sweden).

but I'll get killed by turban heads for not being arab or liberals for not thinking i'm oppressed if I do that

I am sorry for the shitty code but this always breaks when I increase the limit of i == to a number proportional to n.

For example, if i is on any level higher than 4 when doing n = 5 iterations it goes out of bounds on the array and I just can't figure out why.

pastebin.com/xFkTU9VT

working on the midpoint displacement algorithm, and I'm pretty new to algorithms

This might be a stupid question but I'd appreciate some help.

I just picked up C and have been messing around with a couple things. I want to make a test based game where the user makes decisions and it changes the story depending on input.

My question is when I have a long bunch of text printed onto the screen, words get cut off at the end of the console and move to the next line halfway through the word, how do I stop this from happening?

(Pic related, ignore the interjection in a windows cmd).


#include
#include
#include "freedoms.h"

int main()
{

printf(FREE);

return 0;
}

Break the string at first space before line length with \n

Help me please

How would I enter a link into the highlighted text of this variable? I know how to do this in python, but I'm not familiar with HTML

Basically I want something like this
EXAMPLE LINK HERE (Basically the variable containing the code, and the link inserted into the middle)
To make my code look less messy/confusing

Thanks guys...

Creating a C function to get the next line off a file descriptor. Calling it in a while loop should get each line until the fd is done. I'm using a static list to keep track of the different fd's and respective buffer.

nvm solved it

Like I said, avoid Sweden.

lua sounds cute , what can I do with it?

not much

>openshit has some free tier level of hosting
>is not available in your country

Well shit, any other recommended hosts that has free tomcat? If paying is my only option left might as well learn aws

there is litterally nothing wrong with javascript.

...