/dpt/ - Daily Programming Thread

rolling edition

What are you working on, Jow Forums?

Last thread:

Attached: 1542505640892.png (1450x1080, 378K)

Other urls found in this thread:

benchmarksgame-team.pages.debian.net/benchmarksgame/faster/python.html
bastibe.de/2012-11-02-real-time-signal-processing-in-python.html).
github.com/VPashkov/awesome-nim
docs.oracle.com/javase/tutorial/java/data/manipstrings.html
github.com/metacraft-labs/py2nim
github.com/jboy/nim-pymod
youtu.be/QIHy8pXbneI
twitter.com/AnonBabble

nth for nim!

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

***th for 3 star programmers!

Attached: dpt 3 star programmer.png (868x1228, 884K)

>whoever came up with the name matplotlib.pyplot deserves hell
>Python has existed for TWENTY-SEVEN FUCKING YEARS AND YET THERE IS NOT EVEN A SINGLE SANE REAL TIME AUDIO SYNTHESIS LIBRARY REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

>Python has existed for TWENTY-SEVEN FUCKING YEARS AND YET THERE IS NOT EVEN A SINGLE SANE REAL TIME AUDIO SYNTHESIS LIBRARY
And why do you think it is like that?

Attached: 1544641449979.webm (1000x563, 2.92M)

rolling but never gonna do it

roll
learning common lisp, know some scheme already

I don't think you realize how intensive signal processing is.
Python would shit itself doing anything real-time.

>in4 JS codemonkey fucktard fuck off

I have a question, Could i from a JS file (from a Node server to be exact) run a Python script to which i can assign some variables from the JS file so they are assigned in the Python one?

If not i thought about doing it the retarded way

>Make so the Python script reads the variables and its attributes from a text file/Json which Node creates and then Python deletes that file after it finishes.

Attached: 1543331741266.jpg (960x958, 215K)

what's with the cars?

well i'm sure you can derive the registered owner and their SSN from their license plates
also how do you get someone's identity by looking at the back of their head?

why not do the middle, slightly less retarded way and pass the json as argument?

...

what you mean

I don't understand that comic.

...

Why are they recognized in a face recognition software?

let me interject for a moment

I don't think you realize how fast numpy can be

On a scale of 1 to 10, how cute is Lua

Attached: 1496757793100.jpg (573x892, 113K)

Try establishing some IPC based on UNIX sockets and message pack.

8/10, too dependent

numpy isn't signal processing you melon.

Say I have a computer. It connects to some IP:443. It gets an ephemeral port.
What can it do with this port? Can other IPs send to this port, for instance?

roll

python isn't slow you ananas

>face recognition software
the webm is from the show "Person of interest". The Machine (supercomputer with AI capabilities) has access to every camera in the city, cell phones, wifi, etc. and they cross reference identities from people through their social network etc.

the software probably recognized the face of the driver from the live cameras the city has.

benchmarksgame-team.pages.debian.net/benchmarksgame/faster/python.html

let me interject for a moment

I don't think you realize that numpy isn't fit for arbitrary signal processing (see also bastibe.de/2012-11-02-real-time-signal-processing-in-python.html). Additionally, real time requires low latency, not (only) high throughput, something that Python just won't deliver, no matter what JIT DSL compiler you call.

>multithreading was a mistake
>custom lock objects are a mistake on top of a mistake

/**
* A simple custom lock that allows simultaneously read operations, but
* disallows simultaneously write and read/write operations.
*
* Does not implement any form or priority to read or write operations. The
* first thread that acquires the appropriate lock should be allowed to
* continue.
*/
public class ReadWriteLock {
private int readers;
private int writers;

/**
* Initializes a multi-reader single-writer lock.
*/
public ReadWriteLock() {
readers = 0;
writers = 0;
}

// Start of Lab 06
/**
* Will wait until there are no active writers in the system, and then will
* increase the number of active readers.
*/
public synchronized void lockReadOnly() {
while (writers > 0) {
try {
this.wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}

}
readers++;
}

/**
* Will decrease the number of active readers, and notify any waiting
* threads if necessary.
*/
public synchronized void unlockReadOnly() {
if (readers > 0) {
readers--;
}
if (readers == 0) {
this.notifyAll();
}
}

/**
* Will wait until there are no active readers or writers in the system, and
* then will increase the number of active writers.
*/
public synchronized void lockReadWrite() {
while (readers > 0 || writers > 0) {
try {
this.wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
writers++;
}

/**
* Will decrease the number of active writers, and notify any waiting
* threads if necessary.
*/
public synchronized void unlockReadWrite() {
if (writers > 0) {
writers--;
}
this.notifyAll();
}
}

CPython is slow. In both, throughput and latency. In a very small amount of limited scenarios, you can fix the former with numpy.
Additionally, both PyPy and Cython are slow as well in most nontrivial scenarios.

not unlike the movie limitless, the concept was great, the show was a bore

i think I'll just stop programming then, and leave the shitshow to you, my patience has run out, jesus christ

Or, you know, you could invest the minimal effort it takes to learn a language that wasn't designed and implemented by total retards.

Like what?

mostly true, yet any other language insists on values that I do not care for
>10 hours of compiling
>lack of sane security architecture (.py is no better, I know)
>syntactic visual assault
>10x LOC compared to .py
>no platform independence
>shitty documentation, libraries and communities

nim would fix most of your painpoints besides not really having mature libraries.

I fondly remember the times when I was able to naively, arrogantly laugh at the bottom right of pic related. Now it feels too true to be funny

Attached: programmer-hello-world.png (987x1029, 28K)

this actually looks somewhat sane, yet way too early to use seriously

>yet way too early to use seriously
It has a few retarded things like seqs (dynamic arrays) vs arrays (static arrays). But it's definitely a very usable language. Plus optional W H I T E S P A C E is really nice in an imperative lang. But yeah if you're an impatient brainlet who needs everything done for him with libraries, check back in a year.

having advanced libraries is the definition of usable, before that it's a reinvent-your-own-wheel simulator, for which I don't have the time for

well give github.com/VPashkov/awesome-nim a look just in case.

>check back in a year.
He says, for the 9th consecutive year

roll

Java, how do I take a line, and only read in the bits i want?

I have a line like this:
#ID @ left,top: width,height


real example:
#13 @ 185,501: 17x15


How do I pull the numbers out of this? The ID can be up to 1-4 characters long, the top and left positions up to 1-4 characters long and the width and height can be 1-3 characters long.

Simplest I think is to split on the spaces and then pull the characters. But is there an equivalent to the C:
fscanf(fabric_list, " %*c %d %*c %d %*c %d %*c %d %*c %d",&id,&left,&top,&width,&height)

roll for starting from tomorrow
I need to have a CAN DO attitude

reroll

why not just ask in /aocg/? or /sqt/?
RTFM
docs.oracle.com/javase/tutorial/java/data/manipstrings.html

In C, I tokenized each number, and called atoi().

And this is why you don't ever post those fucking awful roll images, especially as an OP.
Go fuck yourself, OP.

This. Even abhorrent anime is better.

If you wanted people to post anime images you could of just asked instead of baiting.

Attached: 1544306842063.jpg (736x780, 75K)

lmao imagine being this upset over your shitty C&FP friends general

Why the fuck do people keep saying "roll" like spastic autists?

>I like anime or weebs

lmao you can only fizzbuzz

Attached: 1519833122706.gif (480x270, 357K)

Split the string based on spaces, and then split those strings on whatever you need.

Thanks for the cute Yuno.

Attached: 1543100748606.png (1694x2000, 198K)

>tfw want to get into nim but can't build enough willpower to escape python's gravity well
kill me
or tell me how I can slingshot myself as far as possible from python, so I can maybe maneuver around it in a couple months and get to nim safely

Rolan

sudo pacman -Rns python

Still working on my halite bot. I want to get to the next rank so bad, uggghhhhh....

Attached: ugggghhh.jpg (666x657, 99K)

github.com/metacraft-labs/py2nim
github.com/jboy/nim-pymod
haven't used either myself, but be prepared for caveats.
or just stop being a dummy and switch.

Clearly fake
Telling chinese people apart is non-NP

Thanks, but fuck no

Based.

Programmers are just slaves with golden chains

Speaking of managers, I always assumed the whole "managers have to be tall" was just a meme. I'm 6"1, but every guy at the manager meeting I had to attend was taller than me

What kind of data structure is best suited for a hash table? AVL tree?

Brainlet here, isn't the hash table the data structure?

how do I make this function not blow up the stack??
(define-public (intersperse x list)
(if (or (null? list) (null? (cdr list))) list
(cons* (car list) x (intersperse x (cdr list)))))

A hash table, or dictionary, is an Abstract Data Type (ADT). You can implement a hash table in different ways. For example, the simplest way, is a Direct Access Table. Basically an array.

>learn abap
>company slowly moving to web, away from sap
>all my abap experience for nothing
>slowly pushed into maintenance position I hate
>constantly lied to by managers because they don't know what the fuck is going on either

what do? learn javascript? try to join another team after learning javavscript or get another job?

learn python and focus on linear algebra and machine learning for fun and hope job moves me to different team and learn javascript anyway?

Maybe he's talking about chaining vs open addressing.

Learning java

No, talking about the structure of a hash table. I want the search to be O(log n), but also to conserve space.

based

I was working on a little C library for plotting graphs. I designed it so the storage of data would be decoupled from the actual output so it would be easier to keep the RAM footprint small. I started doing the lower layer, the part that just spits out data into a png, but then I kinda just started playing with that instead of writing the damn library. So here's this.

Attached: testout.png (1000x1000, 76K)

Yeah, well I'm learning SAP

SSAP as in ABAP???????!?@$!$?@W@EWQSZWEDSAXE Im noT THE ONLY ONE?????

T C O

No, SAP the enterprise software

This is poorly implemented and can allow a Reader and Writer to exist at the same time if the thread execution is just right.

as in this?

this is ABAP

Attached: images.png (89x44, 1K)

how else would schemefags implement a function that returns this
[ i, f(i), f(f(i)), f(f(f(i))), ... ]
until f...(i) returns #t for some predicate, in which case, we can choose to keep it in the list or discard it, based upon input key argument "last"
this uses state so I'm not sure it's idiomatic, but it sure seems like a clean solution and doesn't kill the stack
(defun-public (span-compound f init until #:key q last)
(let loop ((val init) (col (make-q)))
(if (until val)
((if q id car) (if last (enq! col val) col))
(loop (f val) (enq! col val)))))

it uses queues from the (ice-9 q) module,this is guile btw
basically, queues allow me to append to the end of the list at O(1) time, because the undelying data structure is a pair with the list itself being the car, and a reference to the last cons pair of the list being the cdr
I guess what Im trying to do is justify being imperative because it was the most straightforward solution

Attached: sicp.jpg (500x492, 85K)

the fuck is wrong with seqs and arrays?

yeah but how though

Rolling cuz why not

roll

you're just doing it wrong: youtu.be/QIHy8pXbneI

>1:18
Provide a summary if you're going to post hour long tech talks like are likely trash compared to an erlang talk

Technically, nothing that I know of.
Syntactically: @[123] is fucking stupid.
And treating them as two separate things is retarded when every other language just differentiates them by either specifying a size at declaration or not. Honestly don't know what they were thinking.

>And treating them as two separate things is retarded when every other language just differentiates them by either specifying a size at declaration or not. Honestly don't know what they were thinking.
I'm not sure what "every other language" means to you, but C, C++ and Java all do this too.

What is this gay shit?
In JS this is just
function* anonsHomework(initialValue, predicate, last) {
let prev = initialValue;
for (;;) if ((prev = predicate((yield prev, prev))) === last) return;
}

exactly. there's no reason for seq to exist.
just omit the size or do a [] for a dynamic array.

Fuck off newfag

>know archaic language called abap for work
>getting phased out

Do I into javascript now?

D programmers be like

kill yourself zoomer.

are you retarded? I wasn't agreeing with you. All the languages I listed treat dynamic arrays WAY differently than they do static arrays. Jesus, this general is fucking chock full of pajeets.

>last is a mandatory argument
>doesn't collect intermediate results in a list
>doesn't return the list
0/10

>be a dynamic lang
>do absolutely nothing intuitively
>every basic thing you can assume will work in other langs doesn't here, and involves 2-3 extra steps and workarounds
At last, i truly understand why no one uses Elixir.