/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1560953404180.jpg (480x640, 80K)

Other urls found in this thread:

braveclojure.com/
youtube.com/watch?v=nDm-QDEXGEA
en.wikipedia.org/wiki/List_of_hash_functions
youtube.com/watch?v=GcDshWmhF4A
projecteuler.net/archives
twitter.com/NSFWRedditVideo

Still working on getting actual Asteroids in my Asteroids game.

Thank you for posting an anime girl.

A-user, can we please just get to learning JavaScript together already?

Attached: D8D8H_yUcAAOlQI.jpg orig.jpg (1365x2048, 198K)

friendly reminder that the unabomber manifesto is a must-read for every programmer

>/dpt/
>nobody posts about their programs

Attached: 1554417091183.gif (200x234, 3.06M)

user, delete all your JavaScript projects.

Attached: 1561157984562.jpg (1536x2048, 586K)

sasuga

Lisp is the most powerful programming language.

Trying to figure out how the fuck do I decrypt this: hU/htW88ZU+WyyM32P6Tsw==

Wanna help?

except for...

you can use linear programming to help you buy the optimal amount of asteroids

base64

>What are you working on, Jow Forums?
dilating

This is going to be a dumb question but why is C the language of choice for virtually every kernel I see? We're not on machines that can only execute C, but on x86 machines that can only execute their specific machine code, so is there something preventing a kernel written in say, Haskell, Lisp, Forth, or something else, anything besides C really? Or another question slightly related: Why is an intermediate language such as assembly needed? Can we not implement lower level instructions in our more high-level languages?

Again, sorry for the stupidity, I've been reading the wikipedia articles on Assembly and Machine code but I just don't get why ASM is needed and why C seems required.

rust ... not even once

Attached: krabnik.png (1002x460, 438K)

It's not. It just seems like it is, but no base detector detects this, nor any of the well-known bases can actually give me a result to that

Lord Terry already constructed God's temple, there's nothing left for us to do than praise God and seek His guidance through entropic number generation. Everything is niggerlicious.

Attached: BJARNE_STROUSTRUP.png (270x270, 113K)

bad to worse

C is simple enough to map to machine instructions with minimal effort, so it's easy to bootstrap a new architecture and start porting a kernel over.

Explain to a dumbfuck like me the edit distance dynamic programming algorithm.

Yes I did google it I still didnt understand it.
No code just pseudocode and the logic behind it please

Attached: 1545416224504.jpg (216x234, 8K)

I would like to join in that explanation request, good sir

Attached: hmmmmm.png (619x619, 325K)

learning lisp (clojure) and my code looks... imperative. i just can't seem to figure this fn stuff out.

here's my data. i want to create a list with only the first column (the years)

1999 James Smith 7o348fj
2001 Joe Blogs 9df83f
1973 Jimmy Citizen 9438djf


here's the function. the like (def first-values (conj first-values (first row)))) just redefines the list variable. i'm not sure this is good lisp.

(defn take-first
"Take first value of each row and save to a vector"
[rows]
(def first-values [])
(doseq [row rows]
(def first-values (conj first-values (first row))))
first-values)

See the naive algorithm, try drawing the call tree, notice that many calls are repeated over and over, realize you can memoize the result of those calls, the end. The memoization technique doesn't matter, whether it's a 2d array or a hash table of tuples.

lookup other dynamic programming algorithms, see how they work (compared to their slower alternative), you'll get it after a while

>learning lisp (clojure)
*lisp dialect

Attached: 1561299316554.jpg (548x548, 64K)

Okay thanks now I know what Lisp-like languages are called. But can you help with the problem please?

if those were lists your code would just be
(map first rows)
I don't know clojure, there might be an equivalent for vectors or an iteration form like for/vector in racket.

>i'm not sure this is good
You're right.

Here's one way:
(vec (map first rows))
Here's another:
(mapv first rows)

Using def inside of a function is usually considered a hack.

Thanks this makes perfect sense. It's gonna take me a while to stop trying to solve everything with for loops.

Mostly because the kernels are intended to support Unix-like operating systems or because they were originally designed for PDP-11 machines (like the original Unix kernel). So C is a natural choice. No matter what, you'll have to use some assembly (whether inline or assembled separately and linked in), and every language worth considering can do one or the other or both.

Just in case you aren't learning from a book, let me point out that you should be. You're going to be thoroughly confused if you try to write Clojure without understanding the paradigm.

url safe base64

Assembly isn't fundamentally needed, though. A high level language could expose all the features needed to write a kernel, possibly through CPU intrinsics but maybe even with abstractions. i don't know of any that do this out of the box thoroughly enough to write a kernel in. Most high level languages don't do this at all, and only support user-mode features common to all target CPUs.

c + +
vscode
mozilla firefox

all you will ever need to be an efficient programmer.

There are people who learned without reading a book but I don't know how.

You need CMake and GCC

now this but C# and Ungoogled chromium

I'm learning from the docs on the clojure website... it their guide adequate?

C# is trash

Attached: Annotation 2019-06-24 083837.png (1204x948, 101K)

You can find good Clojure books on Amazon but this one also has a free online version:
braveclojure.com/

You might be able to learn from the Clojure website docs but if you haven't done functional programming before then I wouldn't.

Nope. As I said, already tried that. Seems like it is, but it isn't.
Either that or i'm too dumb to find the right way to do it.

Attached: sonin.png (295x295, 70K)

You really shouldn't do this if you don't have a grasp on functional programming.

Are you forced to learn Clojure specifically? It might help to have a little detour at Common Lisp and Touretskyz's book. It's fucking amazing, it literally makes you understand why you do certain things in lisp-like languages.

He doesn't need to learn CL to learn Clojure.

I love Gentle Intro! Fantastic introduction to programming

he doesn't but the book is so good at explaining programming concepts that it's worth it for that reason alone, it also explains how you do things in a functional style vs imperative style and the benefits and cons of them both

Hard to help because there is no context and I am too lazy to count bits and check for what hashing algorithms output that many bits.

Rest assured that any good Clojure book will cover functional programming style.

7 bytes, might be a DES key, need contet

What the fuck else is there to do in processing?

Attached: veiled.jpg (1089x1071, 306K)

Probably.
Sad state of affairs when Clojure is still the worst lisp out there and only used because of the JVM.

Nevermind I'm tarded. It's 16 bytes. I'll crack it for you for 1 satoshi.

[x@ssva s]$ echo -n "WeJcFMQ/8+8QJ/w0hHh+0g==" | base64 -d | xxd
00000000: 59e2 5c14 c43f f3ef 1027 fc34 8478 7ed2 Y.\..?...'.4.x~.

Clojure actually solves a number of longstanding issues with Lisp.
youtube.com/watch?v=nDm-QDEXGEA

Oops wrong output. I am reallly tarded.

[x@ssva s]$ echo -n "hU/htW88ZU+WyyM32P6Tsw==" | base64 -d | xxd
00000000: 854f e1b5 6f3c 654f 96cb 2337 d8fe 93b3 .O..o

To be honest, I also don't have any context. I only got that.
24 characters, 192 bits.

It's base 64 100% It's a hash using any hashing function that outputs 16 bytes (128 bits) en.wikipedia.org/wiki/List_of_hash_functions

You can try md5 using rockyou.txt and hashcat or john the ripper and see if you have a hit.

tl;dw?
Normally I'd tell you to eat shit but if there's a reason to learn Clojure i'll learn it for shits and giggles. Outside of the JVM reason, which is actually a downside for me lol

>"Learn lisp, user" 。°

Lisp is trash and died years ago.

If you only have that, then why are you interested in it? It could be just a random string of characters.

Go ahead and explain why Lisp is trash then lol

Attached: 1531220630081.jpg (900x844, 167K)

bool go = true;
while (go) { std::cout

decades ago, you mean

((((explain))))

A friend I might know tried about 150gb of wordlists on this and had no hits. Could be salted, hash of a file, or not md5.

>tl;dw
This. Sorry I can't summarize.

where did you get it?

I'm trying to get started with opencv and object detection, found some libs that perform detection and tracking but I've found very hard to understand all the models and machine learning bits, there's some library that gives me a x/y coordinate of a object based on a frame?

(e
(x
(p
(l
(a
(i
(n)))))))

Fixed.

https:github.com/Taberone/Cataclysm-DDA-Touhou-Mod
^How much C would I have to know to contribute to this?

Attached: __izayoi_sakuya_and_remilia_scarlet_touhou_drawn_by_yoruny__b3c56c62aa668c23c32c9469ec739305.jpg (2000x2000, 403K)

none, those are just JSON files.

Aight, so here's the deal. I'm learning the binary number system before I head to college.

I understand how to convert a natural number to a binary one, but how do I do the opposite? I mean, 0 is obviously 0. 1 is 1. 11 is 2. But after that I just get confused.

Attached: binary-0s-1s.jpg (300x301, 38K)

So besides C++ and HTML what are the most important/popular/plebian programs to learn?

Attached: Thinking anime dude pushing glasses.jpg (1280x720, 90K)

>11 is 2

Attached: dog.jpg (649x870, 92K)

I mean it ain't that complex my man

Haskell

Learn neither of those things first.

>0 is obviously 0. 1 is 1. 11 is 2.
0b11 is 3. 0b10 is 2

It probably isn't honestly, but for some reason my I'm just struggling to understand it right now. This happens sometimes, but when it clicks I know it for good.

Sorry, 10, right?

Did they never teach you expanded form at school?

123 = (1*10^2) + (2*10^1) + (3*10^0)

same with binary
1101 = (1*2^3) + (1*2^2) + (0*2^1) + (1*2^0)
or 13.

I have... For a while then i pretty much forgot the majority of what i learned, mostly from lack of practice

I mean I have heard python is pretty sought after

But how do we determine where to position the 0s and 1s? Unless it's literally just a game of alternating them as the number of digits increases?
E.g. 0, 1, 10, 11, 100, 101, etc.

Sorry, I'm really new to this. As in, I literally just started today.

Yeah because learning HTML is mostly fucking useless. And C++ is an experts language. What are you trying to program and why?

youtube.com/watch?v=GcDshWmhF4A

>What are you trying to program and why?
I'm trying to get hired my man

... what??? Is 123 the same number as 321?

0 = 0 = (0*2^0)
1 = 1 = (1*2^0)
2 = 10 = (1*2^1) + (0*2^0)
3 = 11 = (1*2^1) + (1*2^0)
4 = 100 = (1*2^2) + (0*2^1) + (0*2^0)

If you are counting, you add 1, just like normal. Binary numbers are just regular numbers in a different base, all the same rules apply.

If you mean what is the pattern of counting, it's just like adding 1

0 + 1 = 1
1 + 1 = 2 (you have to carry the two, just like carrying additions over 10, then subtract 2)
10 + 1 = 11
10 + 1 = 12 (carry, just like above) = 20 (and carry again) = 100

base 10
>0
>...
>9
>10
>...
>99
>100
>...
>999
>1000

base 2
>0
>1
>10
>11
>100
>...
>111
>1000
>...
>1111
>10000
>...
>11111
>100000
and so on. in base 10, you have to add a digit after 9, or 99, or 999, etc.. in base 2, you have to add a digit after 1, 11, 111, 1111 and so on.

Where? Doing what kind of programming? You don't learn HTML to get hired as an embedded systems engineer.

What are some websites that Jow Forums recommends that have programming problems/challenges? Preferably ones that allow you to submit your code to which is then checked for a pass/fail.
At the moment Java is the only language that I know.

It's my current objective, i'm a program engineer graduate but that's more than two years ago, since then i've been doing small time jobs and shit while i find a nice company to get hired in... Did an interview with Toyota recently and i realised I was out of practice for so long... Too long... most of the programming questions their expert asked me felt familiar but never really clicked so i kinda looked like a fool

Generate Github-like avaters with ansi colors

from random import choice,randint
c=randint(0,255);e='\x1b[0m'
def x():return choice([f'\x1b[48;5;{c}m ','\x1b[48;5;254m '])
print('\n'.join(['{a}{b}{c}{b}{a}{}'.format(e,a=x(),b=x(),c=x()) for _ in range(4)]))

working on an archive/container file format
I've got an implementation of the general structures working, but it's a mess right now, went through multiple revisions as I was writing it, needs some major cleanup and organization.

codeforces is the best one I can think of. it lets you know at which case you failed and every problem to be submitted needs to have a tutorial that might not give off the answer, but is the key for you to try it yourself, even if you're stuck in it. the site is actually used across the world by programming marathon competitors

this is another one with problems like that but I've never tried it myself projecteuler.net/archives

printf("hello, world!");
how am i doing so far?

no newline, no capitalization, no main function. Pretty good.

here's a run-able program
int puts(const char *s);

int main() {

puts("Hello, World!");

return 0;
}

no stdio either

you don't need it. see