Old thread: What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
5G is harmful. Thousands of studies over decades. Peer reviewed, etc.
Links to the archive, some good information.
Start of my own post chain.
warosu.org
And an index in one post.
warosu.org
2nd for use const
nth for Nim! (Go try 1.0 RC)
Imagine the smell of Miyako's socks!
1st for do your part and report schizoposters
all glow niggers must burn
what does this have to do with programming
fpbp
6th post objective worst post
Considering brain function is required for programming, everything.
Just report and ignore it. Hopefully the janitors will finally get off their ass and do their (unpaid) job.
gib project ideas
5G must be stopped.
you can take the first step and stop posting about it
>brain function is required for programming
get a load of this pleb
So close yet so niggerlicious. I really don't want to mmap this shit.
Plotting audio input live with PyQTGraph:
This graph stops plotting after a while. The time it takes varies. Does anyone have a clue as to why? No error codes or anything.
Also feel free to point out any retardisms in the code.
beautiful
Jesus, why did you write your C code in such a retarded way?
>n-no, c++ and OOP don't help with g-game dev
>proceeds to work on his C engine for 5 years just to get skeletons
What is this supposed to be showing
wrong thread
What's the best language for making a fighting game
2D -> C#
3D thots -> C++
that your compiler loves you
also: HOW do I exit the program properly? I have several identical processes listed in htop after doing ctrl+c and closing the window
turns out compile time is actually pretty important, and sepples mongs have been rediscovering it.
not by default
just force it
it's a two-way relationship, you can't expect it to do all the work
talk is easy. show me better kode.
>HOW do I exit the program properly
import sys
sys.exit()
or just use SIGINT OR SIGTERM
just killall
print("please write "sys.exit()" below!")
cmd = input()
eval(cmd)
cheers
#include
#include
#include
#include
static int compare(const void *p1, const void *p2)
{
const int *i1 = p1, *i2 = p2;
if (*i1 < *i2)
return -1;
if (*i1 > *i2)
return 1;
return 0;
}
int main(void)
{
char *line = NULL;
size_t line_len = 0;
ssize_t nread;
size_t len = 0;
size_t cap = 16;
int *arr = malloc(sizeof *arr * cap);
if (!arr)
return 1;
while ((nread = getline(&line, &line_len, stdin)) > 0) {
char *endptr;
errno = 0;
long n = strtol(line, &endptr, 10);
if (errno || endptr == line || n < INT_MIN || n > INT_MAX)
continue;
if (len == cap) {
cap *= 2;
int *tmp = realloc(arr, sizeof *tmp * cap);
if (!tmp)
break;
arr = tmp;
}
arr[len++] = n;
}
qsort(arr, len, sizeof *arr, compare);
if (len != 0)
printf("%d\n", arr[0]);
free(arr);
free(line);
}
If you were really trying to squeeze out performance, I would look at replacing qsort with something hand-rolled.
>stay an extra hour at the office, because I don't like leaving things half finished
>I'm on a salary, so won't even get overtime
Have I become a wagie?
>using eval
m8
think he's kidding mdude
i know pal
ok brother
>won't even get overtime
Not all wagies are idiots, but you seem to be.
np buddy
size_t partition(int*A, size_t p, size_t r) {
size_t i = p - 1, j = p, pivot;
int temp;
pivot = p + rand()%(r-p + 1); //random pivot
temp = A[pivot];
A[pivot] = A[r];
A[r] = temp;
while ( j < r ) {
if(A[j] < A[r]) {
i = i + 1;
temp = A[i];
A[i] = A[j];
A[j] = temp;
}
j = j + 1;
}
temp = A[i + 1];
A[i + 1] = A[r];
A[r] = temp;
return i + 1;
}
void quick_sort(int* A, size_t p, size_t r) {
size_t q;
if ( r > p ) {
q = partition(A, p, r);
quick_sort(A, p, q > 1 ? (q - 1) : p);
quick_sort(A, q + 1, r);
}
}
why is my quick_sort about 4 times slower than my heap and merge sort (who gets almost the same time?)
>//random pivot
That's not a great idea.
I said better not code review-tier garbage
it's the same time with or without it
if(modalWindow.Viewmodel.BoundContent.Datacontext.Viewmodel.BoundContent.Datacontexg.Viewmodel.GetType() == ModalWindowGenerator().GetInstance(ModalWindowTypes.WindowINeed.ToString()).GetType())
God I love OOP
What the FUCK is a microservice
Sounds like a fancy way of saying this binary only handles a crumb of crud
>pop() in C++ is void
Why tho
The "quality" (closeness to the median) of the pivot is vital to quicksort's performance. If you happen to pick the lowest/highest value, the performance will absolutely tank. So often the pivot is picked as a middle of 3 values, so you never hit that worst case.
Also, quicksort actually sucks for small arrays, as the overhead is high. Many "real" implementations will change algorithm when the size of the list is too small or has recursed too far, usually to something like heapsort, which itself becomes a new algorithm called introsort.
>delete this thing and then give it to me
See what is wrong?
Sometimes you don't need the result, there is a returning version as well with a different name
pretty much, crazy how UNIX had it all figured out decades ago.
I really like erlang/elixirs approach though.
You just group child processes under a supervisor. Where I think other languages have to nig-rig their own supervisor structure.
Rate my new move:
If you are inflicted with damage over time effects, or debuffs you clear them, and regardless of your DoT status, you deal damage equal to 1/2 of a standard attack range.
It would be the attacking equivalent to a healing move which removes DoTs and debuffs as well, healing for 1/2 of a standard heal range.
Some damage over time effects in my game can defeat a fighter in three turns, but given the ability to heal the effects off, the battles would often stalemate with the DoT being cast over and over, while the other one cleanses it away. With a damaging version, at least now people have the option to go for a Pyrrhic victory instead of getting stuck.
It was easy to add it, because my code is extensible, all I had to do was add 1 more case to a switch.
>microservice
how would you define microservice?
anyone got an explanation or uses for the liskov substitution principle? what's the point of extending through subtyping if you're ultimately bound by the same requirements defined by the base type? If we have, for example, a File object with a read() method returning the file contents, and subclass it as 'HTML' with the read() method returning its contents converted to html, does that respect the LSP? If so, how? After all, program parts making use of the object might expect the output to not be html.
>liskov substitution principle
is more about data layout than what the object actually does via virtual methods
The derived object can override those methods
Programming is boring
a service that does exactly 1 very small thing.
how do i edit a lisp file while its running?
I tried "sbcl --load file.cl" and edited it in nano and saved but its not working
it's almost like you can't just spend all your time on hackerrank/leetcode or grinding books. And you need to actually apply concepts and make projects.
In theory something small.
In practice systemd
you're boring
*except in C++
yes
what programming?
achieving things is rewarding
is wifi also bad for me?
Yes. Given that it operates at 2.4-2.45 GHz, which is near the maximum dielectric loss of water, where it begins to spin on its axis, that alone should give any sane human being saying it's inert pause. Microwave ovens use this to cook food for a reason. Just because it's below the threshold of ambient thermal noise, doesn't make its basic properties change.
Altered calcium flux and all the rest of it also applies.
>Just because it's below the threshold of ambient thermal noise, doesn't make its basic properties change.
No, but that does mean you could never notice any consequences. It's so miniscule it's virtually not there.
Does C++ have dynamic typechecking?
with std::any sure I guess
It does not mean that. Biological systems are designed for transduction and amplification of a broad range of polarized or periodic signals, and electromagnetic signals are part of that.
Would you kindly fuck off to your own thread and leave dpt?
No actually, they aren't. That's a meme. 100% of signal transduction in humans is chemical.
>How does vision work
It's time to stop memeing.
Motion of charge in the extracellular space->field created->forces put on charge groups comprising calcium channel voltage sensing subunit->channel activation->downstream signalling
This is not a chemical mode of signalling. Cells do this all the time on their own. That's how they work.
Nah I'm done, you don't know enough to even argue with.
>How does vision work
What is retinaldehyde?
hello
Hi, friend
this
Vision involves light, ie, radiation. Which is not "100% chemical transduction".
Also, look further into dark current and the dedicated pathway to the pineal gland. I'd recommend the book "Electromagnetic fields and circadian rhythmicity."
>Scientists think they've identified a previously unknown form of neural communication that self-propagates across brain tissue, and can leap wirelessly from neurons in one section of brain tissue to another – even if they've been surgically severed.
>always use events in C#
>find out they are a massive source of memory leaks
>switch to weak references
Is there any reason to use the former over the latter?
telepathy CONFIRMED
>the schizo has been here for 16 hours
why won't he leave?
The skin is a massive mmWave transceiver. Ancient knowledge as well, "the right hand gives, the left hand receives." Indeed. The right hand voltage gradient is positive, the left is negative. This is how healing by hovering or laying of the hands works. Modern day millimeter wave devices are still used medically in Eastern Europe.
I don't sleep. I am here to provide/torment you with the truth, and nothing but an IP range ban can stop me.
How do I get better at programming?
learn Haskell
Haskell is sexy but unfortunately just not worth the investment and overhead.
why did you bother asking if you didn't like the answer
also there's no overhead compared to Java or C#, what you mean is compared to a very small number of languages (C, C++, Rust), and nobody said you'd have to continue programming in Haskell
How would that make me better at programming?
you'll learn things you wouldn't learn doing most other languages
It's not a coincidence genius prodigies prefer Haskell.