/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

sarahmei.com/blog/2014/07/15/programming-is-not-math/
redmonk.com/sogrady/2017/03/17/language-rankings-1-17/
twitter.com/SFWRedditGifs

"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman

...

>Richard Stallman
Started reading right there

>Richard Stallman
stopped reading right there, "mate".

Two retards in a pod.

>(((lisp)))

>stopped
started*

What a badass

anime website

sarahmei.com/blog/2014/07/15/programming-is-not-math/
haha, /dpt/ btfo

>/blog/
Ain't clicking.

who claims otherwise?

every single person who even pretends to be sentient

Excuse me?

>I'm a Ruby & JavaScript developer based in San Francisco.
Oh I see. This is a a joke blog.

redmonk.com/sogrady/2017/03/17/language-rankings-1-17/

New Redmonk language rankings, for anyone who's into the whole following fads meme.

Rust is growing crazy fast. R seems to have stabilized. Scala is the 11th biggest language. Swift has almost overtaken objective-C.

>pretends
yeah I guess so

>theorem proving isn't math

RMS is a retarded faggot and list is for retarded faggots.

What is list, user?

so javascript, huh

A webdev language.

Wait, Rust has more Github repos than Haskell already?

Show me this list, user. I've never heard of it!

*Pull requests.

I have it installed on my computer machine. Wanna come over so we can laugh at it together?

>Swift has almost overtaken objective-C
Well, isn't Swift a next version of ObjC?

I'm not supposed to laugh with strangers.

Programming is only theorem proving under the right conditions.

Based Rust

For my master's thesis, I wrote software that is basically "reverse character recognition". You'd type a phrase or word and it would generate handwriting for it organically from a sample. If I took a photo or scan of a letter someone wrote, I could "steal" their penmanship and doctor documents in their writing. The algorithm would organically write it in that style, though, so two "L" wouldn't be identical to give an idea.

Should I post this online or am I opening a jar of worms?

do it

Best book for learning Python3/OOP?

I can script a bit in JS but want to get away from web dev.

Practical Common Lisp

Does type declaration impact performance in a big way?

Say I have a value which can be any whole number from -1 to 1 (basically only 3 possible values). What type should I initialize this as?

(declare (type (integer -1 1) your-variable))

My understanding from my work in assembly is that byte/short/int all have comparable performance, and the signed versions are identical to the unsigned in performance.

how can you not post it online? it's usually a requirement by the university

Design specification is online but not source code.

i am making a programming that can crack monolithic ciphers

you're trying to you mean

Rust will level off and start declining within the next few months. It will be forgotten in a year. Learn Ada.

what are you trying to argue

Ada will level off and stop existing within the next few months. It will be forgotten in a year. Learn Rust.

I dunno if it's convention to use only types necessary or if larger-than-needed ones are okay, too.

Consider a basic loop:

for (int i = 0; i < 10; i++) {
...
}

Would the below be any faster/efficient?

for (unsigned short int i; i < 10; i++) {
...
}

the bottom one is undefined behavior

>Would the below be any faster/efficient?
Considering integer promotions, I doubt it.

Ada is dead. Learn Chapel instead.

>know C++, C, Java, Lua (not counting web languages like PHP, HTML, JS, JSON, etc)
>want to learn something else
>concentration of my studies has been computer vision/sound manipulation/image manipulation

What's a good language for me? I've been using C++ for everything.

So I'm stuck again, (Cfag beginner).
I am not sure how to approach this error, again it is related to memory allocation.

I was using
malloc(sizeof(argv[1])
because I'm (probably falsely) assuming that is the size of the file, and that it will be a large enough buffer to read the whole file char by char

What is the best algorithms textbook?

CLRS or Skiena's Algorithm Design Manual?

Skiena is what you read before you read CLRS.

Rust is way faster than both Ada and Chapel.

Can you explain to me the appeal of having an anime girl visible at all times?

whats ur colorway bro, looks cool.

also i feel that i should be reallocing

Go for it. There are already publicly available handwriting synthesis programs.

excepting , the one below would not be faster or more efficient because the only difference between signed/unsigned numbers is how values above the half way point are interpreted.

tl;dr signed and unsigned operations mostly do exactly the same thing, with a few exceptions

I made it myself it took like 4 hours, because i fucking suck at computers

>can't make a dynamically sized array in C

why even use this piece of shit language

use perl then

realloc

is it really that hard to write a simple vector implementation?

MatLab?

Am a lawyer...

>why even use this piece of shit language
No one uses C

$a = "b";
$b = "c";
$c = "a";
echo $a; // b
echo $$a; // c
echo $$$a; // a
echo $$$$a; // b
echo $$$$$a; // c
echo $$$$$$a; // a
...

Why is this allowed?

Is it possible to write a vector implementation that is reusable for any type in C?

I found it out yesterday. So glad I stayed out of autismal languages

C99?

enum

I just use ms word and like to read /g

Will Dlang ever become popular?

Ada is slower than rust on that website for two reasons
1) 2 year old compiler
2) no one's bothered to update to recent rule changes

I'm kinda curious what the outline of the algo is. If only given a single letter, presumably you would build an alphabet of average intensities per character, and interpolate (somehow?) any character not found during the scan. Do you label characters in the letter by hand, or use some learned model? For the second phase, when you 'type' a document, you could look up your character in the built alphabet and add noise in the form of small rotations/translations and modify pixel intensities based on some weight. If you had a huge amount of data you could use some generative model as well.

CL-USER> (defparameter *cycle* '#1=("b" "c" "a" . #1#))
*CYCLE*
CL-USER> (pop *cycle*)
"b"
CL-USER> (pop *cycle*)
"c"
CL-USER> (pop *cycle*)
"a"
CL-USER> (pop *cycle*)
"b"
CL-USER> (pop *cycle*)
"c"
CL-USER> (pop *cycle*)
"a"

Common Lisp.

gcc is able to stack-allocate dynamic arrays.

you guys could make fun of me some more

>sizeof(argv[1])
You're taking the size of a pointer.

how do i get the file itself? or how should i go about taking reallocing

Isn't that what malloc and realloc are for?

aren't you supposed to typecast malloc because it returns a void pointer?

No, Casting malloc is stupid,
void * conversions are already guaranteed in C.

Thanks for the name. Good resource by Skiena.

"t is traditional for the author to magnanimously accept the blame for whatever deficiencies remain. I
don't. Any errors, deficiencies, or problems in this book are somebody else's fault, but I would appreciate
knowing about them so as to determine who is to blame. "

Casting malloc is very good. I don't care if devs already know what type it involves. It's good practice because it makes clean readable code.

>clean readable code
you realize this is about C right?

I know. I always cast malloc.

>He didn't use a Pre-ANSI compiler
Embarrassing

Should I get SICP or wait until I have considerably more programming experience? Any math textbooks I should add?

>math
>programming
?

>Any math textbooks I should add?
Maybe add some liberal arts book too while you are on that

Just download it for free, and see if you like it. Then if you're so inclined, buy it.

my teacher in college said you don't need complicated languages to accomplish most computer problems
ever since then i've been using basic as my main language
120 RESTORE 510 : ST$=""
130 FOR I = 1 TO 32
140 READ D : ST$=ST$+CHR$(D)
150 NEXT
160 '
170 SCREEN 2,2:COLOR 15,4,1 : CLS
180 DRAW "S4A0 BM160,191 C1"
190 DRAW "M160,178 M170,170 M207,170"
200 DRAW "M207,158 M216,152 M224,158"
210 DRAW "M224,170 M234,178 M234,191"
220 DRAW "BM216,152 M216,140"
230 DRAW "BM212,146 M220,146"
240 PAINT (216,160),1
250 LINE (212,160)-(218,168),8,BF
260 '
270 FOR I=1 TO 200
280 X=INT(RND(1)*32)*8
290 Y=INT(RND(1)*RND(1)*96)*2
300 C=INT(RND(1)*14)+2
310 PSET (X,Y),C
320 NEXT I
330 REM
340 CIRCLE (75,80),8,11 : PAINT (75,80),11
350 REM
360 SPRITE$(0)=ST$
370 IF RND(1)

>t. Little Babies

>t. CS toddler

CS babby pls

>math text books I should add
wtf

I'm sorry, I was under the impression that a knowledge of higher math was fundamental in good programs.

If you have taken math in high school you are set