[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: 31
File: it's a trap.png (873 KB, 1275x677) Image search: [Google]
it's a trap.png
873 KB, 1275x677
Anime Edition

Do you hate anime? If so, please fuck off.
Please DO NOT discuss your hatred of anime on the way.

What are you working on, /g/?

Previous thread: >>55407923
>>
>>55414062
>Anime Edition
>
>Do you hate anime? If so, please fuck off.
>Please DO NOT discuss your hatred of anime on the way.
It's like you are asking for it.
>>
This is the best /dpt/ in a while, thanks guys
>>
>>55414062
>when OP thinks he's boss of the thread
Your waifu is not technology.
>>
QUICK! make a square root function
>>
>>55414556
function sqrt(num) {
return Math.sqrt(num);
}
>>
>>55414556
√ 2
>>
File: ada.png (4 MB, 4800x2700) Image search: [Google]
ada.png
4 MB, 4800x2700
Is Ada any good?
>>
>>55414556
double sqRrt(double n){
while(true){
int x = rand();
if(x*x == n) return x;
}
}
>>
>>55414595
damn i memed too hard and mixed up types

making all these shitty meme code snippets is probably going to sneak up on me and fuck me up in the future where i accidentally do something like this because of muscle memory
>>
>>55414556
double sqrt(int x) {
if (x == 4)
return 2.0;
else if (x == 9)
return 3.0;
else if (x == 16)
return 4.0;
else
throw;
}


Fits all the unit tests
>>
>>55414595
lel
>>
File: rms pajeet.jpg (429 KB, 654x726) Image search: [Google]
rms pajeet.jpg
429 KB, 654x726
>>55414575
you have learned well my son
>>
What kinds of side projects do you guys put on your portfolio to show off to employers?

What kind of projects would impress the average recruiter the most, not including language and framework skills?
>>
Where are the Lisp generals?
>>
>>55414728
They're dead
Like the language
>>
>>55414744
*languages
>>
>>55414744
No pretty sure they moved to some other chan because the shitposting here was just too high.

I just don't remember which.
>>
>>55414757
Isn't Lisp just a singular language because it has dialects?
>>
>>55414777
Is C++ just a C dialect?
>>
>>55414797
No it's like German and English
>>
File: erina.gif (846 KB, 500x485) Image search: [Google]
erina.gif
846 KB, 500x485
Downloading anime images.
Currently at image #2359 of the 2929 I need to download for my Usenet indexer.
It's taking a while because I have to space the requests 5~ seconds apart so I don't get b&
>>
first for Go lightweight threads
>>
>>55414839
Could you upload them for us poor souls to see? Can you post a link in these threads when you are done?
>>
File: 186710.jpg (96 KB, 353x500) Image search: [Google]
186710.jpg
96 KB, 353x500
>>55414859
They're just boring boxart images like this, nothing interesting.
>>
>>55414897
I am still interested, so if you do not mind, I would really appreciate if you posted them :3
>>
>>55414062
how do I initialize a pointer to a struct in another structs constructor.
struct stuff1
{
stuff1()
{
*stuff=stuff2(5);
}
stuff2* stuff;
}

struct stuff2
{
stuff2(int x)
{
y=x;
}
int y;
}
>>
>>55414980
what the fuck
>>
>>55414980
struct stuff2;

struct stuff1
{
stuff1()
{
stuff = new stuff2(5);
}

~stuff1()
{
delete stuff;
}

stuff2 *stuff;
}

struct stuff2
{
stuff2(int x)
{
y = x;
}

int y;
}
>>
>>55415006
If you're going to bully me at least make it make my cock hard
>>
Okay /dpt/, here's my problem.

I want to be able to program in multiple languages, all from the same IDE/editor, with first-class autocomplete/refactoring/debugging support for every language.

I have used emacs for a little over a year, and it has been great so far, but I really need to write java too, and emacs has subpar support for java.

What are my options for a fully integrated Java, C, C++, Python, and HTML5 development?

So far, Eclipse is literally the only one that meets these requirements.

>inb4 jetbrains products
I don't want to fork over the cash for clion and the like
>>
>>55415100
Could just use IntelliJ for Java and Emacs for everything else unless you want to keep it all in one environment.
>>
>>55415100
>>55415124
Ignore me, I didn't read the first part of your post closely enough
>>
>>55415016
So I just tested a few variations of this and it doesnt have to be on the heap. But stuff2 does have to be before stuff1. Problem is stuff one is a class in a different header file.
>>55415006
???
>>
>>55415100
obviously no single ide is best for all languages
pycharm is best python ide
visual studio is best C++ ide
eclipse is simply ok at most
>>
do you think my programming knowledge will be useful if i was transported to a fantasy world?
>>
File: quadbot.png (267 KB, 1920x1080) Image search: [Google]
quadbot.png
267 KB, 1920x1080
>>55414700
Currently working on a raycast "engine". Started as a uni project but I still add some functionality to it from time to time.

Pic related: 1920*1080
1 light source
5 maximum reflection bounce for light
458709 object in scene
render time: 63079ms (which is pretty good for a raycast based methode)
>>
>>55414623
This is what a neural network would essentially boil down to
We still don't have any proper notion of what it means to be intelligent ;_;7
>>
>>55415193
some fa/tg/uy wrote a long story about that

tl;dr: no
>>
>>55414062
Kill yourself you fucking degenerate weaboo
>>
>>55415208
>This is what a neural network would essentially boil down to
No
>>
>>55415193
Yes if you know how to make water logic gates and understand the concept behind assembly. Itd take years before you had a working water computer though.
>>
I can't wait for dpt to become the new desktop threads. Next time don't forget to post cartoon cp :')
>>
I feel like there's enough content for programming/cs to have it's own board?
>>
>>55415293

Hivemind

I was thinking the same thing at the same second just now
>>
>>55415293
No this is the solution:

/phi/

Mathematics, philosophy & programming
>>
>>55415240
yes
>>
>>55415293
We could make our own .+chan as a community project but the issue would be getting someone to host it.
>>
>>55415312
I feel like the former 2 overlap with /sci/?
>>
>>55415203
>tfw i will never be smart enough to program physics simulations

It seems so damn interesting, too

How did you get started with that kind of stuff?

Did you take physics-related classes to get a head start?
>>
>>55415356
No, half of /sci/ hate philosophy because they're science wankers, and it'd be good to divorce mathematics from the science board (mathematics is not a science, no matter how many times scientists claim so)

More to the point, there is a strong link between the three and all of them sometimes occur on /sci/ but would be better off relegated to their own board
>>
>>55415375
A mathematics board would become filled with threads about 0 not being a number, 0.99... != 1, and spivak shills
>>
>>55415411
you mean with 1 thread
>>
>>55415432
This whole thread is cringe
>>
>>55415411
Maybe like on /g/ there's a daily fizzbuzz, there could be a daily 0.99 ... != 1
>>
>>55415489
0.99.. != 1 in surreal number theory
>>
>>55415504
How can you be this stupid?
>>
>>55415548
1 - ε != 1
>>
Newest edition to the continuing rust chip8 emulator.. Literally procrastinating to the point of insanity.

let op = (self.mem.ram[pc] as u16 << 8) | (self.mem.ram[pc+1)


100% sure I'd be done with this project in only 100 or 200 more lines of code if I could just decide on a fucking rendering / sound library to use.

I mean interpreting the opcode is literally just a simple fucking match statement using opcode & 0xf000.
>>
File: v&.png (35 KB, 475x122) Image search: [Google]
v&.png
35 KB, 475x122
What's the best programming language for reasoning about abstract algebra?

>>55415570
>kid
Reported for rape
>>
>>55415581
Python
>>
>>55415598
Please take my question seriously
>>
>>55415581
mathematica
>>
>>55415581
>What's the best programming language for reasoning about abstract algebra?
Agda
>>
File: dafukisthis.png (251 KB, 1920x1080) Image search: [Google]
dafukisthis.png
251 KB, 1920x1080
>>55415360
Master degree in computer sciences - image synthesis and analysis.

No physics classes needed, computing classes in image synthesis. This is just math. Vector arithmetic, intersection equation between ray and triangle/sphere/plane.

There is no physic simulation here (no collision, gravity, ...) just rendering. Except maybe for the lightning but it's more an approximation than a simulation.

Also no need to be super smart to do something like this. You just need proper guidance (and time). Most of the math I needed to do I took from research papers.
>>
Anyone contribute to any cool projects lately? I'm bored of working on stuff that never leaves my harddrive. Would be nice to work on some shared projects for a change.
>>
Making a 3D cheese pizza MMORPG in WebGL.
I'm gonna prob stream it live on YT
>>
>>55415140
You can forward declare struct2 in struct1's header and then include struct2's header in struct1's implementation.
>>
>>55415691
Thanks for the reply, that's reassuring.

Let's say I am a CS undergrad who has taken math classes up to Calculus II and discrete mathematics.

From this point, where should I go to study image analysis and the required math on my own?

Could you recommend some good textbooks or tutorials on these topics?
>>
>download rapidxml
>try to write xml to a file
>bug in rapidxml

into the trash it goes

using c/c++ makes my head hurt sometimes.
>>
>>55414556
Let me give it a shot.
Using newtons method:

fn sqrt(n: f64) -> f64 {
use std::f64;

if n < 0.0 {
f64::NAN
} else {
let minacc = 0.000000001;
let mut x1: f64 = 1.0;
let mut x0 = 0.0;
while (x1 - x0).abs() > minacc {
x0 = x1;
x1 = x0 - (x0*x0-n)/(2.0*x0);
}
x1
}
}


Also created some test cases:

trait ApproxEq {
type Rhs;
fn aeq(&self, &other: Self::Rhs) -> bool;
}

impl ApproxEq for f64 {
type Rhs = f64;
fn aeq(&self, other: f64) -> bool {
return (self - other).abs() < 0.000001;
}
}

#[cfg(test)]
mod test {
use super::{sqrt, ApproxEq};

#[test]
fn values_test() {
assert!(sqrt(0.0).aeq(0.0));
assert!(sqrt(1.0).aeq(1.0));
assert!(sqrt(2.0).aeq(1.4142135623731));
assert!(sqrt(4.0).aeq(2.0));
assert!(sqrt(3.0).aeq(1.73205080756888));
assert!(sqrt(100.0).aeq(10.0));
assert!(sqrt(1024.0).aeq(32.0));
assert!(sqrt(1337.0).aeq(36.5650105975644));
assert!(sqrt(8001.0).aeq(89.4483090952534));
assert!(sqrt(9001.0).aeq(94.8736001214247));
assert!(sqrt(9000000.0).aeq(3000.0));
assert!(sqrt(9000001.0).aeq(3000.00016666666));
}

#[test]
fn test_invalid() {
assert!(sqrt(-0.1).is_nan());
assert!(sqrt(-1.0).is_nan());
assert!(sqrt(-1000.0).is_nan());
assert!(sqrt(-1e308).is_nan());
assert!(sqrt(sqrt(-1.0)).is_nan());
}
}

fn main() {
}


Result:

$ cargo test
Compiling sqrt v0.1.0 (file:///sqrt)
Running /sqrt/target/debug/sqrt-825e747ad4fc9b25

running 2 tests
test test::test_invalid ... ok
test test::values_test ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured
>>
>>55415769
>can't even square root negatives
>>
>>55415565
but 1 - epsilon is not 0.99...
>>
>>55415375
Philosophy belongs on /lit/ anyways.
>>
>>55415769
rust looks like shit
>>
>>55415807
No it doesn't, /lit/ is for books and literature
>>
File: sqrt.png (16 KB, 448x276) Image search: [Google]
sqrt.png
16 KB, 448x276
>>55415812
I think it's alright.
It's very specific about the types on interfaces that could be exposed.
>>
Anyone have any useful batch scripts?
>>
File: fuck.jpg (146 KB, 850x850) Image search: [Google]
fuck.jpg
146 KB, 850x850
Heyyyy /g/ sempai~~~~~~~~~~~
I just got debian installed and I need something to program in c so give me something to work on
>>
>>55416030
Recreate wolfenstein 3d
>>
>>55416030
Write a wayland compositor.
>>
>>55416030
Make a terminal based text editor
>>
>>55415769
>
(x1 - x0).abs()

What the fuck?
>
fn aeq(&self, other: f64) -> bool {

JUST
>>
How much can you make working remotely?
>>
>>55414556
sqrt x = max [a ^^ 2 | a <- rat, a ^^ 2 <= x]
rat = rat 1
rat n = [p / q | p <- [1..n], let q = n + 1 - p] ++ rat (n + 1)

: ^ )
>>
>>55415839
It's like you've never been there.
>>
>>55416123
> 1
>>
File: three_lights_RGB.png (206 KB, 1920x1080) Image search: [Google]
three_lights_RGB.png
206 KB, 1920x1080
>>55415691
The math in image synthesis are mostly (not so surprisingly) geometric stuff you probably know (or knew) about (matrix, vectors, trigonometry, ...)

If you are interested in this kind of stuff I'd recommend looking into classic 3D rendering with OpenGL: http://www.opengl-tutorial.org/ (really great tutorials there!)

This is for real-time GPU-based image rendering unlike my project which use a raycast technique (non-real-time CPU-based) but the math is mostly the same the same.

If you wanna look into racasting I just found this: http://www.cs.virginia.edu/~gfx/Courses/2010/IntroGraphics/Lectures/6-RayCasting.pdf (the only stuff I have are in French so not really helpful to you I suppose... )
>>
>>55416123
>How much can you make working remotely?
maximally? Notch is worth like $1.5 billion
if you mean
>How much can the average professional expect to make working remotely?
then around $100/hour
>>
>>55415729
see
>>55416182
i fucked up the reply...
>>
File: hhhh.png (170 KB, 1108x582) Image search: [Google]
hhhh.png
170 KB, 1108x582
Animu indexer now with images
>>
WHERE'S THE ANIME?
FUCK!
>>
Can someone post the image with the project listings? Id like to do a roll for one.
>>
>>55416210
Source code? Language?

>>55416321
https://dpt-roll.github.io/
https://better-dpt-roll.github.io/

Use the number from the post you just made
>>
I appreciate the work you're doing /g/ janitor.
However, you really need to request a ban them for a few days, otherwise they'll just keep doing it.
>>
need help with this function:

void read() {   //sign in

char user[20], pass[20], line[50];
printf("\nUsername: ");
scanf("%s", user);
printf("Password: ");
scanf("%s", pass);

FILE *info;
info = fopen("info.csv", "r");

while (fgets(line, sizeof(line), info) != NULL) {

char *USER = strtok(line, ",");
char *PASS = strtok(NULL, ",");

// printf("username: %s\n", USER);
// printf("password: %s\n", PASS);

int mUsername = strcmp(user, USER); // string comparison functions
int mPassword = strcmp(pass, PASS); // returns 0 iff strings are equal

if (mUsername == 0 && mPassword == 0) {

fclose(info);
loggedIn();
exit(EXIT_SUCCESS);

} else {

continue;

}

}

printf("\nINVALID USERNAME OR PASSWORD... EXITING...\n");

}


Every time i compile the program just skips the if statement and says username and password is invalid, i assume it has something to do with memory allocation, can someone please help thanks lol first timer
>>
File: 1461729611881.gif (748 KB, 245x245) Image search: [Google]
1461729611881.gif
748 KB, 245x245
Interested in learning Java so i can do macros in STAR-CCM+ (CFD software). Friend from EE told me to learn C++. What do?
>>
>>55416497
lol wtf is pass amirite
>>
>>55414062
This is not /b/ go away with your traps.
>>
>>55416501
Learn C++. Java is shit
>>
>>55416534
this

>>55416501
stay away from Java
>>
>>55416501
They're pretty much identical anyway.
>>
File: raytracer.jpg (72 KB, 640x693) Image search: [Google]
raytracer.jpg
72 KB, 640x693
>>55416182
Interesting stuff!

I made a path tracer and a raytracer for my bachelor CS graphics course,

Img is the whitted-style ray tracer in c# using OpenTK. Renders in real time with around 4-5 fps on my 2500k.

You can actually implement these things on a GPU (using OpenCL or something) and get a lot more fps.
>>
>>55415723
I honestly cant get it. Im starting to think that its because there are functions which have to be called from the main class or something.
>>
>>55416497
How do you know it skips the if statement, do you run a step-by-step simulation?
Have you checked to see if the if statement is false for some reason?
>>
File: 1462148809830.png (297 KB, 720x405) Image search: [Google]
1462148809830.png
297 KB, 720x405
>>55416534
Thanks, he told me that if you know C++ java is going to be a walk in the park, and from what i know, people from EE really hate java.

>>55416554
Mokkochi best gril, sorry
>>
>>55416393
Source is in a private repo at the moment, just because it's a bit messy and mostly uncommented.

Python 3 used for
>downloading Usenet headers
>generating XML files
>interacting with aniDB
>downloading files and running them through ffprobe

Python 2 used for
>flask

and a small amount of C used for decoding Usenet content. Also Postgres for the database and searching.
>>
>>55416632
>Python
I thought 4chan was 18+
>>
>>55416597
yes i attempted all of that when i was trying to debug the damn issue...
the if statement is false, i just don't get why it is false, it works when i comment out some stuff, but this isnt good too me... without it conditioning both usernames and passwords
  while (fgets(line, sizeof(line), info) != NULL) {

char *USER = strtok(line, ",");
char *PWD = strtok(NULL, ",");

// printf("username: %s\n", USER);
// printf("password: %s\n", PWD);

int mUsername = strcmp(user, USER); // string comparison functions
// int mPassword = strcmp(pwd, PWD); // returns 0 iff strings are equal

if (mUsername == 0 /* && mPassword == 0 */) {

fclose(info);
loggedIn();
exit(EXIT_SUCCESS);

} else {

continue;

}

}

printf("\nINVALID USERNAME OR PASSWORD... EXITING...\n");

}
>>
File: 1462046585096.png (1 MB, 1200x1800) Image search: [Google]
1462046585096.png
1 MB, 1200x1800
>>55416646
It just werks
>>
Made some progress today. Learning Python.

I kind of understand whats going on in this code, but can someone explain it like I'm 5? Let me know if my notes are wrong.


#importing module
from sys import argv

#setting the arguments you must type before running script.

script, filename = argv

#assigns txt variable to filename typed in the argv. opens said file.
txt = open(filename)


print "Here's your file %r" % filename
#prints what is typed from the txt variable. No paramaters are set.
print txt.read()

print "Type the filename again:"
#asks user to retype filename , assigning it to "file_again"
file_again = raw_input("> ")

#assigns txt_again to open(file_again)
txt_again = open(file_again)


#prints what is typed from the txt_again variable, which is the file_again variable.
print txt_again.read()

>>
>>55416655
Perhaps you have spaces before the '\0' character and that's enough to mess up the comparison without you noticing when you see the string printed out in the console.
I made a server in C a few months back that operated a database and I remember I had a ton of weird problems like the one you're having when manipulating the SQL requests and responses from the DB.
>>
File: PythonProgramming2nd.jpg (45 KB, 200x241) Image search: [Google]
PythonProgramming2nd.jpg
45 KB, 200x241
Reminder that pic related is a much better introduction to Python.
>>
File: this article is real and true.png (329 KB, 711x610) Image search: [Google]
this article is real and true.png
329 KB, 711x610
>>55416697
I really like this image but no Haskell?
What did Haskell ever do to you?
>>
/g/ I feel stupid, please to help me figure out why cURL with C is not working

http://pastebin.com/LFzYgzKM
>>
>>55416802
You could at least tell us what the error is
>>
>>55416815
There is none, it just seems like the program hangs. nothing happens and no file gets saved. It compiles just fine
>>
>>55416802
Your
fclose(fp);
is causing the segfault.
I presume curl_easy_cleanup already closes the file for you.
>>
>>55416802
>>55416898
Oh nevermind, you're actually never initializing fp.
>>
File: body.png (29 KB, 1920x1080) Image search: [Google]
body.png
29 KB, 1920x1080
>>55416572
nice. I love the colors.
We actually look into OpenCL and boost::compute for GPU acceleration during our course but it wasn't the main focus for our raytracer. I only use OpenCL to use threads for the main per-pixel loop.

One thing I use for time optimization is a (axis aligned) bounding box binary tree data structure. It's basically a tree of bounding box containing other bounding box or objects in the scene. That way you don't necessarily need to check for intersection with every objects in your scene.

For 2K triangles this took 450ms insted of 2 minutes for exemple
>>
>>55416920
kill me. Thanks f.a.m.
>>
>>55416878
when I make a pointer to a class. Not the class, just the pointer. Is the space for the class allocated.
>>
>>55416943
Also you're missing
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

Taken from https://curl.haxx.se/libcurl/c/simple.html

Full example:
#include <stdio.h>
#include <curl/curl.h>

size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
size_t written = fwrite(ptr, size, nmemb, stream);
return written;
}

int main(void)
{
CURL *curl;
CURLcode res;
FILE *fp = fopen("wikipedia.html", "wb");
if (!fp) {
perror("Failed to open file");
return 1;
}


/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);

/* get a curl handle */
curl = curl_easy_init();
if(curl) {
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_URL, "http://en.wikipedia.org/");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));

/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(fp);
curl_global_cleanup();
return 0;
}
>>
Hey guy i'm coding in c++

Im having trouble making an attribute to my class an array as opposed to just one pointer

Character::Character(std::string Name, int Age, int a, int b, int c, int d, int e, int f, int g,int h, Item CharItem)
:CharItem(CharItem)
{
SetName(Name);
SetAge(Age);
SetAttributes(a, b, c, d, e, f, g, h);

}


Instead of one "Item" attribute I want to have and array on items. I'm sure the way to go about this is to have an array of item pointers, but for the love of god I have just hit a mental wall with this. Any help would be appreciated. dosent have to be an array, just thinking of the simplest thing right now to get the code operational. thank you again
>>
>>55414062
>be me
>scroll through /agdg/
>see awesome looking tech demos
>read insightful discussions, with lighthearted humor and encouragement abounding
>scroll through /wdg/
>everyone constantly trying to teach and learn from each other
>scroll through /dpt/
>weebs, tripfags, waifufags, trannies, degenerates, circlejerking language fanboys
>arguments about pendantic bullshit like memory management
>no demo projects, not even any code snippets to try out in a repl or something
>only abstract useless bullshit that's mostly wrong because people just use this as a place to rubberducky and stroke their ego
>>
>>55417054
You're welcome to stay

>>55417043
You have a lot of options
1) pass a vector
2) pass a pointer and the length (to pass the array)
3) variadic function
4) use a std::initializer_list
>>
>>55417043
>>55417082

or if you want a fixed length
std::array
>>
File: transparency_difraction.png (131 KB, 1920x1080) Image search: [Google]
transparency_difraction.png
131 KB, 1920x1080
>>55416941
Also I'm currently working on transparency and diffraction but the transparent surfaces are still producing a shadows as if they were not transparent...
>>
They offered me a job today with a project but I'm afraid I won't know how to do it.
Should I accept it and hope for the best?
>>
>>55417137
I believe in you.
>>
>>55417009
It works perfectly now. Thanks a bunch.
>>
>>55417137
Do it pussy
>>
>>55416632
Flask has python 3 support. I use it to build a Web application in python 3. Nice work though, love seeing your posts
>>
>>55417149
good luck on your journey, stranger ;_;7
>>
>>55417175
can flask be used for anything that must scale well?
>>
>>55417147
Thanks.

>>55417169
Y.you too.
>>
>>55417194
Sure it's very flexible, but I use it only as a rest server.
>>
WHY IS ANIME BEING DELETED IN THE ANIME THREAD??
REEEEE
>>
Does anyone use CherryPy at all anymore? Was it ever used?
I made a restful meta-api in it and it is succinct, but it's ratherfull of old code and I'm sure security holes.
>>
>>55417321
>I made
Don't lie you stupid weaboo
>>
How do you guys stay motivated to learn new shit?
>>
>>55417330
want the code? It's maybe 300 lines. It wasn't hard at all
>>
>>55417355
Link where you stole it from pajeet
>>
>>55417359
unfortuantely I can't, as it is not stolen. I'd show you the references though.
and I'll put it on github or something.
>>
>>55417373
>putting stolen code on github
#triggered
>>
File: 1465419797994.png (638 KB, 4760x4986) Image search: [Google]
1465419797994.png
638 KB, 4760x4986
>>55414556
>>
>>55417054
>/agdg/
>good

Well that's just plain wrong, though I admit it does have way better programming discussion.
>>
>>55417389
https://github.com/CodeGrimoire/Api2
>>
>>55417054
go back 2 ur drag'n'drop "game" making software, weeb
>>
>>55416602
Yeah, they do embedded software. They wouldn't touch anything with a GC or even use a heap.
>>
File: Disappointed.jpg (50 KB, 330x327) Image search: [Google]
Disappointed.jpg
50 KB, 330x327
>>55417389
>#anything
I'm just sad. /g/ was always bad, but the last three years have been absolutely disgusting.
>>
>>55417390
I can only hope you didn't actually type that all out
>>
>>55416700
>>55416700

pls respond
>>
>>55417456
what explanations do you need? you already wrote notes. i dont see what more help you need
>>
File: depression.jpg (45 KB, 535x225) Image search: [Google]
depression.jpg
45 KB, 535x225
Parsing JSON in C is suffering.
>>
>>55417499
Are you using jansson?
>>
>>55417479

i think im just confused because of how the author laid it out.

he's assigning variables to variables to variables to variables to variables
>>
>>55417499
What library are you using?
https://lloyd.github.io/yajl/ is SAX like, so it should be fairly simple.
>>
>>55417510
No, I've been trying to work with jsmn. I'm looking into jansson now.
>>
template metaprogramming is neato.
>>
>>55417737
check out rascal
>>
yo opengl bros
I need to draw shapes according to there spot in the window. But not perspective matrix if that makes sense.
The problem is that nothing is drawn if I dont include the perspective matrix.
>>
>>55417800
sorry, meant projection matrix, not perspective matrix. It seems like a pain to have to update the projection matrix every time the aspect ratio changed.
>>
why does

target.write("%r \n %r \n %r \n" % (line1, line2, line3))
work

but

target.write("%r \n %r \n %r \n" ) % (line1, line2, line3)
doesn't?

Just curious.
>>
>>55417882
cuz ur missen' a closen' paren on the sekund wun
>>
>>55417892
>>55417882
also u put a closen' paren 2 early on the sekund wun
>>
>>55414062
A collaborative P2P radio over webrtc. Basically a DHT that contains pointers to audo files in torrents served over Webtorrent. Listeners can approve or disapprove of files, thus influencing the playlist of their peers (their "station").

(inb4 wdg, they don't ask what you are working on)
>>
>>55414062
My knowledge about algorithms in general far outweighs my skill in any particular language (I'm not even comfortable with python, not only is it easy, but it's my main language).
Super frustrating.
>>
okay so if I want to display in console what I wrote for the new lines.

how come i need to open up the file again , THEN read it even though i never closed the file? Why can't I open the file, delete everything, then just read?


print "Opening the file..."
#opens the file typed for filename
target = open(filename, 'w')

#DELETE DELETE DELETE
print "Truncating the file. Goodbye!"
target.truncate()

print "Now I'm going to ask you for three lines."

line1 = raw_input("line 1: ")
line2 = raw_input("line 2: ")
line3 = raw_input("line 3: ")

print "I'm going to write these to the file."

target.write("%r \n %r \n %r \n" % (line1, line2, line3))

target = open(filename, 'r')
print target.read()

print "And finally, we close it."
target.close()
>>
>>55417499
What? There's a million implementations already out there, and doing by hand is also pretty easy. Just figure out a robust way to store and traverse, and then write your parser based on that.
>>
Anyone here do any Android dev. Why is it so difficult and complicated just to do the simplest things? Everything is so fucked up with the Android SDK.
>>
>>55417499
I've done it before. Parsing JSON is pretty easy.
You must be shit.
>>
File: 1462754503245.png (718 KB, 838x911) Image search: [Google]
1462754503245.png
718 KB, 838x911
>Trying out HTML
>It's actually fun.

I guess I'm really am a visual learner. I love writing code and seeing the effects of it. I think I really should had picked up a trade instead of this.

buttfuckit I like wearing a suit and tie to work.
>>
>>55418036
>>55418036
>>55418036

FUCKING

HELP

ME

WHY DO I NEED TO OPEN UP THE FILE TO READ IT IF I NEVER CLOSED IT???????????????
>>
>>55418543
what exactly are you trying to do?
write to the file and then read what you just wrote?

lets say you have a blank file
then you write a line to it
the file pointer is now at the end of the file, beyond the line you just wrote
if you attempt to read from this position, you'll get nothing

when you open the file, the file pointer starts at the beginning
so you can read the line
>>
>>55418647

what the fuck, this was never explained anywhere to me. how the fuck was I supposed to figure that out.
>>
>>55418794
dunno bruh
but reading the lines you just wrote to a file basically never should happen
because if you just wrote the lines then you already know what they are, so you don't need to read them
>>
>>55418521
>html
>code
>>
>>55418863
take systems programming
>>
>>55418876
You are right, it's art.
>>
>>55418891
thanks I already have my degree
>>
>>55418876
HTML is code.
It's not programming though.
>>
>>55418985
oops was meant for
>>55418794
>>
>>55418543
Just open it once with 'rw' you whiny cunt.
>>
I did it years ago in python and php, but I finally got a 4chan image downloader coded in C++. Feels good man.
>>
>>55419031
of course it is programming, you dip
>>
>>55419209
html is not code and it is not programming
you can't compute with html and html is not turing complete
>>
File: 1405857055719.gif (3 MB, 200x150) Image search: [Google]
1405857055719.gif
3 MB, 200x150
>>55419266
What have I done to this thread.

All I said was HTML was fun.
>>
>>55419266
>html is not turing complete
it is, now that css3 is technically included
>>
File: 1467437937714.jpg (53 KB, 960x960) Image search: [Google]
1467437937714.jpg
53 KB, 960x960
Hey /g/ Im now a senior in my hs and i took a pre ap comp sci course last year and now im going to be taking an ap one this year. It will be over java. i got about a month and a half before it starts and was wondering if anyone could dump some project ideas for me to sharpen my ability in computer science. Thanks.
>>
Lets make Java great again! How would we accomplish this?
>>
>>55419411
Temperature converter
>>
File: 1467443242097.jpg (18 KB, 464x464) Image search: [Google]
1467443242097.jpg
18 KB, 464x464
>>55414062
Anime is for children and the mentally challenged who still think they're children.

You're not mentally challenged, are you?
>>
>>55419411
learn C
>>
>>55419472
I'm sure you're really proud of this post.
>>
>>55419411

A small interpreter for a little toy language. A basic Lisp or IMP style language might be a nice place to start.
>>
>>55419505
are you retarded? You are suggesting a difficult project for a beginner
>>
>>55419518
Anime website
>>
>>55419522
Definitely retarded.
>>
>>55419518

A basic Lisp interpreter a difficult project??

I think you might look in a mirror before accusing others of retardation. I mean damn there are even beginner books on it like this http://www.buildyourownlisp.com/

This is a entry level coding project or intermediate at worst.
>>
>>55419534
See
>>55419472

And ignore animefags.

People like op are crazy attention seeking basement dwellers. Why else would he include such shitty bait in the op.

We need a proper non anime version of this so the shitposts stop.
>>
>>55419581
You are suggesting an intermediate project to a complete beginner you are the noob
>>
>>55419607

You are incapable of parsing simple statements.

"intermediate at worst" meaning if you actually design the thing or are using a language that makes things overly difficult to implement.

In most modern language settings it is a good beginner level first large project.

So many summer trolls on this thread..
>>
>>55419581
not to mention, creating an interpreter is a boring meaningless project that wont interest beginners
they need something more tangible than that
>>
>>55419664
> Le summer may may
>>
>>55419411
CHIP 8 emulator
>>
>>55419588
I was stating the fact the you replied to the wrong post. You're too retarded too see that. it has nothing to do with the anime/anti-anime argument.
>>
>>55415749
Use tinyxml.
>>
>>55419728
Eat shit and die
>>
>>55419803
So, what was the last project you did?
>>
>>55414384
She is not a waifu because that character is acctually a boy who fell for the cross dressing meme
>>
>>55415375
>mathematics is not a science
Then neither Physics, Chemistry, CS ,... are.
Science is about applying maths to model reality math is exactly about that but in a more abstract way.
>>
>>55419715

-_- seeing this makes me feel like I may of accidentally started a meme.

Btw chip8 emulator in rust has made progress I've started on most of the opcodes. Got around 15 / 35 done.

Still really wishing for some recommendations on a good library for the display / sound.

I'm thinking glium will be good for the display. As for audio I'm thinking about using openal-rs but something that feature rich feels like over kill for just generating simple beeps.
>>
>>55419945
>math is about applying math to reality
>>
>>55414556
template <typename T, typename E = std::enable_if_t<(std::is_floating_point<T>() || std::is_integral<T>())>>
auto sqrt(const T number) noexcept
{
const float threehalfs = 1.5f;
float x2 = number * 0.5f;
float y = number;
long i = *reinterpret_cast<long*>(&y);

i = 0x5f3759df - (i >> 1);
y = *reinterpret_cast<float*>(&i);
y *= (threehalfs - (x2 * y * y));
y *= (threehalfs - (x2 * y * y));
y *= (threehalfs - (x2 * y * y));

return 1 / y;
}


Probably loses some precision.
>>
>>55419945
>math is about reality
>>
File: wew lad.png (6 KB, 273x312) Image search: [Google]
wew lad.png
6 KB, 273x312
wew lad is 4chan's newest meme

>when your program compiles
wew lad

>after an anime OP
wew lad

>when someone itt understands C++
wew lad

>your favorite thread discusses the finer points of fizzbuzz
wew lad
>>
>>55418299
>C fags have to reinvent the wheel every 5 seconds
>>
I fucking hate this piece of shit.
I need to make a MVC project and use it with a SQLite database and entity framework.
Everything is great until you need to download the fucking SQLite EF Nuget package which has a new schema a needs tl update nuget which I cant fucking do because no admin access.
What the fuck do I do now?
Any other database which is in a form of a file and can be used without ANY installations?
>>
std::vector<new class(variable)>;

I need to pop the class off the vector but its dynamically allocated. How do I do this without a memory leak. Do I have to make a pointer and set it equal to the top of the vector. Then delete the newly created variable and finally pop the vector?
>>
>>55417390
>unsigned long long int
made me kek
>>
>>55420724
If you can't write a parser for JSON or something similar yourself, you've failed as a programmer and a computer scientist.
>>
>>55417390
uh is he checking if a number is prime. At first I thought he was checking the nth prime the prime number was.
>>
>>55420886

You're talking about something like this?

    std::vector<int*> test;
test.push_back(new int(8));
delete test[0];
test[0] = nullptr;
>>
>>55420979
well in this case I need to pop. I dont know the index.
>>
>>55421020

If you're sure it is the last element this will work.

    std::vector<int*> test;
test.push_back(new int(8));
delete test.back();
test.back() = nullptr;
test.pop_back();
>>
>>55415581
It depends. What kind of abstract algebra?
>>
>>55420463
>super generic signature
>returns float
>>
>>55414728
>>55414744
>>55414757
>>55414770
Lainchan. The website is cancer of another kind, so I never go there, even though I would almost exclusively go through the lisp general threads when they were on /g/.
>>
>>55421072
Use smart pointers, fucko.
>>
>>55420438
>>55420498
I have 2 apples I get another one now I have 3.
>Not math
Math is an abstraction of the real world and if you had any Idea about math you would realize that.
>>
>>55421266
>auto
>super generic
>>
>>55421373
>
template <typename T, typename E = std::enable_if_t<(std::is_floating_point<T>() || std::is_integral<T>())>>

>casts to float
>returns float
>>
>>55421337

The original post didn't ask what would be the best practice here.

So much rage for very little reason.
>>
>>55421072
yeah the vector is also private. The genius who made it didnt create a way to pop it.
>>
>>55421500
Why can't you just replace the raw pointers with smart pointers here?

... If you can modify the source just refactor the damn thing. If not hopefully you have a way to iterator through it and find the portion you want to delete.
>>
>>55417882
Because in the first case you're formatting the input string that you're passing to target.write, however in the second case, you're attempting to format whatever is returned by target.write call, so obviously that's not what you want to do.
>>
>>55421470
You're right, that was unneeded. :<
>>
>apply for job
>get e-mail with a programming challenge
>it's the maximum path sum challenge from HackerRank

should I just tell them i knew the solution to the problem in the first 30 seconds just from exposure to these code challenges? or do they prefer if I pretend I've never seen this problem before and I'm """"solving it""""" even though I literally just know the best possible solution from the start
>>
>>55420125
I'd personally recommend the sdl2 crate, it's relatively easy to use and contains graphics, sound and input handling.
>>
>>55421787
Are you an honest man?
>>
>>55421787
first

It's a good thing that you do code challenges on your own
>>
how different is writing java for companies vs writing java for shitty hobby projects?
will probably get code monkey job in java, but they think i have 3 years of experience with it

i've only ever used it for small-medium stuff in my free time, but im bretty gud at programming in general
>>
>>55414062
weebshit op at it again
>>
>>55421790

I'll look into I used sdl a couple years back in a few projects.

Oh and this is why you shouldn't be lazy and copy / paste to do things.. I fully intend on separating the mass amounts of repetition in that code into functions so it is not a giant ugly as hell mess.

http://pastebin.com/55Vx8j8s

I wrote this so I could start testing functionality while I check out sound / graphics libraries. Luckily most of it was so similar I could just setup some vim macros to do it faster than c&p. Still doesn't give a excuse for doing this though.
>>
>>55422230

You get a cookie if you notice the mistake I have fixed yet due to a error in the macro.
>>
>>55422230
>>55422252

I should get to bed. Apparently I'm drunk enough to not be able to type coherent sentences anymore.
>>
File: 2340983.png (240 KB, 571x733) Image search: [Google]
2340983.png
240 KB, 571x733
What's the C# version of this?

I've been reading Essential C# 6.0 but it's so dry and convoluted
>>
>>55422385

I'm afraid that Essential C# is the big boy of C# books.
>>
>>55421365
That's a computation
>>
Created and published an app. Just installs shit in a folder. Can I call myself a developer now?
I'm calling myself a developer now since I'm publishing more. Just expansion packs.

Where do I pay marketing to get people to buy my app?
>>
>>55422385
That's a terrible book.
>>
>>55422405
What's the sippy cup version then?
>>
I want to practice graphical programming and maybe make a small game while I do it too.

What library would you suggest that is with C or C++? Also, should I use C for this? Since I want to get better at C than practice my C++, thought C++ might have it with less frustration since a lot of the libraries are in there, and also that I'm kind of very rusty with C.
>>
>>55422444
I'm open to suggestions
>>
>>55422449
SDL is pretty cool, it's purely written in C.

>>55422460
On C++? Since that's the book I meant.
Thread replies: 255
Thread images: 31

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.