/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=hxyiafJ7CeQ
pastebin.com/H6XKSKjw
stackoverflow.com/questions/29537298/python-3-urllib-request-urlopen
github.com/RubenRocha/ftpscout
twitter.com/NSFWRedditImage

friendly reminder that real professional programmers prefer desktop workstations with full-sized and full-featured monitors and keyboards etc

Fucking double posters
55315149

just delete this so we don't have duplicates, he's not gonna budge

I'm working on an anonymous git hosting service!
You can pull or make commits without any authentication!
git clone git://tempgit.mooo.com/dpt-repo.git

I also added a super aggressive script that force resets any commits that contain pictures!
When i figure out how to handle forms, I'll fix the "new repo" form.

Rate my arbitrary integer averaging function, with no integer widening or overflow:
int iavg(int n, const int arr[static const n])
{
int avg = 0;
int rem[2] = {0, 0};
int add[2] = {0, 0};

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int a = abs(arr[i] % n);
int j = arr[i] < 0;

if (rem[j] >= n - a) {
rem[j] = a - (n - rem[j]);
++add[j];
} else {
rem[j] += a;
}
}

avg += add[0] - add[1];

if (avg < 0 && rem[0] > rem[1])
++avg;
else if (avg > 0 && rem[0] < rem[1])
--avg;

return avg;
}

>const int arr[static const n]
this is not c++, right?

The language is C, idiot.
Also no, it's not valid C++.

...

>he's not gonna budge
I just did you anime faggots.

>on Sup Forums
>makes fun of anime

I can practically smell the summer from you.

if it actually works it's quite impressive

you have not even see a real professional you pajeet code monkey wannabe.

>pic
friendly reminder that real professional programmers prefer desktop workstations with full-sized and full-featured monitors and keyboards etc

stay delusional projecting kid

>Complaining about the classic /dpt/ image
I want redditfags to leave.

I haven't formally proved that it's correct, but I'm pretty confident that it works.
I got started trying to do it, but ended up losing motivation.

I'll let you know

$ ~/afl-2.17b/afl-clang user.c

Either summerfag or redditnigger

>classic /dpt/ image
It was Dennis Ritchie, you idiot newfag. Anime shit came later/.

Seriously, you should go back.

unreadable

How about you go back to what ever tech illiterate shit site you came from summerfag.

>hating on anime

You don't belong here.

What, you can't read C?

My super aggressive anti-binary script is set to run EVERY SECOND!

it's about as readable as it gets for what it is

i'd like to see you do better, smug fag

> doesn't realize that he's just been owned

Being this new ...

Is it possible to do fully portable face tracking with an arduino?
Everything I can find uses openCV and I think requires it to be communicating with the computer constantly to function

you could probably get your 15 minutes of fame with it on hackernews or reddit or something. preface it with how hard it is to average even two ints in C with truncation etc

an arduino is too weak to do it properly

1'st off; not 2'nd: >been owned

This site is 18+
Come back in a few years please.

can it do it roughly?
I just want to make an autonomous robot that will be happy when it sees a person

> 2'nd: >been owned 18+

Woulda been a good line in the early 2000's.

I only wrote it because I wanted to end the stupid averaging ints meme on here.
Now if anyone brings it up, I can show them that I can average an arbitrary number of integers, at least in the range 0 to INT_MAX.

Again, come back in a few years when you reach the age limit please.

i really doubt it, it's super weak

thats a shame
thanks

> anime child who doesn't know what was the original /dpt/ image
> talks about age limit

Careful there, newfag.

Actually, it was anime first, then it was Dennis Ritchie, and now it's a mix of both + cancer.
Source: I've been here longer than you.

>Actually, it was anime first, then it was Dennis Ritchie

You remember when Ritchie came back not when DPT started.

That means you're a newfag.

>calls me newfag
>goes on Sup Forums and hates anime

It's never too late to start fighting against cancer.

Never too late to kill yourself and decrease cancer populations

So take your own advice.

>Not being event-based.
Off yourself.

>trying this hard
You don't come here often, do you summerfag?

I'm correcting the record while you are shitposting in a Daily Programming Thread. Typical anime fags.

>typical anime fags
Thank you for making my point.

tdavis is streaming TempleOS development again

youtube.com/watch?v=hxyiafJ7CeQ

Everyone except CIA niggers are welcome to watch

Anyone familiar with the POCO C++ Libraries ? Is it well written ?

your mom is well written

Nothing spectacular. Just chilling at path finding
from collections import OrderedDict

nodes = {
"a": {"a": 0, "b": 4, "c": 1},
"b": {"b": 0, "d": 2},
"c": {"c": 0, "b": 5, "d": 6},
"d": {"d": 0, "k": 7},
"k": {"k": 0}
}

map = OrderedDict(sorted(nodes.items(), key=lambda kv: kv[0]))

edges = {"a": 0}
path = OrderedDict({"a": "start"})

for n, e in map.items():
m_e = min(e, key=e.get)
for _n, _e in e.items():
if edges.get(m_e, 99) + _e < edges.get(_n, 99) and _n not in edges:
edges[_n] = edges.get(m_e, 99) + _e
path[_n] = m_e


def trace(path, dest):
if dest not in path:
return

prev = path[dest]

trace(path, prev)
print(dest)

>tfw you finally grasp asymptotic notation
Also, apparently the O in Big O is actually an omicron

Your mum is an omicron.

Is it not so every single day? I like it tho

I have invented the most retarded Rakefile:

require "rake/clean"

srcdir = "src"
objdir = "obj"
sources = Rake::FileList["#{srcdir}/*.c", "#{srcdir}/*.cpp"]
objects = sources.pathmap("#{objdir}/%n.o")

BINARY = "main"
CLEAN.include("#{objdir}/*.o")
CLOBBER.include(BINARY)

class Compiler
def initialize command, flags, libs
@command = command
@flags = flags
@libs = libs
end

def build source, target
`#{@command} #{@flags} #{source} -o #{target} #{@libs}`
end
end

CC = Compiler.new("gcc", "-std=c11 -O2 -g -c", "")
CXX = Compiler.new("g++", "-std=c++14 -O2 -g -c", "")
LD = Compiler.new("g++", "", "")

sources.each do |src|
ext = src.pathmap("%x")
obj = src.pathmap("#{objdir}/%n.o")
case ext
when ".c" then
task obj => src do |task|
CC.build(task.source, task.name)
end
when ".cpp" then
task obj => src do |task|
CXX.build(task.source, task.name)
end
else
end
end

task BINARY => objects do
LD.build(objects.join(" "), BINARY)
end

task :default => BINARY

Trying to update a python script for Python 3 because I was bored and I've been using this script a lot in the last few days and thought I might as well see how updating a script is

Never actually programmed in Python before, only C#, Java etc, it doesn't seem too hard, only some annoyance when some older libs got changed by the 2to3 program

This error comes up

% python ./FunKeyCIAPy3.py -title 0004000000165700 -nfskeyfile
Traceback (most recent call last):
File "./FunKeyCIAPy3.py", line 13, in
from urllib.request import urlopen
ImportError: No module named request

The full code of the converted script is here
pastebin.com/H6XKSKjw

The imports I think it needs have been added, but they might be wrong

Was going to try what the 2nd answer (Bogdan) here says
stackoverflow.com/questions/29537298/python-3-urllib-request-urlopen

I'm on Ubuntu 16.04 btw. I have a feeling some modules are missing, but I have both Python 3.5.1 and 2.7.11 installed

You're attempting to execute a Python 3 script with Python 2 interpreter.

Argh, noob mistake. Thanks.

>vars: n, a, j
I hate that shit.
Write out what they represent goddammit.

You may want to add some more quoting to that script. See my comments inside git-binary.sh.

github.com/RubenRocha/ftpscout

lel

I need to start a node program and read a float from its terminal output using c++, is this possible??

yes

Is this some A*?

How???????

FILE *output = popen("node shit.js", "r");

no, this is an open problem in computer science. read Smiths & Paco [2013]

RTFM

Anyone else here have sort of a religious connection to pure randomness?

...

I just created a true RND number generator.

It's called Katy t3h PeNgU1N oF d00m because as u can see she very random!!!!

you're both impotent and infertile. you can't have children. your cum is worthless

beginner c++ question:

I have Player.h, Player.cpp and main.cpp. Do I need to separately include , , and other libs in the Player.cpp file even though I already have them included in my main.cpp file?

Sure do

what a diagnosis wow

If you use them in player.cpp, yes.

#include literally just copies and pastes the file contents. e.g. if you do #include "myfile.whatever" in main.cpp, then main, after the preprocessor is executed, will contain the contents of myfile.whatever, followed by the contents of main.cpp

p.s. never #include .cpp files. ever.

Do libraries use different spellings in the UK? E.g. is the Java class called 'Colour' over there instead of Color? How does it work if an American tries to compile British code, do you have to speechify a flag to the compiler (and what if you've got mixed code?)

There is literally nothing wrong with Java

kek

I am going to be a good time to get the same time as I have a great day and I will be in the morning.

this makes 0 sense

Hi all I'm trying my hand on her face to be the first place I have been sent using a good day I got it to be the first place I have been sent.

>Signed 0

is SICP a meme book? Will it even help me program well in modern times?

No, even MIT has stopped using it.

Which book do they use instead?

Python: the least bad parts

They take turns fucking your mom's pussy and butthole instead. What a programming class that is! Haha

I agree that Python a scripting language should be taught first instead

Cool a mom joke confirmed for being 12 years old

Python script for a while and then you will have a great weekend too much of a new one and I will be in the same time as the original owner of this email, the same time as I have a great day ahead of the day and time of year again.

Too close to home, or... too close to the bone [spoiler]in your mom's butthole (YEEEEEEAAAAAAH!!)[/spoiler]?

Reply to this comment if you're entertained by how much I'm #rekking this guy.

Hi there I have to be the same time to time and effort you put the money to buy the same thing with the other hand I will have to go with the other hand I will have to go with the other hand I will be a good day please find my CV for a while back I have a nice day best regards David sent from Samsung Mobile no longer have the right side of my resume for you and your wife is a very nice to hear that you can see the attachment of your website and the rest of my resume.

is lua a cutie?

Anyone else get really bored of a programming problem once they figured out the initial problem?

I have to write a database related program, and the core-issue is figuring out the (complex, non-trivial) SQL queries. But once i got them to work, i don't even want to bother writing the actual Java code anymore.

>and commits that contain pictures
I think it would still be easy to abuse; just commit a file of junk/random data.

Perhaps consider just having a file size limit? Text files are pretty small.

You sound like a Markov chain.

Thanks for the first time I am going to be a good time to get the same time as I have a great day and I will be in the morning and I will be in the future.

Continuing work on my programming language.

Tokenizer is coming along nicely. Also just switched to TDD, so... writing a lot of test cases right now.

// function with parameters
sum : fn (x : int, y : int) -> int
-> x + y

// calling a function received as parameter
another : fn (a : fn(x : int, y : int), y : int) -> int
if (true)
-> a(5, y)
else
-> y

// lambda function
(x : int) = -> x
(x : int) = print x

// using lambda as parameter
somefunc((x : int) = print x)


A snippet of the language at it's current state, but obviously as it's very much in the early states, anything could change. Also that code isn't parsed yet correctly.

Disgusting it needs to be more Java like the best programming language

Which version of Java?