/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Old thread:

Attached: 8LIs.gif (450x258, 2.34M)

Other urls found in this thread:

gamasutra.com/blogs/LarsDoucet/20130603/193491/BazaarBot_An_OpenSource_Economics_Engine.php
github.com/deeppomf/DeepMindBreak)
imgur.com/a/tyjKay9
sluglibrary.com/
pastebin.com/5SfK3Pqv
github.com/davidfregoli
twitter.com/SFWRedditGifs

>inb4 this is a duplicate thread
Wrong. The other current /dpt/ clearly identifies itself as the dependently-typed programming thread, not the daily programming thread. These are clearly two different generals, and frankly the other should have been called /dtpt/, not /dpt/, since there was already a /dpt/. Discussions about programming in general belong here, while discussions about, for example, Idris, belong over there: Also, disregard the OP of said thread, which was written under the observation that no new daily programming thread had yet been made.

FACT: Recursion is better than loops.

FACT: You only have a case in languages with tail call optimization.
FACT: Any language worth its salt has tail call optimization (unless it is an assembly language).

FACT: that second fact is a vacuous truth because all languages worth their salt are assembly languages

Daily reminder that __auto_type, statement expressions and local functions make gnuc acceptable lisp.

You are all equally retarded you autistic niggers. Stop shitting up the board

>makes the only thread out of those three that is an actual /dpt/ and not some bullshit thread that uses the OP as a platform to shill an opinion
>is a "retarded autistic nigger" for this
no u

recursion became obsolete when parallel programming became a thing.
it's the very expression of sequentiality. it's "do one thing, and then do the rest"

sage this gay thread

>__auto_type
Neat

I was thinking about making a simple prototype of a dynamic economy simulator, so I can maybe implement it in a game someday.
What I want to do is something like X3: Albion Prelude does, but on an ugly 2D plane. Theres some shops/factories sellings things, and a bunch of traders running around buying low and selling high, founding new shops. Goods in general have an average price, and it goes up and down based on how much theres in stock. Everything must be build from resources, for example: to manufacture a sword you need iron, whichy needs ore and coal.
Then I'll populate the "world" with traders and autistically tune parameters here and there to see if I can make this work into a fun mechanic for a game(most games have a shallow as fuck economy system)
Do you guys recommend any tool to make this? I was thinking maybe python with pygame

Attached: eco simulator.png (1298x528, 21K)

>recursion became obsolete when parallel programming became a thing.
Totally unrelated things

it's just a more limited version of sepples auto. You should switch to sepples before you ever consider vendor specific extensions.

the other one has a birb tho
birbs are pretty rad
this /dpt/ doesn't have a birb

As the OP of Dependently-typed Programming Thread, I can assure you that it is a platform to raise awareness of a fact, not an opinion. This thread should more correctly be named Deprecated Programming Thread.

Correct.

by using () instead of {} to call constructors you mongrel

Attached: jewpeg.jpg (1682x698, 264K)

clang supports it too. gcc/clang are the only relevant C compilers unless you program to some limited embedded device but those usually have some other hard limitations and extensions for that specific arch.

Indeed, for said user has forgotten about the """beauty""" of recursive parallelism:
(define (simulate-race-condition f xs)
(letrec
((var (list))
(helper
(lambda (f xs)
(unless
(null? xs)
(begin
(thread
(lambda ()
(set! var (cons (f (car xs)) var))))
(thread
(lambda ()
(helper f (cdr xs)))))))))
(helper f xs)))

That's irrelevant, OPs of generals should not be platforms. They should be used exclusively for establishing the topic of the general.

clang doesn't support all gnu c features and tcc doesn't support any

Oops, my bad, my code doesn't actually wind up doing anything.
Fixed:
(define (simulate-race-condition f xs)
(let/cc cc
(letrec
((var (list))
(helper
(lambda (f xs)
(if (null? xs) (cc var)
(begin
(thread
(lambda ()
(set! var (cons (f (car xs)) var))))
(thread
(lambda ()
(helper f (cdr xs)))))))))
(helper f xs))))

Is there anyway to remap the top buttons (Back, fordward, home, search, mail etc) on this keyboard so that when I press them I can open up something arbitrary to my choosing? Pic related is the keyboard.

Shouldnt there be some config file as soon as its plugged in or something? No idea what im dealing with here

Attached: Microsoft_Comfort_Curve_keyboard_2000.jpg (1000x553, 57K)

why the fuck are you posting if you don't have any idea what you are talking about.
Clang supports pretty much all gcc extensions, most notable thing that differs is that clang doesn't support local functions.
Tcc supports some gcc extensions like statement expressions, local labels and __attribute__.

sxhkd

>sxhkd
I don't use gahnuu slash linnuks (me 50iq micrjew user), beside the point why would I have to download something to do such a simple thing? Surely theres a way to make a simple edit with the keyboard alone

Regedit will do it for you. I changed my scroll lock/home/end keys to be my media keys and Discord VOIP mute.

Look into AutoHotkey for windows, I'm sure it cna do that

Thanks this is what I was looking for, but do you know which directory under the windows registry I should look under? Never had the need to make manual edits before

ignore other guy just get sharpkeys

>inb4 this doesn't do anything either
WRONG!
It won't do anything if you just enter it in the REPL -- it'll just return a thread handle -- but if you bind the result, that binding will CHANGE!
(define (simulate-race-condition f xs)
(let/cc cc
(letrec
((var (list))
(helper
(lambda (f xs)
(if (null? xs) (cc var)
(begin
(thread
(lambda ()
(set! var (cons (f (car xs)) var))))
(thread
(lambda ()
(helper f (cdr xs)))))))))
(helper f xs))))
(define (fwippyfwoop n f x)
(letrec
((helper
(lambda (n f li)
(if (zero? n) li
(helper (sub1 n) f
(cons (f (car li)) li))))))
(helper n f (list x))))
(let ((li (simulate-race-condition + (fwippyfwoop 100 (curry + 1) 0))))
(begin
(letrec ((f (lambda () (when (thread? li) (f))))) (f))
(display li)
(newline)))

don't fuck with your registries if you don't know what you're doing you brainlet

>sharpkeys
I just got it and pressed the keys like Home/search/mail in the image I showed in and it came up with "You've pressed a key sharp keys doesn't know about, wait for a later release...", I'm guess is cause those keys aren't common, do you know how I'd manually edit those in the registry? I Don't know where to look.

What do you mean? I just have no idea what I'm supposed to be looking under for keyboard key code remapping, no one knows everything what kind of response is this

If I were you I'd make this in Java using Netbeans IDE.
Anyway your project sounds really interesting, good luck

Protype woth whatever is fastest and easiest. If the prtotype is fun, continue to smth that works well on a bigger scale like Unity/Unreal or a custom wngine.

>Protype woth whatever is fastest and easiest. If the prtotype is fun, continue to smth that works well on a bigger scale like Unity/Unreal or a custom wngine.
>yfw
you wanna try those sentences again or

Attached: 10gxkt5.jpg (600x722, 69K)

Hey I have a bookmark just for this. Check out BazaarBot: gamasutra.com/blogs/LarsDoucet/20130603/193491/BazaarBot_An_OpenSource_Economics_Engine.php

Basically, you uncap the prices entirely and let the market decide the price of everything. If you have enough agents, they'll settle on very reasonable prices.

optparse-applicative is pretty nice tbqf

>he can't read sneteces with a couple missplalings
Hello newcandyassgot

Why C++ so stupid? C is more clever than this fucking piece of fish.

Guys, I have sum questions about font rendering, and maybe you smart bois can elucidate things a bit.

Do most programs render the fonts using the CPU, or do they use the GPU? For me, since I'm using opengl, I see two options: I either prerender the glyphs and cache them and render them as I need them, or I just CPU render everything each time the text changes, and update the relevant textures accordingly (which seems slow as fuck, to be honest). Caching unicode glyphs in a single texture seems like a bit of a pain to do, so I was wondering what method do people generally use to render text; am I overestimating the time it takes to blit some pixels (assuming the actual rendering of the glyphs is cached as a bitmap, like freetype does)?

And what about things like text editors and stuff, where text changes often, and the screen has to be updated accordingly, how do those programs do it?

Have some 3dpd as thanks in advance.

Attached: 1530965874521.jpg (998x1024, 296K)

user has seen the light!

Anyone have a solution?

those fucking feet goddamn

The decensors of my hentai decensoring neural network blow my old project (github.com/deeppomf/DeepMindBreak) out of the water. Because of the bigger and better architecture, the decensors are sharper and have higher resolution (512 by 512 pixels), and they wil get even better since training is only half complete. A finished project is at least a month away, but I feel confident this is the one.
Sample decensors: imgur.com/a/tyjKay9

You render them with the GPU obviously. Use an atlas. If you don't have to deal with the user zooming infinitely then it's by far the fastest way. Otherwise look into something like Slug: sluglibrary.com/

You never want to blit individual pixels with the CPU, are you a madman?

Valve et al. pioneered signed distance fields which can work on preprocessed font data and might work for your use-case.

This seems really good user, I'll take a look, thanks.

Need help please
I've installed openpyxl through piping to test and learn a few things. It works fine in terminal when I use
[$code] pipenv run python 3
import openpyxl
[$/code]
However when I save the code as main.py and run it it comes back with an error saying
[$code] ImportError: No module named openpyxl [$/code]
Not sure what I'm doing wrong here

Getting closer to making a Ruby application that helps me organize the mess that is my computer

Basically, I want to do the following:
-Open a file
-Rename file once contents are seen
-Close file automatically.

I want to be able to open with any application, so I can't rely on always using the default. Additionally, the experimenting I've done with using PIDs has shown me that when I use "open", the PID I receive isn't the same as the PID of the process I end up running (I think there's a startup process for the application, then another for the actual display of the image I opened, but I'm not sure)

Here's what I have so far. Any and all help is appreciated

pastebin.com/5SfK3Pqv

Pastebin bc the filters thinks I'm an epic hacker

Best project of 2018 coming in.
Btw, why doesn't it work on monochrome images? That'd be hella useful for doujins.

But how do I atlas a unicode char sheet? This worked for a simple ASCII table, but for all the characters I need (kanji and shit), it seems insane, unless there's something I'm missing.

Ignore the awful formatting sorry

Not him but I suspect this would be pretty easy to implement as a non-neuronet software layer around the neuronet. You could just take the monochrome image, saturate it to skin-tone, run the neuronet, desaturate the output, and apply said output to the original monochrome image rather than to the modified training image from which it was produced.

what do you guys think about my profile github.com/davidfregoli

(also please give stars to pad my projects thanks)

What's your use case exactly? It's going to be faster to regenerate the atlas when it encounters a glyph it hasn't seen before than to manually blit things with the CPU. Can even cache the new atlas and reload it on subsequent runs. Then the user will maybe experience one or two frame drops the first time they encounter a new glyph and then never again.

I suspect (haven't tested this) that decensoring doujin is much harder than color images. Doujins use screentones, and neural networks will probably struggle to replicate the patterns of screentones so I have put that problem off for later.

>4 contributions in last year
active user, i see

Would programming be in a better state today without self-taught devs and bootcampers?

yes, user. the less knowledge about programming available around the better. it should be kept to secret, elite cabals of magicians. only after gaining the grade of programmus adeptus from a programming master are you truly allowed to be a programmer.

This
Programming should only be taught to people with math PhD's

It just seems to me that requiring a formal CS education would help prevent a lot of the mistakes we see being made over and over again.

Essential programming books besides SICP and K&R?

the C programming language

fight me, haters

I blame the zoomers

I said besides K&R

Who else /ask CS theory questions in interviews/?

user my 2 months of copy-pasting JS is just as good as 4+ years of formal CS study

Attached: C_dpt.jpg (1280x720, 582K)

Thinking of pre-ordering The Little Typer, any other anons doing the same?

Attached: 91waWeUbM4L.jpg (1500x1932, 613K)

I want to change that but I don't have any ideas

I want to render text fast, and I need access to japanese scripts.

>and I need access to japanese scripts.
no you don't you faggot

How is this even a problem? It's been solved, just use Electron.

>just use Electron
literally never the solution

I don't get what you mean by this. How do I not need them if I literally need them?

Use an atlas for ANSI. Use a separate atlas for kana and the top 500 kanji or whatever. Then have a separate atlas that you regenerate on the fly when you encounter a glyph that isn't in one of the other atlases. The slowest part of this is actually uploading the updated atlas to the GPU, but it should all clock in at under 1ms unless it starts to reach retarded sizes. Literally just by doing this you'll be faster than 99% of desktop apps.

All of this is a hundred times faster than manually blitting textures using the CPU (even using SSE).

based and redpilled, weebs eternally btfo

wtf why so racist

Attached: 1533496866041.png (491x435, 311K)

I guess my biggest problem is not the atlas itself, but rather quickly referencing the glyphs. Is a 8000+ array the best way of doing it, or are there other ways?

>faggots are a race
I like this.

Wrong. Loops are more general. Recursion is liked by people who love maths but not computers.

In JS, suppose I have some string 'foo_bar_baz' that's fairly long contains placeholders for variable names. What's the most efficient way to replace those placeholders in the string with their respective values, where the ordering of the placeholders in the string and the orderint of key-value pairs in my code isn't necessarily the same?

Attached: 1533137980350s.jpg (250x250, 4K)

Ok, I've learned how to write a fizzbuzz algorithm and how to reverse a binary tree, where can I get a job?

That's an n2 problem, I think. You are out of luck.

The absolute state of js people

no against weebs

Nowhere because those are some newbie tier tasks that everyone that licked programming should be able to do.

Not true. If he cuts off his dick he can get a job anywhere in Silicon Valley.

sorry

If he cut off his dick he wouldn't have to learn those in the first place, though.

What about recursive loops?

Why are all the K&R exercises so deceiving complicated compared to the examples? E.g. 1-23 (removing comments) is practically impossible.

FACT: wrenches are better than screwdrivers

see where this is going? not a perfect analogy but you get my point. loops and recursion are both tools to achieve an object and in many cases both _work_ but one is more intuitive to use. for example, apply operation X to List:

foreach element in List: do_thing(X)

in most imperative languages, this is a single line. short, comprehensible, logical. sure, you _could_ have done it recursively but it would require an extra auxilliary function and you introduce more complexity

whereas if you want to create a folder but need to assert that the parent folder exists and if not create it and repeat recursively then yes, obviously, heck yeah recursion. besides, there are few things more satisfying watching a recursive script eat through a problem that would be extremely clunky with iterative approaches.

in the end, they're both tools and a good programmer should know both well and when they're best used

Maybe if you're a brainlet. Literally just insert \0.

Attached: file.png (554x357, 11K)

Tbh senpai I had this problam with the Golang book.. the exercises make you look up all kinds of shit they don't teach you.. I think Kernigger is just bad at teaching.

programming is for AI

>those are some newbie tier tasks that everyone that licked programming should be able to do.
Oh, my sweet, naive child...

Now google "pratically".