[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 41
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>55305125

What are you working on, /g/?
>>
friendly reminder that real professional programmers prefer desktop workstations with full-sized and full-featured monitors and keyboards etc
>>
Fucking double posters
55315149
>>
>>55315129
>>55315170
just delete this so we don't have duplicates, he's not gonna budge
>>
File: akari eats chippus.png (131 KB, 256x256) Image search: [Google]
akari eats chippus.png
131 KB, 256x256
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;
}
>>
>>55315197
>const int arr[static const n]
this is not c++, right?
>>
>>55315206
The language is C, idiot.
Also no, it's not valid C++.
>>
File: 1454232515767.png (901 KB, 690x460) Image search: [Google]
1454232515767.png
901 KB, 690x460
>>55315197
>>
File: C++.jpg (105 KB, 603x324) Image search: [Google]
C++.jpg
105 KB, 603x324
>>55315193
>he's not gonna budge
I just did you anime faggots.
>>
>>55315237
>on /g/
>makes fun of anime

I can practically smell the summer from you.
>>
>>55315197
if it actually works it's quite impressive
>>
>>55315162
you have not even see a real professional you pajeet code monkey wannabe.
>>
>>55315237
>pic
friendly reminder that real professional programmers prefer desktop workstations with full-sized and full-featured monitors and keyboards etc

>>55315251
stay delusional projecting kid
>>
>>55315237
>Complaining about the classic /dpt/ image
I want redditfags to leave.
>>
>>55315247
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.
>>
>>55315197
I'll let you know

$ ~/afl-2.17b/afl-clang anon.c
>>
>>55315259
Either summerfag or redditnigger
>>
>>55315259
>classic /dpt/ image
It was Dennis Ritchie, you idiot newfag. Anime shit came later/.

Seriously, you should go back.
>>
>>55315197
unreadable
>>
>>55315307
How about you go back to what ever tech illiterate shit site you came from summerfag.

>hating on anime

You don't belong here.
>>
>>55315327
What, you can't read C?
>>
File: anime-pic.png (2 MB, 2560x1440) Image search: [Google]
anime-pic.png
2 MB, 2560x1440
My super aggressive anti-binary script is set to run EVERY SECOND!
>>
>>55315327
it's about as readable as it gets for what it is

i'd like to see you do better, smug fag
>>
>>55315334
> doesn't realize that he's just been owned

Being this new ...
>>
File: ArduinoUno_R3_Front_450px.jpg (137 KB, 450x296) Image search: [Google]
ArduinoUno_R3_Front_450px.jpg
137 KB, 450x296
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
>>
>>55315281
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
>>
>>55315381
an arduino is too weak to do it properly
>>
1'st off; not >>55315307
2'nd: >been owned

This site is 18+
Come back in a few years please.
>>
>>55315401
can it do it roughly?
I just want to make an autonomous robot that will be happy when it sees a person
>>
>>55315404
> 2'nd: >been owned 18+

Woulda been a good line in the early 2000's.
>>
>>55315384
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.
>>
>>55315439
Again, come back in a few years when you reach the age limit please.
>>
>>55315434
i really doubt it, it's super weak
>>
>>55315498
thats a shame
thanks
>>
>>55315497
> anime child who doesn't know what was the original /dpt/ image
> talks about age limit

Careful there, newfag.
>>
>>55315307
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.
>>
>>55315539
>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.
>>
File: 234145432.jpg (74 KB, 480x480) Image search: [Google]
234145432.jpg
74 KB, 480x480
>>55315531
>calls me newfag
>goes on /g/ and hates anime
>>
>>55315553
It's never too late to start fighting against cancer.
>>
>>55315569
Never too late to kill yourself and decrease cancer populations
>>
>>55315584
So take your own advice.
>>
>>55315352
>Not being event-based.
Off yourself.
>>
File: 202341.png (711 KB, 739x607) Image search: [Google]
202341.png
711 KB, 739x607
>>55315593
>trying this hard
You don't come here often, do you summerfag?
>>
>>55315607
I'm correcting the record while you are shitposting in a Daily Programming Thread. Typical anime fags.
>>
File: 12854648.png (269 KB, 751x407) Image search: [Google]
12854648.png
269 KB, 751x407
>>55315641
>typical anime fags
Thank you for making my point.
>>
File: Terry-Davis.jpg (24 KB, 418x438) Image search: [Google]
Terry-Davis.jpg
24 KB, 418x438
tdavis is streaming TempleOS development again

https://www.youtube.com/watch?v=hxyiafJ7CeQ

Everyone except CIA niggers are welcome to watch
>>
Anyone familiar with the POCO C++ Libraries ? Is it well written ?
>>
>>55315718
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
>>
>>55316581
Your mum is an omicron.
>>
>>55315673
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 <module>
from urllib.request import urlopen
ImportError: No module named request


The full code of the converted script is here
http://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
http://stackoverflow.com/questions/29537298/python-3-urllib-request-urlopen
>>
>>55317202
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
>>
>>55317202
You're attempting to execute a Python 3 script with Python 2 interpreter.
>>
>>55317505
Argh, noob mistake. Thanks.
>>
>>55315197
>vars: n, a, j
I hate that shit.
Write out what they represent goddammit.
>>
File: 1440158957619.png (70 KB, 800x473) Image search: [Google]
1440158957619.png
70 KB, 800x473
>>55315352
You may want to add some more quoting to that script. See my comments inside git-binary.sh.
>>
https://github.com/RubenRocha/ftpscout

lel
>>
File: 1463606423970.gif (152 KB, 400x267) Image search: [Google]
1463606423970.gif
152 KB, 400x267
I need to start a node program and read a float from its terminal output using c++, is this possible??
>>
>>55318125
yes
>>
>>55315865
Is this some A*?
>>
File: 1337547536900.jpg (47 KB, 320x240) Image search: [Google]
1337547536900.jpg
47 KB, 320x240
>>55318139
How???????
>>
>>55318169
FILE *output = popen("node shit.js", "r");
>>
>>55318125
no, this is an open problem in computer science. read Smiths & Paco [2013]
>>
>>55318169
RTFM
>>
Anyone else here have sort of a religious connection to pure randomness?
>>
File: datboiterry.png (246 KB, 637x640) Image search: [Google]
datboiterry.png
246 KB, 637x640
>>55318482
>>
>>55318748
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 <string>, <iostream>, and other libs in the Player.cpp file even though I already have them included in my main.cpp file?
>>
>>55318991
Sure do
>>
>>55318945
what a diagnosis wow
>>
>>55318991
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
>>
>>55319078
kek
>>
>>55319132
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.
>>
>>55319156
this makes 0 sense
>>
>>55319190
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.
>>
File: Jon-Snow-Game-of-Throne.jpg (51 KB, 615x410) Image search: [Google]
Jon-Snow-Game-of-Throne.jpg
51 KB, 615x410
>Signed 0
>>
is SICP a meme book? Will it even help me program well in modern times?
>>
>>55319222
No, even MIT has stopped using it.
>>
>>55319238
Which book do they use instead?
>>
>>55319261
Python: the least bad parts
>>
>>55319261
They take turns fucking your mom's pussy and butthole instead. What a programming class that is! Haha
>>
>>55319278
I agree that Python a scripting language should be taught first instead

>>55319288
Cool a mom joke confirmed for being 12 years old
>>
>>55319304
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.
>>
>>55319304
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.
>>
>>55319338
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.
>>
>>55315194
>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.
>>
>>55319204
You sound like a Markov chain.
>>
>>55319594
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.
>>
>>55319669
Disgusting it needs to be more Java like the best programming language
>>
>>55319694
Which version of Java?
>>
>>55319694
But anon we already have a language like that, it's called Java.
>>
>>55319669
>->
>if (true)
>(x : int) =
Are you pulling random characters out of a hat, son?
>>
>>55319776
Legacy Java of course
>>
>>55319808
All languages are just random characters pulled out of a hat. Still we use them.
>>
>>55319812
Good, generics are unnecessary bloat
>>
Guys lets all program a huge application in php
>>
>>55315197
>iavg(int n, const int arr[static const n])
Is this correct syntax?
>>
>>55315641
>I'm correcting the record
So you #ShillForHill?
>>
File: yolo.jpg (21 KB, 287x261) Image search: [Google]
yolo.jpg
21 KB, 287x261
>>55315246
>>55315334
>>55315352
>>55315531
>>55315539
>>55315552
>>55315553
fuck off weebs
>>
>>55319825
What does = do?
What does the -> prefix mean?

>
(x : int) = print x

>declare a variable x, of type int, to be equal to the result of 'print x'
Is that what it means?
>>
>>55318169
Use pipes
>>
>>55319669

Looks like Lisp had sex with Haskell.
>>
>>55319669
Looks horribly inconsistent. Why do you use the equals sign for lambdas? How do you assign values to variables or check equality? Also you didn't specify the return type for a in the 6th row.
>>
>>55318167
Nope, pure Dijkstra. For A* there is no heurestic.
>>
Which Java IDE should I use, /dpt/?
>>
>>55319585
executables are also pretty small
i'm trying to avoid all non-source code data

>>55318067
someone deleted it while I was away, could you post it again?
>>
>>55320465
IntelliJ
>>
>>55320465
Netbeans or Eclipse
>>
>>55320465
intellij idea is defiently best one

jetbrains really good software company soon to dominate the industry.

you have IDE's for every languag (at least , the important ones)

https://www.jetbrains.com/
>>
>>55320465
None, you should not use Java.
>>
>>55320485
>https://www.jetbrains.com/
i like the part where you felt the need to include a link to their website... shill
>>
>>55315865
I was just in the /webdev/ thread and I thought, these people are idiots. They have no idea and are arguing over practically anything. Then I come to this thread and see a comfy graph searching algorithm.

Sometimes, /g/ isn't SO bad.
>>
>>55320629
Sadly, I fuck up my paste :( there has to be 1st level indention at the last line.
>>
>>55319578
>Java
>SQL
And you are puzzled by your lack of motivation?
>>
Learning C# to write a Discord bot. Still a scrub though.
>>
File: 1462615997556.jpg (809 KB, 1080x1920) Image search: [Google]
1462615997556.jpg
809 KB, 1080x1920
>>55320469
done
>>
>>55320465

Vim works great as a general editor and with the right plugins can function as a full ide.

As for java specific development I really recommend using Eclim if you go the vim route.
>>
File: AXC.png (14 KB, 863x528) Image search: [Google]
AXC.png
14 KB, 863x528
reading C Programming: A Modern Approach
>>
>>55321151
>modern approach
>c89
>>
>>55321185
which book should one read for a "true" modern approach then?
>>
>>55320465
>j*va
poo in loo pajeet
https://www.youtube.com/watch?v=CRUa_09IOVU
>>
File: le middle finger linus.gif (2 MB, 400x360) Image search: [Google]
le middle finger linus.gif
2 MB, 400x360
>>55321232
K&R
>>
What would be the best way to shuffle map values in C++?
>>
What is a good book for learning Python 3? I've looked at a few books in the gentooman library, but I haven't seen anything that looks remotely enjoyable.

Perhaps Python isn't enjoyable?
>>
>>55321151
I loved that book. If you want to get a paper copy, you can get them for $3 used. That's what I did, anyway.
>>
dpt im looking for a programming job

I did some really dumb shit in my life for the last 4 years and now I have no references after graduating (i graduated 4 yrs ago). Even though I had good internships and grades and shit, my former bosses or profs won't reply to me when I ask them if I can use them as references. What do?
>>
>>55321378
???
a map is ordered by definition
how would you be able to shuffle them
>>
File: 1466502798994.png (14 KB, 166x166) Image search: [Google]
1466502798994.png
14 KB, 166x166
https://arxiv.org/abs/1512.03547
>graph isomorphism problem is solvable in quasi-polynomial time
>mfw
What implications does this have on P=NP?
>>
>>55321597
Why would it have any implications on P=NP?
>>
faggots

FAGGOTS
>>
>>55321572
That's why I said "values", not just the pairs. But I guess "scramble" would make more sense? Basically a map has an equal amount of keys and values right? I'd like to randomize the associations.

So say, I have this map:
1 => a
2 => b
3 => c

Calling the function could result in, for instance, this:
1 => b
2 => a
3 => c
>>
Should I really add a license header to each of my source file? It sucks going through 15 lines of legal bullshit each file.
>>
>>55321637
Maybe the problem is in P and all other problems that were previously thought to be in NP would actually be in P, just that we haven't found algorithms for it yet
>>
>>55321688
just make a quick bash script

something like this http://www.cyberciti.biz/faq/bash-prepend-text-lines-to-file/ with a loop for all your files
>>
>>55321688
just have 3 lines: copyright, name of license, and url to license text. if you were using GPL or something you would be looking at pages of license text, which would be insane to paste the whole body of.
>>
>>55321684
Iterate through the map, collecting the values in an array. Shuffle them. Reassign the values to the map.

std::vector<char> list_chars;
for(auto const &kv : my_map)
{
list_chars.push_back(kv.second);
}

// shuffle list_chars

uint i=0;
for(auto& kv : my_map)
{
sv.second = list_chars[i];
i++;
}


Not that pretty but eh
>>
>>55319639
>>55319204
>>55319156

speak english motherfucker
>>
>>55321819
Ah, been considering that but was also wondering if there was a way to make it cleaner, cheers though.
>>
>>55321684
Have a set of keys and a set of values. Randomly pick one from each.
>>
>>55321733
Do this, and win nobel prize
>>
>>55318115
>python
should have made it in Go
>>
File: 34873739434.png (131 KB, 293x344) Image search: [Google]
34873739434.png
131 KB, 293x344
>>55321929
>Nobel Prize
>for math
Also the gap problem for a general nearest-neighbor translational invariant Hamiltonian is found to be undecidable.
https://arxiv.org/abs/1502.04573
>>
In my simple c++ program, destroying an instance of class A, also destroys every other object of class A.
What beginner mistake have I made?
>>
>>55322014
Are you doing something like this?
Class A = new Class();
Class B = A;
>>
>>55322108
No.
Class A object a();
Class A object b();
>>
>>55322014
You may be assigning pointers or references rather than creating new instances.
>>
>>55322253
what post the actual code
>>
just modify the unit test so that it passes
>>
File: 1443384961004.jpg (9 KB, 246x227) Image search: [Google]
1443384961004.jpg
9 KB, 246x227
>Boost
>>
File: 1438781024656.jpg (17 KB, 246x225) Image search: [Google]
1438781024656.jpg
17 KB, 246x225
>>55322713
>>
>>55322283
ok sir
>>
>>55322713
<boost::nightmare::fuel<char>::literal>::save('b');
<boost::nightmare::fuel<char>::literal>::save('o');
<boost::nightmare::fuel<char>::literal>::save('o');
<boost::nightmare::fuel<char>::literal>::save('s');
<boost::nightmare::fuel<char>::literal>::save('t');
>>
File: delete problem.png (38 KB, 1360x623) Image search: [Google]
delete problem.png
38 KB, 1360x623
Hi this problem caused me to delete important data from my DB by mistake, can anyone help troubleshoot why I click to delete and item but it deletes the wrong one?

            <form id=delform action="{{ url_for('delete', job_id=job.id) }}" method="post">
{#<input class="btn btn-xs btn-danger" type="submit" name="delete_job" value="Delete">#}
<a onclick="$('#delform').submit();" class="btn btn-xs btn-danger" id="delete_job" href="#">Delete</a>
</form>
>>
Noob trying to compile an emulator in Linux, want to set the o3 compiler flag to optimize the most, tried to change the existing flag in Makefile but I realized that's the wrong place as it keeps getting overwritten when I try to make
Where's the correct place to set the flag? In the command line or somewhere else?
>>
>>55322861
POST THE MAKEFILE
>>
>>55322871
http://pastebin.com/gMNjCuKe
>>
>>55322861
If it wasn't on -O3 by default chances are it breaks the emulator and you're better off on -O2.
Plus, -O3 doesn't always make it faster, in fact it rarely does.
-O2 is the sweet spot for me between performance and stability.
>>
>>55322888
tl;dr
>>
>>55322888
people who use autotools should be shot
>>
Hi /g/, I'm a junior engineer in machine learning, and I do mostly C++ programmation. I gratuated as an electronic engineer and so my programmation education was kinda secondary. I'm able to do everything I was wondering if there was a consensus on good documentation on C/C++ practices and good way of programming as well as algorithms.

>> TL;DR: Wanna learn to be a better programmer, and do clean C/C++ code.

So far, I got K&R and the Donald Knuth books but that's quite a lot of material, so if anyone has a good concise guide before that, I'm open.
>>
>>55322958
I wouldn't recommend K&R when it comes to styling practices.

Basically, don't be afraid of whitespace or reasonably long function names, and don't over-comment, only comment what is not obvious or tricky.
Spaces between arithmetic operators and spaces after comma operators.
Some people might say to put the opening brace on the same line as the declaration but I personally like to have it on a new line, it looks neater and more logical to me. You're free to disagree with that though.
Also, don't try to hide code.

As for structure, modularize it, don't have functions that are too big and monolithic. Break your program up into logical components.

That's all I can think of off the top of my head.
>>
I'm trying to write a cgi script.
Does the POST query string come in via stdin?

All the documentation seems to assume i want to use perl when I'd rather use C.
>>
>>55323208
What exactly do you mean by POST query string?
If you mean the POST data, yes it does come in via stdin.
If you mean the request URI, then no, that is obtained from an environment variable called REQUEST_URI.
>>
File: ?.png (7 KB, 120x120) Image search: [Google]
?.png
7 KB, 120x120
is there a place online where can i visualize search algorithms in a graph like:

A*, DFS, BFS, etc...

?
>>
how do I learn babbys first HTML and HTTP stuff like GET and POST and all that junk? I'm a c++ dev
>>
I have multiple conditions defined in my unit test like this (pseudo):

bool success = (
a > b &&
c > d &&
name != "anon"
);


Is there any way to figure out which one of those conditions fails and print the actual evaluated condition itself?

For example if "name != anon" fails I want to print that to std out.
>>
>>55323333
No. That's why you use a testing framework and set up conditions like

REQUIRE(a > b);
REQUIRE(c > d);
REQUIRE(name != "anon");
>>
>>55323363
How do those frameworks do it?
I'd really not like to use any 3rd party libraries for this.
>>
>>55323325
Look into CGI, probably.
And setup a web server using apache or nginx or whatever.
>>
>>55323333
if (a > b) {
printf("a > b");
// code here
if (c > d) {
printf("c > d")
// code here
if (name != ''anon'') {
printf("name != ''anon'')
// code here
}
}
}
>>
>>55323333
Use assert.
>>
>>55323388
>I'd really not like to use any 3rd party libraries for this.

If you dont want to use a third party library for unit tests (lol), just separate your test cases out individually.
>>
>>55323278
https://qiao.github.io/PathFinding.js/visual/
>>
>>55323484
thanks, but i was looking for a visualization on a graph not a grid
>>
>>55323333
bool success = (
(a>b || (printf("a>b failed"), 0)) &&
...
);

bool success = true;
if (!(success &= a>b)) printf(" a>b fail");
else if (!(success &= c>d)) printf("c>d failed");
...

or use a function or whatever
>>
>>55323712
kek
>>
>>55320485
yeah for 800$/month or if you are student just 779/month ;^)

fuck off, if they put those for free and open source sure, but they suck
>>
>>55323862
Can't you use Android Studio for non Android projects?
>>
>>55323114
Oh I didn't mean on the syntax, more like for optimizing code and algos implementation. My code is to be used by other teams so I have to overcomment everything and make it simple to comprehend so I don't have to explain them everything.
>>
Is it possible to work out if a program will ever finish running? I have an idea for an app
>>
>>55324334
Yes, if you're restricted to certain kinds of programs.
>>
>>55324377
I want to be able to check it for Android apps.
>>
Anyone have a hex editor that isn't shit? The notepad++ hex editor is fucking atrocious. I just lost an hour of work because it decided to just make the file empty for no reason.
>>
>>55324459
XVI32
>>
>>55324459
wxHex or if you're on Windows then either HxD or WinHex.
>>
>>55324459
hexedit
>>
>>55324459
Vim can edit hex
>>
>>55324459
réddit
>>
>>55324459
You a Brit, m8?
>>
>>55324394
this is called the halting problem
it's comp sci 101 bruh
https://en.wikipedia.org/wiki/Halting_problem
>>
>>55324574
lmao what is this nerd shit hahaha
>>
File: 1439903334301.jpg (226 KB, 850x1201) Image search: [Google]
1439903334301.jpg
226 KB, 850x1201
>spending your time solving fizzbuzz-tier problems and arguing about languages

>Instead of studying 3d mathematics, hard algorithms and machine learning with the goal of building a robot girlfriend

Utterly pathetic, dpt. You cannot build anything worthy because even learning a mere programming language is too hard for you.
>>
>>55324574
Literally not relevant.
>>
>>55324394
android apps run until the system shuts it down or the user swipes right in the "task manager"
>>
>>55324613
lolwut
>>
>>55324606
But I don't want a girlfriend.
>>
>>55324606
I am studying 3D mathematics though. I'm currently using projection to make a 3D collision engine.
>>
>>55324606
I have one actually, but I'm not letting your neckbeard gazes taint her.
>>
>>55324606
How does it feel to have a gf that will never pass the Turing test?
But then again, almost all women wouldn't be able to pass it anyway.
>>
How can I substitute break keyword in C? The only solution I can think of is goto statement.
>>
>>55324637
this

and you're not going to make a robot gf that's equivalent to (or better than) a 3d gf... if anything you should be focusing on growing biological tits and stuff in a lab
>>
>>55324713
how the fuck do you substitute break with a goto?
>>
>>55324606
>machine learning uses arrays
>if that was figured out years ago, FORTRAN would have been the language of AI
>instead researchers wasted time and money on the "symbolic AI" scam/boondoggle which went nowhere

LISPfags BTFO
>>
>>55324737
Jump to a label just after the loop.
>>
>>55324737
break is literally a milder, more constrained form of goto, it's like a goto to jump out of the loop
>>
>>55324754
that's not substitution, jesus christ
>>
>>55324713
#define faggot break
>>
File: 4459353701_826a3c120d.jpg (126 KB, 489x400) Image search: [Google]
4459353701_826a3c120d.jpg
126 KB, 489x400
>>55324765
https://en.wikipedia.org/wiki/Asperger_syndrome
>>
>>55324765
you're right
it's exactly the same thing
>>
>>55324782
>>55324797
i was only pretending to be retarded
>>
>>55315209
https://lkml.org/lkml/2015/9/3/428
>>
>>55324823
>array arguments in C don't actually exist.

wait what
>>
>>55324713
while(n==1)
{
if(//condition for break){n=0;}
if(n==1){//code}
}
>>
>>55324639
That's actually interesting, anon. I'm glad that someone does that stuff. I had a simple collision engine in my physics engine too, should work on it more.

Does your solver support arbitrary meshes or just primitive geometry?
>>
How hard is it to learn Ruby? Looks piss easy.
>>
>>55324863
i think they do exist but the example is equivalent to just a pointer instead of the array
>>
>>55324863
Pretty much any compiler makes it identical to passing it as a pointer. You should just explicitly pass the pointer since it's clearer most of the time.
>>
>>55324896
 require 'lmao' 
>>
>>55324669
>But then again, almost all women wouldn't be able to pass it anyway.
You have said it yourself.

It's not that hard to create a feeling that the entity conversing with you is human. A significant (though smaller than 50%) ratio of people were fooled by this program in 70s: http://www.masswerk.at/eliza/
>>
>>55324891
At the moment it's just primitives, I'm really emphasising getting 3D collision to work on low end machines first so it's more parts of a mesh inside hit boxes. So, an arm and hand is 2-3 hit boxes.
>>
>>55324823
Wow
This place doesn't have a single anon as spergy as Linus
that's some seriously next level sperging
he's flipping his shit over a simple code bug that had already been fixed
>>
>>55324906
>i think they do exist
or probably not in C, i was thinking in terms of C++
>>
File: 1465096824469.png (2 MB, 1200x1726) Image search: [Google]
1465096824469.png
2 MB, 1200x1726
>>55324891
Lmao 3D math isn't interesting unless you're studying 3D TQFTs, where its categorical classification is still an open problem.
Anything involving geometry in 3D have already been done by the Greeks. Computer programming just automates it.
>>55324935
>he wants an immortal woman constantly nagging by his side
>>
>>55321185
2nd edition fully explains C99

>>55321232
It's a good book, I started programming with it as well
>>
>>55324888
Wow what a fucking retard. That's not even remotely the same as a break.
>>
>>55324976
>>he wants an immortal woman constantly nagging by his side
you're dating/imagining trash if you think all they do is nag, some women don't nag at all, and how do you expect your robot gf to be anything more than just a meh tier tech demo
>>
>>55324965
>he's flipping his shit over a simple code bug that had already been fixed

After all this years maintaining the Linux kernel, Linus is just tired of incompetent people
>>
File: Deepmind_Labyrinth.jpg (528 KB, 1600x1203) Image search: [Google]
Deepmind_Labyrinth.jpg
528 KB, 1600x1203
>>55324753
Lisp is nice but it isn't a language of AI nowadays.

Currently, Python and Lua are unironically THE languages of AI, they are used in Tensorflow and Torch. These frameworks are used by Deepmind, OpenAI and FAIR to build their machine learning models, including most advanced general AIs (picrel. is deepmind's AI training environment).
>>
>>55324976
Fuck off gaylord. If you make the next thread I will report you for shit posting.
>>
>>55325002
it produces the equivalent result dumbass
>>
>>55325002
back the fuck off?
>>
>>55324965
that's what you do when retards try to shit up your codebase
>>
>>55325022
Why? They're both shit.
>>
>>55321597
http://mathoverflow.net/questions/223420/what-are-the-implications-of-the-new-quasi-polynomial-time-solution-for-the-grap

>The short answer is that there are no implications.
>>
>>55324965
it's what he does for a living, he has other people write his code and teaches them how to write it properly
>>
File: 1466502818163.png (37 KB, 299x197) Image search: [Google]
1466502818163.png
37 KB, 299x197
>>55325059
Thanks anon.
>>
>>55325049
Probably because people who need to do real work don't care about the opinions of anonymous shitposters.
>>
>>55324818
>>55324797
>>55324782
you're all retarded
>>
How do I create a dictionary of synonyms that is efficient in terms of retrieving synonyms of a word?

Basically, I want to use some sorts of data storage to store groups of words, and enable an end-user to request any word and be prompted with all the other words in its group (its synonyms). Afterwards, I want to be able to add spelling corrections, suggestions, and relevancy ranking (using edit distance for example).

Also, some groups may contain the same word, so I would like to return both groups separately.

Any ideas how to get there? Any particular database, data structures, concepts, etc. that could help?
>>
>>55324976
>Anything involving geometry in 3D have already been done by the Greeks. Computer programming just automates it.

Lol you clearly aren't following the field.
>>
>>55325119
cum again?
>>
>>55325113
take anon's hypothetical robot gf as an example, it's a substitute for a real woman gf, it doesn't have to be exactly the same to count as a substitute
>>
>>55325119
Cum again?
>>
>>55322761
Can anyone please look at this, I even provided a tonne of pictures so you can help
>>
>>55325110
>'real work'
The field is about 10 years behind where it could be because of shitty langs like Python.
>>
>>55325131
>>55325155
i don't think the greeks did this

https://mollyrocket.com/849?node=849
>>
>>55325164
If you say so, anon.
Thread replies: 255
Thread images: 41

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.