/dpt/ - Daily Programming Thread

Merry Christmas /dpt/, what are you working on?

Last thread:

Attached: merry christmas.webm (1280x720, 2.99M)

Other urls found in this thread:

thread-puller.ga
news.ycombinator.com/item?id=18716340
tools.ietf.org/html/rfc2616#section-10.2.7
stackoverflow.com/questions/8293687/sample-http-range-request-session
en.wikipedia.org/wiki/Diamond-square_algorithm
en.wikipedia.org/wiki/Perlin_noise
pcg.wikidot.com
twitter.com/NSFWRedditGif

Lisp is the most powerful programming language.

no haskell

An ASP.NET Core personal project

Attached: ASP.NET-Core-Logo-blue.png (735x250, 8K)

Rust is the most powerful systems programming language.

some personal web app project written using elixir phoenix

How do you like Ruby for Erlang VM?

What's a good android app I can make to add to my resume?

Attached: 15042906320_1e66a51287_b.jpg (683x1024, 304K)

How are you finding elixir/phoenix? Is it worth learning?

No. Ada is.

Ada is a piece of shit, stop being a US government shill.

Merry Christmas Jow Forums!!

Attached: 6a1762a2-f29c-4830-a59b-a15e7bd939ed.png (540x810, 581K)

Cobbled together thread-puller.ga so I can browse the vast array of porn and ylyl threads easier

Parts of your website are not appropriate for 4channel.

Merry Christmas Cap'n user

Attached: 1545467907117.jpg (404x467, 40K)

You idiots need to stop getting newbies to learn Python. Oberon needs to be the first language a newbie learns.

Why not Lisp?

Java was my first.

Attached: sonic_r_1_1_image.jpg (600x600, 275K)

dumb namefag posters

Is the disclaimer good enough?

I don't see any disclaimer other than your abuse of cookies. Right now your site is in violation of several laws offering porn content without an age check.

Why do 3D pig think they can match beautiful 2D? Disgusting cosplayer.

Everyone's getting ready for a big Christmas lunch, people keep talking to me about shit i don't care. All I want to do is slip away and implement the changes I just scribbled on a napkin.

out = std::dynamic_pointer_cast(components.find(*ptag)->second)->pos;
welcome to the readable world of modern c++

*tips virginity*

A disclaimer should've popped up when first clicking on a [NSFW] section

Okay, I see it now. As a suggestion maybe make a way to filter between SFW and NSFW. Also I hope you don't actually save Jow Forums data to your servers as you can be at risk of storing illegal content if you catch my drift.

/dpt/ xmas challenge, easy one so that even new programmers can participate or if you want to show off your meme language.

Generate a tree n high, you can decorate it if you want.

*
***
*****
*******
*********
***********
*************

I don't take part in jewish traditions, sorry.

that's haram sorry

Fuck off and stop being a faggot cuck

Can you please not violate the rules.

Yeah, nope, it's a transparent proxy basically. I only store post metadata (title, link to file, etc.) in memory for a couple seconds cuz caching is good.

As for the filter, the only place that is actually labelled as sfw/nsfw are the links to the main boards. I can add a "show nsfw" button on the top but that's about it.

(define (tree-gen n m)
(if (= n m)
'() ;'
(cons (string-append (make-string (- m n) #\space)
(make-string (+ 1 (* n 2)) #\*))
(tree-gen (+ 1 n) m))))

(define (tree n)
(for-each displayln (tree-gen 0 n)))

I started using Rust a few months ago and I'm legitimately interested on why /gl hates it. Is it the language itself, or just the (legitimate) issues of it getting shilled everywhere and the SJW association?

This is a christian programming thread.

Attached: 1545702433326.jpg (720x514, 51K)

uglier than C++
micro packages for everything
BC isn't fully thought out.
And yeah, the zerg cultist shilling, rust zealots refusing to acknowledge faults and politics also don't help

Can you? Ironic shitposting is against the rules too.

4channel has no religion. Are you speaking of Jow Forums?

A "programmer" who has no fucking idea about memory latencies is not any better than a doctor who believes that distilled water with sugar can cure anything.

Look, you're a puny little code monkey at most. You're not qualified to judge what programmers must know.

t. Cnile who thinks his toy program in C is going to be any faster than in X language

>memory latencies
lmao who cares

I created C++.

Look at this brain-dead ignorant worthless webshit who has no fucking idea of how to ensure cache locality with the managed languages.

You speak like that's some bragging point.

I hate the incompetent scum of all walks of life. It so happens that most of the web "developers" are utterly incompetent.

i'd bet money on the fact you've never programmed anything where cache locality matters

I just made this and wondering how to make it run quicker or more efficient. Feels like too many imports for such little code desu

Attached: Screenshot_2018-12-25_06-50-05.png (1366x768, 93K)

I've never really used Ruby, just kinda seen it. Mostly a python coder. Erlang is great, the most powerful language I've used. Even more so than Lisp.

Yeah it's worth learning. The concurrency model is amazing, the language feels like an operating system. I've done things with Elixir that I just can't do with Python like when I'm working with message passing processes.

Data hazards in microcode are much more important, though. How are you going to unleash the full power of pipeline and SSE without performing dataflow analysis?

Does anybody here have the Pluralsight course on Ada 2012? Asking for a friend.

Attached: ada2012png-black[1].png (280x250, 11K)

defmodule Tree do
def draw(n), do: draw(n, 0) |> Enum.join("\n") |> IO.puts
defp draw(n, m) when n - 1 == m, do: [ String.duplicate("*", 2 * m + 1) ]
defp draw(n, m), do: [ String.duplicate(" ", n - m - 1) String.duplicate("*", 2 * m + 1) ] ++ draw(n, m + 1)
end
/code]

No but there's a bunch of ada resources news.ycombinator.com/item?id=18716340

Elixir/Erlang is great until you need to break open the obfuscated C OTP libraries to debug something like Discord had to do. For a medium-large sized site though it will run without failure no problem and the genserver abstractions and stuff are dead simple to figure out and use.

This, you would be better off writing proofs in Coq and outputting OCaml or Scheme code (or verified C) than you would writing anything in Ada.
If you're just going to use contracts, use JML and write a java program there's no difference

I doubt it.
People in aerospace use Ada, and when they don't (F35), results are hilarious.

> have senior project class next semester
> can't think of any project ideas

Can /dpt/ give some suggestions of what my partner and I could work on? He is interested in neural networks, and I am interested in computer networks.

void space(size_t n)
{
for (size_t i = 0; i < n; i++)
putchar(' ');
}

void row(size_t n)
{
if (n == 1)
putchar('X');
else {
for (size_t i = 0; i < n; i++)
putchar(rand() % 10 < 2 ? 'O' : '*');
}
}

int main()
{
const size_t n = 12;

for (size_t i = 0; i < n + 1; i++) {
space(n - i);
row(i * 2 + 1);
putchar('\n');
}

space((n * 2 - 2) / 2);
puts("| |");

return 0;
}

X
***
*****
*O**O**
*O***O***
*O*********
***O***O*****
*O**OO***O*O***
****************O
*******O***O*******
**O***O******OO*O****
O*O**OO**************O*
***O***O******OO*****OO*O
| |

Im writing my own HTTP server in rust and I cant figure out how partial content works in HTTP.

The problem is that video seeking just doesn't work.On Firefox, it just downloads the entire video ,regardless. On chrome, the browser just disables video seeking completely.

When I seek the video, I expect that I should get a GET request with a byte range in the header ,but both firefox and chrome just stay silent and continue downloading.

Heres how I respond to the browser currently:
HTTP/1.1 200 OK \r\n\r\n [binary video ]

I should probably respond with http:1.1 206 but when i do that the browser straight up rejects the video.

def tree(n)
width = 2*n+1
0.upto(n) { |i| puts ('*' * (2*i+1)).center(width) }
end


very festive

Don't write it based on how Firefox and chrome acts, Neither follows the standards properly.

>I cant figure out how partial content works in HTTP
have you read this?
tools.ietf.org/html/rfc2616#section-10.2.7

just use a library lad, webdev is hell.

Yeah I've skimmed that. I'm personally finding the spec hard to read. That's why i've been writing code based on how the browsers act, but clearly, like says, thats the wrong way of doing things.

I've mostly been looking for a concrete example of how this should work.

Actually I think i've found one!
for anyone who is interested:
stackoverflow.com/questions/8293687/sample-http-range-request-session

can't wait to try this out.

>writing an HTTP server
>too dumb to read the RFC
I'm sure it will great, keep at it.

wheres your http server then?

Never made one, have made an HTTP client library before though. Was able to read that document just fine.

After two weeks I've concluded that interacting with a female is highly non-productive for my programming. It's also very expensive too.

I do not want to discontinue my efforts on my projects but at the same time I do not want to die alone as an old man. What solution is more optimal?
I've been thinking off'ing myself at the age of 50 as a solution. Thoughts?

Attached: 1544409177373.png (636x773, 14K)

Should I use Intel or AT&T syntax?

intel

>c is not safe
>c++ is not safe + objects
what do i use? go? rust? i've never heard people discuss dlang; how good is that?

Attached: [Doremi].Chuunibyou.demo.Koi.ga.Shitai!.Movie.Take.On.Me.[1920x1080].[Blu-ray].[2BB3C549].mkv_snapsh (617x986, 869K)

>I've been thinking off'ing myself
that would be highly non-productive for your programming

is there anything better than pycharm?
asking as a beginner

pic not related

Attached: 1538263442038.webm (450x598, 2.83M)

Why don't you use it first?

For safety rust. You can still do stuff that'll leak etc but you have to really go out of your way

Attached: 820ygwt4sb621.jpg (824x1168, 92K)

i'm not adventurous but i've been seriously contemplating it. i mean gcc now has frontend for it and everything. even llvm does, i think. i guess i could go with it to be hip and cool n shit.

u can make sick beats in lisp (using nyquist) i guess

I'd just like to interject for a moment. What you're referring to as picture, is in fact, video, or as I've recently taken to calling it, motion pictures.

Pick the IDE/editor you're most comfortable with. If PyCharm works for you, stick with that.

for personal use i'd stick with text editor since ides hold your hand and you learn nothing.

i have no idea how to do this. i fucking hate programming so god damn much.

thanks for ruining my christmas Jow Forums

trim = reverse . dropWhile (== ' ') . reverse . dropWhile (== ' ')

My mom thinks I'm special :-3

I wasn't sure whether to ask here or /agdg/ but /agdg/ seem like retards when it comes to program. Does anyone know anything about procedural generated worlds? I have no idea how to even begin.

if your game is using procedurally generated anything its trash no exceptions

Disagree, there are lots of nice games that use procedurally generated things.

Attached: 1482592556181.jpg (2219x2036, 883K)

Anything I make will be trash. Now answer my question.

Smooth

I have only a rudimentary understanding in proc gen but hopefully better than nothing. Depends on what you need, but there are a couple of most commonly used algos for this. Let's take a 2d cell based world as a nexample. You can use a method like en.wikipedia.org/wiki/Diamond-square_algorithm or en.wikipedia.org/wiki/Perlin_noise

Generally you might also want to combine multiple methods at multiple levels, like maybe noise for larger scale and then interpolate for lower scale, try these out yourself for best results.

For the diamond square, you'll need to keep in mind that it's a fractal interpolative method, which means it doesn't take into account all of the cells at any time, only the ones it uses to interpolate. which means that if you want to put a mountain in a generally rough terrain you'll need to add the mountain after you do your basic terrain.
Perlin noise on the other hand depends on iterating a function a bunch of times to make the output contiguous.

tl;dr some algorithms may be better for different scales, write a program to output a result quickly so you can see the results of your modifications to the algorithms, experiment a lot, while thinking about how you can get the output closer to your desired one.

Attached: cf8.gif (259x279, 191K)

>I started using Rust a few months ago and I'm legitimately interested on why /gl hates it
Hi Rust shill. It's literally always this line. "Why u no like Rust". Why is it shilled everywhere?

pcg.wikidot.com

The borrow checker is too coarse and rustfags treat it like the fucking holy word or something.

Planning on creating a fairly basic REST API using Python.
Is Flask+Connexion and an OpenAPI schema a good setup? Is using the OpenAPI standard considered a good way of designing APIs?

Attached: 1520620505920.png (1064x952, 106K)

nth for browsers will become virtual OS's in the next 10 years

tbf, they're improving it now. You can now borrow after a mutable borrow is not used anymore instead of not being able to use it in the entire scope

>Is Flask+Connexion and an OpenAPI schema a good setup?
are you one of those people who prefer writing endless XML files in some weird DSL/configuration language over just writing a couple of lines of java code? if so, you will love it
its very documentation heavy work for unclear benefit
flask however is great

god jul!

Attached: julgransbash.png (1080x1920, 246K)

Am aware. Will try out again once NLL is completed.

Not exactly programming, but certainly job related.

I got a consulting job and they do fucking video conferencing. How does an ugly introvert make it in the world where even code monkeys need to be beautiful to be listened to?

Fuck me never in my life did I think it would come to this.

I work remotely and have to occasionally do video conference stuff.
I look dishevelled as fuck most of the time (I rarely shave, because I can't be bothered) and nobody really seems to care.

If I were a guy that would work. Salon-nail Barbie doesn't trust the likes of me. Sucks.