/dpt/ - Daily Programming Thread

GB Emulator general

Previous

Attached: 1537905983776.jpg (1194x657, 118K)

Other urls found in this thread:

gitlab.com/9898287/gtkdnotes
code.dlang.org/packages/derelict-libui
youtube.com/watch?v=kPRA0W1kECg
youtube.com/watch?v=tPtvKYinUzc
en.wikipedia.org/wiki/Timsort
github.com/Sirmentio/protontricks/blob/master/protontricks
bellard.org/jslinux/
reverseengineering.stackexchange.com
en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
copy.sh/v86/
github.com/copy/v86
man7.org/linux/man-pages/man5/elf.5.html
en.wikipedia.org/wiki/WebAssembly
mbebenita.github.io/WasmExplorer/
warosu.org/g/?task=search&ghost=yes&search_text=copy.sh v86
twitter.com/SFWRedditGifs

Oops

Previous:

I want to get rid of Matlab but I don't know shit abou open source languages for scientific computation. I heard julia and python are good for numerical and symbolic calculations, is that true? Which one should I learn?

I'm writing a learn gtkd-by-example tutorial as I learn gtkd myself.
gitlab.com/9898287/gtkdnotes

Attached: 1535758853717.jpg (346x510, 31K)

just google scipy and jump down the rabbit hole.

/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

Thank you for using an anime image.

Attached: shitposter.webm (1280x720, 2.83M)

code.dlang.org/packages/derelict-libui

Running a python/flask app in the Google Cloud App engine.

Added a python module that uses Asyncio to scrape Twitter. Asyncio and Flask don't play nice. I tried moving from Flask to Quart, but get a Gunicorn error.

I'm frusterated and don't know where to turn.

>wrapper around WinAPI but not entirely, still had to implement stuff using winapi. thrd_join() for example
No you didn't to at all. WaitForSingleObject with the thread handle is exactly the saem as join

libui is obsolete and deprecated. If you feel that libui is useful go document the bindings to your language.

How are you using asyncio? Why is it not working with Flask? Are you doing anything different to the request-response process?

celery is the go-to async task solution for python web frameworks.

Not the same guy that asked the original question, but I'm still wondering. People who have used things specifically made for mathematics, like Matlab and Mathematica, how do you think they stack up to things like scipy?

Fact: OCaml programmers are the most powerful race in the world.

get back to work Jane Street rep.

Some plans for multithread

so powerful they can't even parallelize ocaml's reference implementation.

Attached: risitas.png (272x204, 71K)

youtube.com/watch?v=kPRA0W1kECg
youtube.com/watch?v=tPtvKYinUzc

What sorting algorithm is the best? Which one do you personally use?

Different algorithms are suitable for different scenarios. How's that for an answer?

I never had any problems using the languages default implementation for sorting, but then again I am a complete shitter so YMMV.

I implemented a basic timsort (i.e dynamic buffer and no galloping) for swift a while back because it doesn't have a stable sort algorithm.

en.wikipedia.org/wiki/Timsort

I'm using Twint (Twitter scraper) which uses asyncio and I am using threading to routinely scrape a handful of users.

Flask isn't Asyncio compatible - I get a server error and I can't recall the log error. Oddly though, it works just fine with a localhost which only adds salt to the wound.

Thanks, I'll look into it.

quicksort for arrays, mergesort for lists, insertion sort for small things

Heapsort is my goto. I can easily remember it and it is log(n).

What exactly are you doing? Do you want to be able to trigger the scrapper via a web call? In which case I guess that's the wrong approach, just have the Flask backend schedule a task that gets forwarded to the scrapper.

Why do you need to remember it?
I understand the use of understanding an algorithm, but why not just use library to get functions for sorting in the general case?

Maybe I take too much pride in feeling like I understand every little component in code that I write in intricate detail.

how do we get more women into programming?

These aren't mutually exclusive.
You are free to closely study the sorting algorithms in whatever library you choose, and then when you feel like you understand them you can start using them in your code. The benefit here is that you only need to study them once, assuming you don't have a problem forgetting about parts of your code (which you do anyway).

Reinventing the wheel is bad engineering, user.

Fuck off

fuck off yourself

Turn men into women.

what are you working on atm then lads? right now i'm trying to figure out how i can program myself a wuja wang girlfriend

I would if I could, bitch.

A better question is: Why do people even suggest this - why would you want more women in programming? Everybody knows how thirsty males change their behavior radically among women, and whenever women want to control something it goes to shit quickly.

fuck off you little scrote, I'm 6'4 and I could absolutely batter the fucking shit out of you

I'm making a website that publishes tweets.

app.beforeload triggers the function to collect tweets every X minutes via threading and delivers them to a global list which flask delivers to the page.

The scraping module is breaking the app. I created a parallel program for RSS posts, so I know it can work ... but twint is throwing a wrench in things.

still working on a CHIP-8 console

What are other languages that have some quick shorthand tricks similar to list comprehensions? It makes me feel good when I get to reduce 15 lines of convoluted loops into 3 lines of code that's completely unreadable for someone who doesn't know what they're seeing.

List comprehensions are stolen wholesale from Haskell. Haskell is known for making it possible to write extremely terse code.

yikes.from(me).dawg()

>using laptop
>neck aches within 30 min
>staring fucking downwards all the time
how do normies do it?

for loops
object methods

I'll batter you like a fillet of fish you squeaky little runtoid, learn your place before I'm forced to put you in it

>List comprehensions are stolen wholesale from Haskell
you mean math, you fucking retard

Attached: sit-stand-desk_2.jpg (900x900, 62K)

I'll wear you like a rubber, you faggot

I wish I could afford a standing desk.
I wish I had the space for a standing desk in my room.

just stop being poor

I bet you're a runty little pile of shit fucking virgin freakoid hiding behind your keyboard come here and ill fucking make you blind

I wish I had a room.

Learning Racket's Matrix functionality... I might have to do a ton of weird logic just to be able to do (Matrix-Set i j value)

But it'll be worth it. I swear!

so basically you're saying get a dock and use it like a desktop anyway

nah standing desk is a marketing meme

just get a real good chair

>I wish I could afford a standing desk.
IKEA has a cheapish one that I use. It really is the best purchase I've made in years. Surprisingly, I even work more efficiently while standing. I get less tired.

No, what you mean are Set comprehensions, my sweet child :^)

damn I need to learn how to program in math

Whew! Just use a counter or podium and quit crying about memes.

How do I get gud

I made a really simple version of protontricks for myself.

github.com/Sirmentio/protontricks/blob/master/protontricks

Yeah you have to hardcode 3 variables into the script, there's more automatically done in protontricks but it's huge and fragile.

I like this simplicity much more, 16 very simple lines Vs. 290. No command line arguments, no error prone auto-finding directories.

Proton is Valve's builtin version of Wine for Steam on Linux.

#!/bin/bash

# User Config
STEAM_DIR="$HOME/red/STEAM"
PROTON_VERSION="Proton 3.7 Beta"
GAME_ID="550350"

export WINE="$STEAM_DIR/steamapps/common/$PROTON_VERSION/dist/bin/wine"
export WINESERVER="$STEAM_DIR/steamapps/common/$PROTON_VERSION/dist/bin/wineserver"
export WINEPREFIX="$STEAM_DIR/steamapps/compatdata/$GAME_ID/pfx"

# Run Winetricks
#winetricks

# Run Winecfg
"$WINE" winecfg

Attached: import-10-06-18-14-16-28-785543641.png (668x623, 17K)

Is the surge protector hidden in his ass?

>Yeah you have to hardcode 3 variables into the script,

write a mini GUI in TK (10 lines) so users can input the variables without editing the script

over the years i've messed with qbasic, liberty basic, visual basic, game maker, and they all had manuals of one type or other with all the usable commands you can use (print/goto/void) however i've started messing with c# and can't seem to find a full list of everything as it's so interwoven with all this .net stuff and whatever else microsoft is using. is there no pdf or something that just lists everything you can do? the closest i've seen is in visual studio you can look up the definition of a command but you need to know it before hand or go into one of the namespaces like system.io and read the comments.

>tfw can't post sound
Once I get a power supply for the LED screen, I can finally fully strip SDL off

Attached: chip8.webm (1080x1920, 1.28M)

Could just use Zenity for that and it would be extremely simple.

GAME_ID="$(zenity --entry)"

Simple as that for gui.

Not like anyone would complain about Zenity for something like this, since Winetricks uses Zenity.

I am extremely bored and feel like programming some C++ on Windows 98. Where should I start?

Start by writing a Windows 98 emulator

>not running Windows 2000 in the browser

bellard.org/jslinux/

How do you figure out how much you should be paid for a software developer position, depending on location and experience?
Glassdoor's salaries seem pretty inflated for my area, not sure they're accurate

Here's a screenshot for context of .

I've moved the function above the @app call and left just the threading. Stupid google cloud test environment makes me push all the changes w/o testing them and it takes 10 minutes.

Attached: Captureff.png (698x584, 32K)

I can't wait for year 2120. Why? Because then they will make a new standard: C++120
But it could be written with roman numerals as C++CXX. Isn't that hilarious?

what are your skills?
years of experience?

>2120
humanity will be long gone

>skills
frontend web dev, sql, some containerization experience
>years of experience
0

Holy shit, nice

Now if only whoever did the interface served the wasm with its correct mimetype until browsers catch up

Octave is almost the same

$6/Hour

t-thanks

You'd start out at $55k at my employer and never go anywhere. Just be chained at a desk and do stupid data entry and be told to be appreciative while everyone else does absolutely nothing but fuck around and take 2 hour lunches.

Windows 2000 is pretty fast running on JS. I'll definitely check it later when the wasm is loaded

>$55k for data entry
that's half bad

How do I get find the entrypoint of an ELF as an offset into the file? No external utilities, just raw C.

reverseengineering.stackexchange.com

It wears on you and the stupidity fills your head since it's brainless work.

My coworker has been there 15 years and all she knows is 90's table HTML. We were having a server crap out and she called the IT desk to see if her laptop was up to date because that might be the issue.

en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header

by getting rid of techbros, the cancer of the software development industry.

this one is more impressive

copy.sh/v86/

maybe, but i think bellard programmed that emulator himself, whereas v86 had a bunch of people working on it

github.com/copy/v86

man7.org/linux/man-pages/man5/elf.5.html

something like this

#include

Elf64_Ehdr header;
FILE *f = fopen("filename.bin", "rb");
fread(&header, sizeof(header), 1, f);
fclose(f);
printf("entry point: %p\n", header.e_entry);

Attached: 1428149537051.png (612x727, 96K)

Oh shit it is, and it properly serves wasm so it runs properly.

Still really impressed that bellard programmed the other one/s by himself

This seems to give me the entrypoint as an offset in the virtual address space of the process image.
I guess if I want the file offset, I need to find which section that address belongs to and then work backwards.

now, yes. but between 2014 and 2017, 99% of the code was from Copy alone.

i have tested the code, be sure that the header start at the very first offset of an elf executable.

niggas I've been starting /dpt/ threads about emulators and wasm for weeks now, where was this before? Seriously it's pretty cool seeing this

>properly serves wasm
noob here, what does this mean? and how do you check it?

If floats lack precision, is there some allowed deviance when comparing if two floats are equal?

floats fine for 99% of people.

>, where was this before
i wasn't here, because i would've posted it.

Also i think people knew about it

verify with

header.e_ident[0] == '.' &&
header.e_ident[1] == 'E' &&
header.e_ident[2] == 'L &&
header.e_ident[3] == 'F'

en.wikipedia.org/wiki/WebAssembly
mbebenita.github.io/WasmExplorer/

If you use the inspect tool in your browser, it should tell you if it was served with mimetype something like application/wasm, or something/wasm, I forgot. If it isn't, the server falls back to serving the asm.js. The 2 ways to resolve this is by making your JS loading script use the right mimetype I think, or having the server serve outgoing .wasm files with that mimetype, which I think is set in /etc/mimetypes

asm.js, while somewhat fast, is probably 2 or 3+ times slower than wasm, which is why copy's is faster than bellard's

it has been posted from time to time

warosu.org/g/?task=search&ghost=yes&search_text=copy.sh v86