dpt - Daily Programming Thread

What are you working on, \g\?

Old thread:

Attached: 003eeff9.jpg (405x500, 37K)

Other urls found in this thread:

youtube.com/watch?v=ov0roDPDBFs
youtube.com/watch?v=uqsZa36Io2M
pastebin.com/dDAn5b60
github.com/Shen-Language/shen-sources/tree/master/sources
twitter.com/SFWRedditVideos

why haven't you installed Shen yet, lisplets?

Attached: waifthon.gif (400x480, 124K)

competitive programming

youtube.com/watch?v=ov0roDPDBFs

>make employer's core product 3 million times faster
>literally save them hundreds of thousands of dollars in server bills
>do this before even starting day one on the job
>HR still tries to haggle over salary

Attached: 1526449401289.jpg (432x403, 18K)

Welcome to being an employee.

>nips in charge of programming
>when you pack your own asset files
>use a static/global 12 char filename buffer
>write the whole buffer to your file entry in the header, because uniformity is nice when parsing
>but then it turns out you forgot the flush the buffer after each use

Attached: unflushed.png (783x497, 106K)

You either show your power level and fight for your soul, or keep it hidden and just get through the day.
Save up money, fund your own startup ASAP.

Seems like japs were lost after the ASM days were largely over. Now half of them can't program for shit.

I've been working on a proof-of-concept implementation of a router for a scalable mesh network, where nodes only need to know about their directly connected neighbors (for routing) and O(log(n)) other nodes in the network (for lookups), but still tend to find the shortest path through the network, in almost all cases, for realistic network topologies. Pic related, the green node is my desktop, everything reachable by going up leads to real hardware (estimated 16-32 nodes running the software), everything reachable going down goes to a simulated network of 598 nodes.

Attached: sim.png (6530x949, 304K)

How does it compare to cjdns?

If you haven't seen it yet, this is one of the best introductory videos for Python ever made:

youtube.com/watch?v=uqsZa36Io2M

Is it even possible to fix/improve this? I need to parse the string between the quotation marks and check against the DB but since users are able to change nickname (I store the previous nicknames) the string becomes obsolete and matches against anything. This is what I've tried so far but it won't even run kek
pastebin.com/dDAn5b60

Attached: 1381726507557.gif (169x119, 83K)

Disclaimer: I'm also the second largest cjdns contributor, after only cjd.

It's addressing the same problem, but with a different approach. The issue with cjdns is that it tries to splice paths together from the DHT, so if the DHT lookup by A, trying to find C, involves asking node B, then the path you actually use will be A->B->C. Going through the metric space avoids that problem.

I'm also using it to test various ideas that I didn't want to test in cjdns. Some of this may find its way back into cjdns at some point. The 598 node map is a map of the cjdns/hyperboria network.

Oh neat. Graph embeddings ftw. I'm surprised people don't use them more.

Why is developer pay so shitty outside the US? I hear about what people earn in places like London and Vancouver and it's absurdly low given the cost of living in those places.

Yeah, it's depressing that so few people bother to try it, it seems like one of the obvious things to check any time you need to navigate a graph.

People making $117k qualify for low-income housing in the bay area. Developers are payed shit, relative to local cost of living, no matter where you look, it's just that the cost of living around tech centers has exploded in the US.

Many developers in Europe would love to earn $117k. Even $80k is a high developer salary in major cities (London, Dublin, Paris, ...) over there, and they're all very expensive to live in.

Right, but the problem is that there's people making $117k who are homeless, due to how insane the cost of living has become in the area. They're getting screwed the same as developers in London or Paris, it's just that the numbers are all bigger.

What's the difference between a stream and a generator? Is a generator just one particular way of modeling a stream?

>homeless on $117k
How is that possible? Are you talking about a family with 5 kids or something? Sure, $117k might not be enough for you to live in Manhattan (I'm not really familiar with the bay area so I'll use NYC as an example), but it's easily enough to let you live in Jersey and commute.

Anyway, got back in the saddle after like 2 weeks, managed to make some headway.

Attached: first attempt.png (658x195, 25K)

I started learning Python and turned into a snake. What am I supposed to do now?

average rent in commiefornia, especially silicon valley STARTS at 2k.
average houses are in the mils, and shitholes in 600k+ range.

Then take into account how many people are married, with kids, etc.

newbie coder here
how can I use an image as a swing panel in netbeans?

Even if you move further out and don't live in the middle of the city? Shock horror, it's called living within your means. For most people if they want a family then they have to make tradeoffs like having a longer commute. By the way, 2k/month rent is easily affordable on a 117k salary.

What's that hex editor?

010 Editor

I started learning JavaScript and turned into an idiot. What am I supposed to do now?

Relocate to wdg.

Design patterns are for pajeets who are incapable of independent thought.

>What am I supposed to do now?
Stop false-flagging.

Design patterns are just function application.

If you choose to have children, is it possible to still be a programmer?

There's not really anywhere else to go. It's a peninsula, you just hit other cities. By the time you move far enough away to matter, you'll be commuting 4+ hours per day.

Also, you will never manage to rent something at $2k/month. Lots of places have studios that they rent out for that price, but they keep them on the market for a long time to collect application fees from people who don't know better by now (demand *far* out-paces supply).

Expect to spend more like 3k for a studio, 4k for a 1 bed/bath, 5+ for anything large enough to support a family. The cost of food is outrageous in all cases, and at this point, it's probably cheaper to drown your kids and hire a good lawyer than it is to pay for daycare.

If the figures you cite are accurate, and apply to everywhere from which a commute is feasible, then why don't more people simply leave for other states?

look up san francisco housing prices and wonder why that area of the country hasn't been razed

Attached: HELLO.png (658x460, 34K)

>then why don't more people simply leave for other states?
because starting a new silicon valley post-silicon valley isn't an easy thing.

You don't need a new silicon valley. A tech job in most states should comfortably pay the bills. You won't find $550k Google salaries there but you also won't find $4k 1 bed apartments.

>5+ for anything large enough to support a family
Isn't having a family, like, a choice?

well the thrill of SV, is the grind to possibly climbing out of poverty and into a high position/CEO/ whatever.
If you move to bumfuck nowhere, there's not much to climb. Which is why retards stay there because they will DEFINITELY be the next *insert overrated hack here*. Also startups are like weeds there so there's always something different. The industry could really use an exodus from commiefornia though.

mod disjointsets {
pub struct Pool {
ids: Vec < usize >,
heights: Vec< usize >
}

impl Pool {
pub fn new(max: usize) -> Pool {
let mut h = Vec::< usize >::with_capacity(max + 1);
let mut i = Vec::< usize >::with_capacity(max + 1);
for e in 0..=max {
i.push(e);
h.push(1);
}

Pool {
ids: i,
heights: h
}
}

pub fn root(&self, i: usize) -> usize {
let mut result = i;
while self.ids[result] != result {
result = self.ids[result];
}
result
}

pub fn connected(&self, i: usize, j: usize) -> bool {
self.root(i) == self.root(j)
}

pub fn connect(&mut self, i: usize, j: usize) {
if self.heights[i] > self.heights[j] {
self.ids[j] = self.root(i);
self.heights[i] += self.heights[j];
} else {
self.ids[i] = self.root(j);
self.heights[j] += self.heights[i];
}
}
}

#[cfg(test)]
mod tests {
#[test]
fn disjointsets() {
let mut f = ::disjointsets::Pool::new(12);
f.connect(3, 8);
f.connect(1, 7);
f.connect(7, 2);
f.connect(5, 6);
f.connect(11, 7);
f.connect(0, 6);
f.connect(0, 5);
f.connect(7, 3);
assert!(f.connected(1, 3));
assert!(f.connected(1, 11));
}
}
}

Attached: 1530372360570.jpg (720x960, 66K)

That doesn't make any sense, Ranjesh. Stop trying to abuse math terminology to sound smart.

From a Darwinian perspective, it's a choice to exactly the same extent that eating and breathing are choices.

>no path compression

Attached: b7329bbd65b7baa70bbb5d447575726f.jpg (850x1113, 79K)

This is what I have for my collision check function.

void CollisionRunAll ( void )
{
// Go through the entity array and check collision
entity_t *ent = first;
while ( ent )
{
// Ignore if no other entities
if ( !ent->next )
break;

// Run through every other entity
entity_t *alt = first;
while ( alt )
{
// Can't check against self
if ( ent==alt )
alt = alt->next;

// Check collision with other entity, move to next
CollisionCheck ( ent, alt );
alt = alt->next;
}

ent = ent->next;
}
}

I was talking about it the other day, but I need to collect my thoughts more. I am certain in a 2D platform game with a maximum of 512 entities that this shouldn't impact performance, not even on toasters. But, for the sake of learning, I would like to figure out a way to optimize this a little more so that instead of running through every "alt" entity to check collision with, it only runs through the ones near it.

I've seen a number of things listed that I could use:

>quadtree
>octotree
>spatial partition grid
>AABB tree

I've spent the past few days trying to figure something out, and I haven't gotten anywhere yet. I will probably figure it out at some point, but an opinion with an example may help me get there sooner.

I am using C, I have gotten good with memory management, but making something like the "List" that I see in C++ code examples has been a bit difficult. I may be over doing it; if I did a grid I would need a way to store a list of what entities are in that spot, and I am not sure what the right approach is.

>transmit user's API key over plaintext HTTP
>include a clause in the TOS that prohibits the user from sharing his API key and blame him for any damages if it falls into wrong hands
The absolute state of Japanese software development.

Attached: __rensouhou_chan_and_shimakaze_kantai_collection_drawn_by_iganseijin__9b2f416320e041adca71950a8c9985 (1250x1250, 1.51M)

How do I go about becoming a programmer? I have some notions about programming from my studies a few years back, but I have been more on the operations side of things for the past years.

There are obviously many courses out there, but most seem seem like "learn language x in y time" and then they go on about how language specific control flow.

Can anyone recommend something for someone that can program, but doesn't know how to build applications?

japs would never dishonor their famry by sharing their API key.

Read source code from large projects if you want to learn how to build large projects. Read blogs to fill in holes and point you in the right directions. Also for books you'll probably want more language-agnostic books and books that hit a specific niche like specialized algorithms or cache-friendly data structures. Learn some algorithm-related math if you have the time too.

oh yeah and don't forget to actually write programs too

Thank you, do you have any favourite blogs?

not the user that asked but when you talk about reading blogs you mean blogs from master programmers in the language you're interested? I always heard that tip for beginners "create a blog and make posts about your learning" and I wonder how am I supposed to do that, where can I create a free blog? should I buy a domain?

Agda? So Haskell is a thing in the past now?

It's become too mainstream for its original audience (contrarians).

Yeah man, it's graduated from being a meme

Attached: g--a-board-of-peace-and-love.png (1320x1005, 284K)

Oopfags

For the builder pattern, if I don't want a lengthy switch/case list in the client, what's a good alternative for choosing what concrete factory to use?

pub fn new(max: usize) -> Pool {
Pool {
ids: (1..=max).collect(),
heights: vec![1; max+1],
}
}

daily reminder
performance > correctness > readability/maintainability

Wow, it got delete. But I found in one of the archive.

Good thing Rust has all three.

i think you need to count again.

>performance > correctness > readability/maintainability
Enjoy your programs leaking user's credentials and no one being able to add new features or fix the bugs. But hey, at least it's fast.

Backslashes are disgusting. Fuck off, winfag.

So how do you guys feel about the new := Python thingy?
It's like an assignment but also an expression, just like in C, so you can write a = (b:=2) + (c:=1) and get a = 3, b = 2 and c = 3.

>Read source code from large projects if you want to learn how to build large projects
kind of a bad idea in some ways because large projects tend to have way too much domain-specific code that you shouldn't really be copying

>I am certain in a 2D platform game with a maximum of 512 entities that this shouldn't impact performance, not even on toasters
if you have 512 entities you do not need a spatial partition
if you have a 2D game with a fixed camera zoom you do not need a hierarchial spatial partition - use a flat grid instead

Python's taking from pascal now?

They should have had a separate variable-definition operator like that since the beginning. Don't stop there, make := throw an error if a variable is already defined and = if it's not, like in Go.

Attached: idea.jpg (1280x720, 124K)

Employed Haskell programmer here

Attached: 1483073157801.jpg (1280x720, 110K)

Alternative for switch/case is a virtual method.

smug

Attached: Untitled.png (1280x720, 799K)

Python is shit, who cares what new flavors it gets.

Attached: guidosicp.png (601x623, 100K)

all dynamic languages suck

Attached: raised.png (1280x720, 1.18M)

Attached: Untitled.png (1280x720, 820K)

>blocks your path

Attached: lua.png (1200x1200, 72K)

would be better if it was statically typed

>\dpt\
That's really retarded. I nearly started a new thread.

some people can't be trusted even with the simplest tasks.

OP is a WiiDOS-fag

>program is really fast
>but it doesn't do what it's supposed to do
Correctness > *

this triggered me aswell

it's within acceptable parameters

But where is the blue turd?

It's more a matter of filters getting fucked up than autism. desu senpai.

>no anime
>backslashes trigger autismos
Nicely done, OP.

Shill your proprietary lisp somewhere else, faggot.

nani?
github.com/Shen-Language/shen-sources/tree/master/sources

You can still smell the parts that suck. If it was any bigger, it would suck.
Unfortunately C and C++ suck at the stuff that is required to interface statically type-checked interpreters to them.

Oh wait, I forgot it was the documentation that was some kind of cash-in.

Users changing nicknames should be a database modify operation if youre expecting to key off it

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

you don't know what lisp is about, fuck tard.

well lispfags have no idea either so it's fine.

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!

Attached: 1505485994399.png (470x545, 336K)

fuck off

>she's going to have her GC tumor removed (eventually);
>Say something nice about her, /dpt/!
It's mascott isn't a retarded gopher.