/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

youtube.com/watch?v=X36ye-1x_HQ
medium.com/@devongovett/parcel-v1-5-0-released-source-maps-webassembly-rust-and-more-3a6385e43b95
gist.github.com/yurydelendik/4eeff8248aeb14ce763e
wasdk.github.io/WasmFiddle/
twitter.com/SFWRedditGifs

What's so great about Idris anyways?

Lisp

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

script that plays gifs of anime girls dancing to the bpm of currently playing track in mpc

It begins:
medium.com/@devongovett/parcel-v1-5-0-released-source-maps-webassembly-rust-and-more-3a6385e43b95

Rust now compiles properly to webassembly, so every rust user can now be made fun of as a webdev.

c++ is the greatest language of all time

gist.github.com/yurydelendik/4eeff8248aeb14ce763e

Educate yourself.

>spends literally 30 minutes transposing a vector using type level naturals
You can do this in Haskell without dependent types. This barely touches on stuff dependent types can do. I was sold on the Idris meme but when I switched to Agda I realized that I had barely scratched the surface on dependent types. Idris is literally dependent types for brainlets

Why is it that the Rust haters are technologically uninformed?
wasdk.github.io/WasmFiddle/

New crypto algorithm based on pi and dynamic domain using github.

Is the most powerful programming language

Behold some of the worst working code I've ever written. I feel dirty.

So to explain what this code does, suppose you have a molecule with atoms at ((0 0) (0 1)) bonding with two molecules, ((0 9) (1 9)) and ((29 0)), on a 10 by 10 grid with the edges connected. This program modifies those two molecules to be at ((0 -1) (1 -1)) and ((-1 0)).

me too

How do you calculate bpm? Or I suppose more interestingly, what's your criteria for determining a beat?

what? you just proved his point.
>rust compiles to wasm
>provide example of wasm project generated from rust source

>>rust compiles to wasm
LLVM*

>call/cc
>apply
>5000 collumn line
Yeah I'm not even going to try understand how this is supposed to work. Rewrite it

I like that image for a reason I don't understand.

Also explain your pi crypto, if you're thinking of using an IV as an offset and using pi as a stream cipher it's not practical at all, and there's no way to make a stream cipher practical with a static stream.

Is designing/defining a protocol/spec just basically outlining all the assumptions? Like saying "a message header is this many bytes in size and contains these types at these offsets which each mean these things" and "when you send a message of this type, the server expects this to happen next". Obviously in more formal writing but is that basically it?

I want to make a client and server reference that people can re-implement themselves if they so choose while maintaining interop between them. The problem is I've never released such a thing before, I have an implementation of both that work, but everything is more or less arbitrarily defined by me so I figure I'd need to write up how communication is expected to be handled. I'm not used to such a level of freedom so it's left me wondering if this is actually how people do things. Write an implementation, revise it, write up details about how to make your own thing to communicate with other ones of these.

do want

ok I'll give you that.
(That was implied, however. I've known that rustc uses LLVM as its backend IR. Hence, emitting WASM opcodes is trivial?)

there are already a bunch of programs to calculate bpms of mp3s hence a script not a program

as for how
idk fourier transform??

Wait till you get to Coq, agda is for brainlets in comparison.

Yeah, it's basically it from your standpoint as the original designer.

Although for any real protocol, to be implemented by several people, and to have a good doc to tell people how to implement properly and securely you need peer review from other engineers.

The RFCs are the best example of how to go about that. It's basically what you're getting at in your train of thought.

My body is not ready

>there are already a bunch of programs to calculate bpms of mp3s hence a script not a program

???????????????????????

it's horrible for a reason, and that reason isn't one apply. What's wrong with apply? How else are you going to average a list or flatten a list of lists? Fold? Pfff ha.

Read some existing specs. The RFC(s) for IRC are pretty straightforward, albiet containing some nasty BNFs to describe the message format

REPLY IF YOU ARE A VHDL PROGRAMMER

thanks

Come join is in our temple. We'll show you the secrets of Ltac.

I tend to work on a chair.

Daily reminder that kiddos fagging around in easymodo languages with no foundation in assembly and computer science fundamentals aren't and never will be real programmers.

Thanks for the information. All I have are cute images to return. I'll look into IRC's RFC to get a better feel for it. As for peer review, hopefully someone will complain when it's published and I'll learn something, in the meantime I can hide behind a "protocol not finalized" banner.

The RFCs go way beyond IRC, almost any open internet protocol goes through the IETF standardization nowadays(or at least for the past 25 years, although it predates that). They also get revised when a flaw is found and just makes for the perfect specs.

IETF best specs. Try implementing some IEEE shit to see the difference.

Don't have to settle for IRC, IRC is a shit protocol. Pick almost anything you want, http, ftp, tftp, ssh, tls, tcp, ip, icmp, etc, etc... there's an RFC for it.

Daily reminder that fags like this don't actually program anything more than their assignments.

I know there's more I just figured I'd heard people say IRC is simple before so I figured that might not be a bad starting point, I might look into FTP, TCP, and probably others as well, at least skim them, not enough to implement them myself, just to see how it's normally defined lexical/literally.

It's really simple. I implemented an ircbot in 6th grade without knowing what an array was.

I'll admit it's an an easy protocol to use, like HTTP, mostly because it's text based and isn't convoluted shit like XMPP(XML streams).

It doesn't really reflect most internet protocols though. It depends on what he's implementing but based on the original post:

>a message header is this many bytes in size and contains these types at these offsets which each mean these things
It's not that kind of protocol, meant to be easy to use by everybody and their grandmother. The way described sounds more like a file format but it's closer to a regular internet protocol than IRC or HTTP.

>How do you calculate bpm? Or I suppose more interestingly, what's your criteria for determining a beat?
the usual way to do it is via autocorrelation. basically you multiply the signal by a shifted (and sometimes reversed) copy of itself, then integrate. the integral is greatest when the shift is a multiple of the beat.

I want to make a class to write configuration files for my application, is fstream the best base class for that?

I should add: the first step of autocorrelation is a convolution so we can use FFTs to speed up our algorithm using the convolution theorem .

So Sup Forums, how nice do you make your CLI programs?

Daily reminder that working on higher layers of abstraction doesn't separate you from programming.

Implementing modulo congruence in Agda.

module Modulo (n : a) where

{- Relation for congruence modulo n
- in math: "if there exists some 'q' s.t. 'qn+x=y', then 'x=y mod n'" -}
infix 4 _≋_
data _≋_ : Rel a Level.zero where
eqv : ∀ {x y} q → (q * n + x ≡ y) → (x ≋ y)

module _ where
open PE.≡-Reasoning

{- Setoid properties: reflexive, symmetric, transitive -}
mrefl : Reflexive _≋_
mrefl = eqv (+ 0) (IntProp.+-identityˡ _)

mtrans : Transitive _≋_
mtrans {x} {y} {z} (eqv p p*n+x=y) (eqv q q*n+y=z) = eqv (q + p)
$ begin
(q + p) * n + x ≡⟨ solve 4 (λ q p n x → (q :+ p) :* n :+ x
:= q :* n :+ (p :* n :+ x))
refl q p n x ⟩
q * n + (p * n + x) ≡⟨ cong (λ i → q * n + i) p*n+x=y ⟩
q * n + y ≡⟨ q*n+y=z ⟩
z ∎


EqReasoning is really so fascinating. The RingSolver is really neat too, although it usually ends up a mess of symbols

Oh wow, Sup Forums converted my double-struck Z's into "a"

Now you can solve fizzbuzz

This seems really complicated, what's the usefulness?

I just use getopt. No matter how nice I make it, nobody since the early 90s will use a prompt based interface.

TUI(e.g. ncurses) is different, a REPL is different, a program that prompts for input has very few use cases.

lolol

You can make a function that requires all its inputs to be modulo-equivalent, for example.

weeeeeeeeee yippie

hes probably building himself up to a fizzbuzz.

curses or a curses binding library and an argument parser library

I need to implement decidability first, then I will finally be able to write fizzbuzz. Surely they'll hire me

It lets me do proofs that involve modulo. I'm going to hopefully use it to prove that a particular DFA works as advertised, since I got stuck without a proper modulo relation.

I mean, yeah, I'm not arguing that.

Most of the assignments I'm given are prompt based though.

Just had a conversation with a guy who claimed dynamically typed languages only have one type. He seemed to believe that runtime types don't count as types, only types checked on compilation.

What do you guys think?

>What do you guys think?
c++ is the greatest language of all time.

Sepples is garbage, learn rust

Rust is shit, learn D

he's wrong, just look at lisps

>assignments
Yeah, that's pretty much where it's used.

If you're teaching X language, you don't want to bring the shell into your course. When you bring the shell into it, you have add a bunch of shit to your tutorial about the different OSs and their shells, and how to run programs with command line arguments and a bunch of stuff first year college students who have never used a terminal need to learn on top of your language.

So you use stdin/stdout as an interface, it works fine for assignments but it's terrible as an interface for anybody trying to use your program for any practical purpose. Imagine for a moment if ls/dir worked like this:

$ ls
>what directory do you want to ls?: /
/bin /boot /dev /etc ...
>Thank you for use 'ls'
$

Lisp does not have compile time type checking. He would consider that as having only one type. How is lisp an exception here?

My symmetry relation is kind of messy, I wonder if any of you could find a better way to do it. Initially we have:
qn + x = y
and we want to show that there is some "p" such that
pn + y = x

I've chosen p = -q, and proved it like this:
qn + x = y
-(qn + x) = -y
(x + y) - (qn + x) = (x + y) - y
(x - x) + (y - qn) = x + (y - y)
0 + y - qn = x + 0
(-q)n + y = x

These transformations are difficult to do manually so I've shipped it off to the solver, but I feel like I should be able to find some solution that is easier to prove.

Types exist in the runtime implementation, and they are a useful mental model when reasoning about programs you write, so I would definitely not discount them. Not that there is any point to such a semantic argument

Is there any benefit to one's professional career to even learn non mainstream langages? like nim/crystal and such?

Coq-tan is cute

If being a hipster is more important than money.

How do my fellow wagecucks find the motivation to program after a day of wagecucking?

practice isn't a thing of motivation, you just force yourself to do it

Purpose of acquiring a skill is to capitalize on it unless you consider it a hobby. If something become your work it's no longer a hobby.

Point is you can't just code all the time.

Rich NEET reporting.

looking for some advice here, I have some basic programming knowledge in c++/java(like CS101 and CS102 stuff) I have some free time at nights and want to learn some mobile developing / make some basic apps/games. Wheres the best place to go about this? I was thinking of spending like 50 bucks on some packages from stacksocial but heard that it kind of sucks. I also heard about nanodegree courses on udacity? any tips or recommendations?

never gonna make it

I certainly enjoy it more than my job, and nothing has been more rewarding or challenging in a way that I find satisfying than the select few times I've racked my brain hard enough to solve an issue that I was having in a programming project.

I just can't get over the feeling that I'm wasting my time and that I'll never make it as a developer.
What are some good strategies that you use to force yourself to do things?
Teach me you secrets oh wise one.

Don't have to program a lot. I do, but every now and then I'll just take a week or two, do some other things.

There are lot's of other fun things to do and if you don't have anything specific you want to get down, who cares?

>secrets
rich was an exaggeration, I just used to be a drunken druggy who got lucky as fuck and won about $650,000.

Now I'm a NEET drunk whose living on that money.

I feel bad whenever I drink or do drugs because I feel as though I'm too dumb to program once I'm intoxicated
I do have to program a lot though, I completely fucked up high school and need to sort myself out.

None of my other hobbies have anywhere near the prospects that this one has so I'm determined to stick with it.

/wdg/ question

how do I get a newline break to display in html from a javascript string?

like I have my string in html5 here:


Tracklist:


and Im setting it from my script.js here:

$("#tracklist").text("this text appears on the html page);

but how do I get a newline to appear on the html page? I want to be able to send the html a string with multiple breaks, ive tried setting tracklist to strings like:

" line 1 \n line 2 \n line 3 "
" line 1
line 2
line 3 "
" line 1 line 2 line 3 "


but none of these work, any ideas?

>too dumb to program once I'm intoxicated
You kinda need to seperate this stuff. I'm not saying to become an alcoholic or a crackhead, but if you enjoy having a drink every once in a while, you don't need to write your entire codebase in that time.

Relax, don't bother with work. Just watch anime or something.

Kek, your friend is retarded.

learning (as in truly understanding) the design and syntax of a new language can help you develop mental models about novel or even existing problems.

I work at Lil Caesar's lad, I really need all the free time I can get to better myself so that I don't have to fester in the service industry until I die.

should work though, if you have no elements inside your span your could also which will make newlines work as non-whitespace.

If your lines are an actual list, you could use an actual HTML list.

it just displays
inline, Im setting tracklist in javascript like so:


var tl = "1. bungo - 0:00 - 8:52";
tl = tl + "
"
tl = tl + "2. tungi";

$("#tracklist").text(tl);


and again my html is setup like so:


Tracklist:

but when I load my index.html in chrome it displays the tracklist as so:

Tracklist: 1. bungo - 0:00 - 8:52
2. tungi

You need to use $("#element-id").html(...) instead of $("#element-id").text(...) else JQuery will treat it as a screen and do escaping on the input.

Alright then, do your best. Although if you never stop and have even a bit of fun you'll become even more bitter than the 40 year olds browsing /r9k/.

Fun doesn't have to be getting drunk, if you enjoy programming that can be your fun. Take a break from it anyway, learn something different as a change of pace.

I'll be honest with you, I've never used jquery and haven't touched HTML or javascript in about 10 years.

Maybe jquery does this thing by itself, the .text() part seems to imply your not injecting HTML. Maybe you should of asked /wdg/.

thx

So i made a couple of utility android apps but just publishing them on the store does nothing. there is so much bloat on the store than in like two mounts i got 10 downloads total even though the apps are free and i think many more people would use them if they knew they exist
is there like some huge dev forum where i can semishill them?

please respond

it ignores the folder itself or just shit inside

Because you enjoy learning a new language? You never know where it may take you; you could get a job programming in the language because few people know the language.

I get motivation because I enjoy working on projects I made myself more than doing a project that is asked of me.

>git rerere
>git worktree
I consider myself very experienced with git, yet I'm always surprised by how much I still have never heard about.

>try to link a library
>gcc "cannot find" it
>somehow works after the 20th try

Use pkg-config, idiot.

.>Is there any benefit to one's professional career
probably none

I agree, we're all going to die in the end.

Why is C so shit lads

If you feel like wasting time on needless performance

So user, what's in your pipeline today? Any troubles with your user stories?

Can I sit down please? I weight 300 pounds and my legs hurt and swell really bad when i stand for longer than 30 seconds