[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: 51
File: daily programming thread.jpg (106 KB, 1280x720) Image search: [Google]
daily programming thread.jpg
106 KB, 1280x720
old thread >>54278678

what are you working on /dpt/?
>>
First for Nichijou is fucking shit.
>>
File: 3LWaxtj.webm (748 KB, 480x270) Image search: [Google]
3LWaxtj.webm
748 KB, 480x270
my program seg faults becuase im a dum dum loli boster
>>
>>54284786
You gotta admit it's kawaii as fuck tho
>>
We already have a thread, you dumb shits.
stop spamming the board

>>54284745
>>
>>54284842
nice try trapposting fuck
>>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
void *curr_stack;
size_t size;
int amounts;
} stack_t;

void init_stack(stack_t *s) {
s->curr_stack = NULL;
s->size = 0;
s->amounts = 0;
}

void push(stack_t *st, int i) {
st->size += sizeof(i);
void *ptr = malloc(st->size);
if (st->curr_stack) memcpy(ptr, st->curr_stack, st->size);
free(st->curr_stack);
st->curr_stack = ptr;
}

int main(void) {
stack_t stack;
init_stack( &stack );
push( &stack, 40 );
push( &stack, 40 );
printf("stack->size=%d\n", stack.size);
return 0;
}


how much wrong can you find with my stack
>>
>>54284851
You're doing this on purpose, right?

What a pile of shit.
>>
>>54284851
>void *ptr = malloc(st->size);
>if (st->curr_stack) memcpy(ptr, st->curr_stack, st->size);
>free(st->curr_stack);
>st->curr_stack = ptr;
Use realloc instead.
>>
>>54284745

Real thread here.
>>54284658

Stop spamming the board with duplicate threads.
>>
>>54284851
m8
http://www.josuttis.com/libbook/cont/stack1.cpp.html
http://www.josuttis.com/libbook/cont/Stack.hpp.html
>>
>>54284882
please stop trying to shit post
>>
>>54284900
>.cpp
Get that shit out of here, m8
>>
File: file.png (383 KB, 800x530) Image search: [Google]
file.png
383 KB, 800x530
>>54284745
>fw you're retarded and can't think of an elegant solution to a problem
>>
File: Make-a-Stone-Axe-Step-6.jpg (2 MB, 4592x3056) Image search: [Google]
Make-a-Stone-Axe-Step-6.jpg
2 MB, 4592x3056
>>54284745
I hate C. I have been working on an assignment for 4 days. It was supposed to take 3 max.

Using C is like using this stone axe. Sure you can cut a tree down with it, but you're not going to enjoy it, and it's going to take a while.
>>
>>54284953
what assignment is it desu
>>
>>54284900
virtual const char* what() const throw() {
return "read empty stack";
}


Literally what() is going on in this function signature?
>>
>>54284953
You're just shit. Although you could try posting come actual criticism.

>>54284963
Concentrated memes.
>>
>>54284963
It's example code from STL so it's pretty much pseudo-c++
>>
>>54284953
post assignment we will do it in 15 minutes
>>
>>54285011
I support this
>>
>>54285011
yes sir please post assignment sir i can do it for you sir
>>
boys
>>
>>54285023
Why do people hate C? Are they just bad programmers?
>>
File: pf.webm (1 MB, 853x480) Image search: [Google]
pf.webm
1 MB, 853x480
/dpt/-chan, daisuki~

Ask your favorite programming literate anything (IAMA).

>>54284794
valgrind

>>54284851
That's not a stack.

>>54284953
C is obsolete.
>>
>>54285023
Jimmy please
>>
>>54285049
>C is obsolete.
(You)
>>
>>54285046
didn't mean to quote you >>54285023
>>
Calling data structures OOP makes literally every programming language except for like, forth and the lambda calculus, OOP.
So we can't say that structured data + functions that operate on them -> coding style is OOP.
So then what is OOP?
Smalltalk OOP is all about sending messages.
Java OOP is all about inheritance relations.
Common Lisp OOP is all about generic functions.

So what the fuck IS OOP?
How about this to start:
>every is an object, or at least everything tries to be an object (*cough* fuck you Java)
>an object is a combination of data and operations
>identical invocations of those operations can have runtime dependent effects; called dynamic dispatch

Java:
>most things are an object; at least, anything you declare yourself is always an object (you can't declare primitives, which are few)
>classes designate the operations (methods) and structure (properties) of an object
>methods can be "overriden" by subclasses, achieving dynamic dispatch

Smalltalk:
>everything is an object, similar to Java definition
>even classes are objects
>operations are in the form of messages; an object's response to a message is determined at runtime

Common Lisp:
>everything is an object (has a 'class')
>dynamic dispatch is based off of "methods", which determine their behavior at runtime from the classes of their arguments.
>>
>>54284851
>reallocing for every insert
WHAT
>>
>>54285049
Is the hammer obsolete just because we've made more advanced hammers?
>>
>>54285108

We have nail guns now grandpa
>>
>>54285011
This is the code I have so far. The assignment description is at the top.
/*
i. The two file names will be given to the program as arguments from
the user.
ii. The first file will be copied into the second file.
iii. You should compare the two files to see if they are the same.
iv. Do not use FILE functions. You must use open(), close(),
read() and write().
*/

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>

#define BUF_SIZE 8192

int main(int argc, char* argv[]) {

int input_fd, output_fd; /* Input and output file descriptors */
ssize_t ret_in, ret_out; /* Number of bytes returned by read() and write() */
char buffer[BUF_SIZE]; /* Character buffer */

printf("Please enter two file names. The first one will be copied into the second one.\n");
printf("First file: \n");
gets(input_fd);
printf("Second file: \n");
gets(output_fd);

/*
/* Are src and dest file name arguments missing *
if(argc != 3){
printf ("Usage: cp file1 file2");
return 1;
}
*/


/* Create input file descriptor */
input_fd = open (argv [1], O_RDONLY);
if (input_fd == -1) {
perror ("open");
return 2;
}

/* Create output file descriptor */
output_fd = open(argv[2], O_WRONLY | O_CREAT, 0644);
if(output_fd == -1){
perror("open");
return 3;
}

/* Copy process */
while((ret_in = read (input_fd, &buffer, BUF_SIZE)) > 0){
ret_out = write (output_fd, &buffer, (ssize_t) ret_in);
if(ret_out != ret_in){
/* Write error */
perror("write");
return 4;
}
}

/* Close file descriptors */
close (input_fd);
close (output_fd);

printf("The first file has been copied into the second file.\n");

return (EXIT_SUCCESS);
}
>>
>>54285060
Neat post. Is CL's dynamic dispatch complete if the only thing determining behavior is which class each argument is? Is dynamic dispatch only for variance in behavior based off of types of the arguments? I would think not, as you meantion overriding in Java, so you can have a child class' operation's behavior vary than its parent while the arguments are of the same type. Maybe you meant to meantion polymorphism here instead?

Smalltalk sounds neat, although I don't know how comfortable I am with "classes are objects."
Also,
>Smalltalk
>talk
>messages
Neat.
>>
>>54285122
jesus christ really? I hope you're a freshman.
>>
>>54285122
I fucking told you what to do last time you posted this.
>gets(input_fd);
I already explained why that's wrong in so many ways.
>>
>>54285122
>given as arguments to the program from the user
>printf("Please enter...");
>gets
>fucking GETS
drop out
>>
>>54285122

4 days....?
>>
>>54285156
it's hilarious out of all the functions to extract from the stream he picked the worst one
>>
>>54285122
this took 4 days to write?

Also why the fuck are they telling you not to use the FILE constructs?
They're part of the C standard.
>>
>>54285167
I'm pretty sure the instructor wants him to use argv as well
>>
>>54285122
holy shit anon. I wrote a 1000 line C program in a day for a final and you're stuck on this shit for 4 days. Surreal.
>>
>>54284953

So it really is a meme when people say a certain language sucks when the reality is cause they can't do their Programming 101 assignments. What an epiphany.
>>
>>54285141
>>54285156

It's really not important. It was originally scanf, but I changed it to gets because it was simpler and din't throw errors.

I didn't change it because I haven't made any progress on the actual logic of the code that does the important work. Getting the fucking string isn't important.

>>54285182
>>54285187

No this is the last question on the assignment. I'm already finished the rest of it.
>>
>>54285060
>Common Lisp
>>OOP

if you want to troll >>>/b/
>>
>>54284953 Shout-out to whoever's youtube channel this is:
https://www.youtube.com/watch?v=SLoukoBs8TE - Bow and Arrow Assembly
https://www.youtube.com/watch?v=nCKkHqlx9dE - Wattle and Daub Hut Construction
https://www.youtube.com/watch?v=Uwtu_DARM9I - Thatched Dome Hut Construction
https://www.youtube.com/watch?v=z9n9rqb-lvY - Firestick Assembly
>https://www.youtube.com/watch?v=BN-34JfUrHY - Celt Stone Axe Assembly <-- RELEVANT
https://www.youtube.com/watch?v=eVvQnsKuOcE - Moreton Bay Chestnut Processing
>https://www.youtube.com/watch?v=-JcWY0rjePU - Stone Adze Assembly <-- RELEVANT
https://www.youtube.com/watch?v=ZajpkwDeEYg - Wood Shed Construction and Honey Processing
https://www.youtube.com/watch?v=KzMfeQyY5xM - Palm Thatched Hut Construction
https://www.youtube.com/watch?v=P73REgj-3UE - Tiled Roof Hut Construction
https://www.youtube.com/watch?v=mL3sho1CpkI - Chimney Construction and Clay Pot Assembly
https://www.youtube.com/watch?v=RzDMCVdPwnE - Sling Assembly
>https://www.youtube.com/watch?v=kiHojsMTBeA - Basket Weaving and Stone Hatchet Assembly <-- RELEVANT
https://www.youtube.com/watch?v=ZEl-Y1NvBVI - Pump Drill Assembly
https://www.youtube.com/watch?v=GzLvqCTvOQY - Charcoal Processing
>>
>>54285199
>It's really not important
It's ridiculously important. You're fucking trying to write a string to an integer.
Isn't your compiler yelling at you for doing something this stupid?
>>
>>54285129
I'm no expect on CL actually, but I've read about it.
The thing about Lisp is that it's dynamically typed, meaning that a variable can take on multiple types during the course of a program. If you learn JS, Python, Ruby, etc., you'll understand.
// JavaScript
var x = 3;
x = "a";
x = false;


Because Lisp is dynamically typed, you can send any type of data to any function. Overriding in Java is known as "static dispatch"; the type of the data you pass into a method is determined before the program is run, so the appropriate method is determined before the program is run (compile time).
CL's multiple dispatch is similar to Java overriding, except it looks at the types of the arguments at RUNTIME to determine which implementation to execute.
Java approximation (I'm assuming you don't know Lisp, in which case the syntax would be confusing):
class Foo {
...
}
class Bar extends Foo {
...
}
class Main {
// not actual java syntax
dynamic void thing (Foo f) {
System.out.println("foo!");
}
dynamic void thing (Bar b) {
System.out.println("bar!");
}
void main () {
Foo f = new Bar();
// statically, 'f' is of type Foo and Foo only.
thing(f); // -> "bar!"
}
}


Java's "polymorphism" is its method of achieving dynamic dispatch.
I really like the most how dependently typed langauges achieve it; through "dependent pairs" aka existential types.
>>
>>54285214
Nope. GCC doesn't even have any warnings for this code.
>>
File: smh tbh fam.gif (81 KB, 182x249) Image search: [Google]
smh tbh fam.gif
81 KB, 182x249
Can we move to the other thread?
This one is entirely full of freshmen CS homework garbage and I hate it.
>>
>>54285049
>what show anon
>>
>>54285230
>>
>>54285220
FUck, I got overriding and overloading confused.
>>
>>54285235
hey look the trapposter is butthurt he didn't get enough attention for the night
>>
File: sloth.png (6 KB, 128x128) Image search: [Google]
sloth.png
6 KB, 128x128
painting webapp

http://stochatta.com/paint.html
>>
benchmarks confirm that this was a bad idea:
module Multi
THREADS = 1000 # >running this code
# for arrays. who knows what it does to other stuff
def Multi.map(data)
raise ArgumentError, "no block given" unless block_given?

size = (data.length > THREADS) ? (data.length / THREADS) : data.length
return data.each_slice(size).map { |ary|
r,w = IO.pipe
fork do
r.close
w.write Marshal.dump( ary.map { |a| yield a } )
w.close
end
w.close
r
}.map { |r|
res = Marshal.load(r.read)
r.close
res
}.flatten
end
end
>>
File: cake.webm (447 KB, 900x506) Image search: [Google]
cake.webm
447 KB, 900x506
>>54285055
Just the truth.

>>54285086
>So we can't say that structured data + functions that operate on them -> coding style is OOP.
That's a data type, if the data type is encapsulated by a set of procedures or functions then it's an abstract data type.

An Abstract type doesn't abstract the implementation of its procedural/functional interface (P/FI) contrary to an object that's why you have typeclasses in haskell or modules in ocaml.

An object also hides its data under a PF/I but also hides the implementation of that P/FI. You can access the PF/I only through the object.

Classes, closures, prototypes is irrelevant here.

You need to both know what's an object and an ADT to really understand them.

A concrete example of a difference between ADT and Object in pseudo C

/*
* adt:
* - implementation is not hidden
* - have to modify sort() for every new type
*/
void sort (adt x)
{
switch (type(adt))
{
intarray: intarray_sort(x);
floatarray: floatarray_sort(y);
}
}

/*
* object:
* - implementation is hidden
* - no need to modify sort() for every new object
*/
void sort (object x)
{
x->sort();
}


ADT and object also have important differences in extendability and high order programming.

>>54285108
False analogy.

>>54285268
nice
>>
>>54285247
Doesn't happen in Code Blocks. Idk why.
>>
>>54285314
>Just the truth.
For something to be obsolescent, something has to obsolete it.
Tell me, what obsoletes C?
>>
>>54285340
is codeblocks using c99?
>>
>>54285360
C99 should produce the same errors. C11 wouldn't compile at all.
>>
>>54285049
>C is obsolete.
You lost my respect.
>>
>>54285360
>>54285362

I'm on Fedora 23 with a recent version of Code Blocks. Idk what's going on.
>>
>>54285122
This is the original program I am trying to change.
/*
============================================================================
Name : sp_linux_copy.c
Author : Marko Martinović
Description : Copy input file into output file
============================================================================
*/

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>

#define BUF_SIZE 8192

int main(int argc, char* argv[]) {

int input_fd, output_fd; /* Input and output file descriptors */
ssize_t ret_in, ret_out; /* Number of bytes returned by read() and write() */
char buffer[BUF_SIZE]; /* Character buffer */

/* Are src and dest file name arguments missing */
if(argc != 3){
printf ("Usage: cp file1 file2");
return 1;
}

/* Create input file descriptor */
input_fd = open (argv [1], O_RDONLY);
if (input_fd == -1) {
perror ("open");
return 2;
}

/* Create output file descriptor */
output_fd = open(argv[2], O_WRONLY | O_CREAT, 0644);
if(output_fd == -1){
perror("open");
return 3;
}

/* Copy process */
while((ret_in = read (input_fd, &buffer, BUF_SIZE)) > 0){
ret_out = write (output_fd, &buffer, (ssize_t) ret_in);
if(ret_out != ret_in){
/* Write error */
perror("write");
return 4;
}
}

/* Close file descriptors */
close (input_fd);
close (output_fd);

return (EXIT_SUCCESS);
}
>>
>>54285314
I think you misquoted me, but I somehow also happen to be the guy you intended to quote.

Your example there has the same semantic meaning though. There is a need to modify sort() for each new type I would think. It's late and I'm not working at full capacity right now but I'm pretty sure that if you just have a function pointer in the object and assign it based on the type it is when you construct it, that's the same as switching the type in all of the related functions like sort. Like this:
adt * new_adt(type t) {
adt *ret = malloc(sizeof(adt));
ret->t = t;
return ret;
}
// vs
adt * new_adt(type t) {
adt *ret = malloc(sizeof(adt));
switch (t) {
case INT: ret->sort = int_sort; break;
case DOUBLE: ret->sort = double_sort; break;
//...
}
return ret;
}

I know this is impractical but it is accomplished more seamlessly/easy with template macros, i.e.
// so you just write dec_adt_class(int)
#define dec_adt_class(T) \
typedef struct _adt_##T adt_##T
struct _adt_##T { \
void (*sort)(adt_##T *); \
T array[5]; \
}; \
void adt_sort_##T(adt_##T *self) { \
// your favorite sort here, using T as type
} \
adt_##T * new_adt_##T(void) {
adt_##T *ret = malloc(sizeof(adt_##T)); \
ret->sort = adt_sort_##T; \
return ret; \
}

#define adt(T) adt_##T
#define new_adt(T) new_adt_##T
#define sort(ADT) ((ADT)->sort(ADT))

that was probably all unnecessary but it's my favorite method for making templates in C

Anyway, how is one an object and one not an object?
>>
>>54285122

1. The use of gets() is completely inexcusable in any C program that is not intended to be used as a canonical example of a vulnerable C program.

2. The gets() function takes a buffer as an argument, not a file descriptor. It does not take a file descriptor as an argument because it always reads from stdin.

3. Your professor indicated that the filenames would be given to as arguments from the user. Arguments means that they'll be in argv[1] and argv[2] respectively, rather than read from stdin.

4. A filename and a file descriptor are not the same thing. A filename is a string, while a file descriptor is an integer that represents an index to an open file table, generally managed by the operating system.

5. You were not instructed to write anything to stdout. Do not make your program have any additional functionality than what was instructed to you, or your instructor may deduct points.

6. Let me drill this in for you again, just one more time... NEVER UNDER ANY CIRCUMSTANCES ARE YOU TO USE THE GETS FUNCTION IN ANY C OR C++ PROGRAM YOU WRITE FOR THE REST OF ETERNITY OR SO HELP ME I WILL FIND YOU, I WILL DOX YOU, AND I WILL SEND A MASS EMAIL TO EVERY SOFTWARE FIRM NOT TO HIRE YOU.
>>
>>54285534
yeah that's how c-shills do it. It looks like shit but it works.
>>
>>54285570
The compiler is telling him that at every turn. It's like the simpsons movie where homer is crashing through all those signs to not dump in the lake. I think he said in a previous thread his instructor told him to not use any of the safe file get functions, which is even more inexcusable.
>>
>>54285534
you can't have true objects in C. Your examples are not ADTs: an adt doesn't expose its data which is what you are doing by exposing the adt->sort pointer.

https://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOOPvsADT90.pdf
>>
If my program uses a web scraper, should I create the unit tests to use logs or the live site?
>>
>>54285570
Calm down, autismo.
Go watch some mlp to calm your nerves.

Using fgets in a homework assignment is fine, who gives a shit?
>>
>>54285611
I'm pretty sure ADTs don't have to be opaque. They would be opaque if the struct definition was put in a .c source file with an incomplete declaration in the header.

I'd love to read through that paper but isn't it true that if a language implemented in C has "true" objects, then C can have true objects?
>>
>>54285646
fgets is always fine. He's using gets, which is never fine. Learn to read, spaz
>>
>>54285662
it's a homework assignment, you dumb shit.
>>
>>54285210
I had thought these were all Javascript Frameworks
>>
>>54285570
Okay I've changed it, but I don't know how to rewrite the copying function.
/*
i. The two file names will be given to the program as arguments from
the user.
ii. The first file will be copied into the second file.
iii. You should compare the two files to see if they are the same.
iv. Do not use FILE functions. You must use open(), close(),
read() and write().
*/

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

#define BUF_SIZE 8192

int main(int argc, char* argv[]) {

char input_fd[4096], output_fd[4096]; /* Input and output file descriptors */
ssize_t ret_in, ret_out; /* Number of bytes returned by read() and write() */
char buffer[BUF_SIZE]; /* Character buffer */

printf("Please enter the first file name.\n");
scanf("%s",input_fd);
printf("Please enter the second file name.\n");
scanf("%s", output_fd);

/* Copy process */
while((ret_in = read (input_fd, &buffer, BUF_SIZE)) > 0){
ret_out = write (output_fd, &buffer, (ssize_t) ret_in);
if(ret_out != ret_in){
/* Write error */
perror("write");
return 4;
}
}

/* Close file descriptors */
close (input_fd);
close (output_fd);

printf("The first file has been copied into the second file.");

return (EXIT_SUCCESS);
}
>>
>>54285717
>ssize_t
do you even try to compile your code?
>>
>>54285717
>scanf("%s",
That's literally the next worst thing you could have done.
>read (input_fd
Jesus christ. A file descriptor is an integer, not a fucking string. You took your wrong type problem and just flipped it around. You get your filenames and then get your file descriptors by using open with those filenames.

>>54285750
Signed size_t. It's a POSIX type.
>>
>>54285750
ssize_t is valid. He should just use size_t though.
>>
>>54285765
Put your trip back on, prettyboy.
>>
>>54285776
>He should just use size_t though
No he shouldn't. read and write return -1 on error, which will wrap around to SIZE_MAX.
>>
>>54285750
It compiles, runs, and exits with code 0. I did get warnings for using chars where I should be using ints, but I want to change that.

>>54285765
so I should do

file_descriptor = open(input_fd)
>>
File: this article is real and true.png (329 KB, 711x610) Image search: [Google]
this article is real and true.png
329 KB, 711x610
>>54285765

I'd just like to interject for a moment. What you’re referring to as ssize_t, is in fact, GNU/ssize_t, or as I’ve recently taken to calling it, GNU plus sign plus size_t. ssize_t is not a type unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and compiler collection components comprising a full type as defined by POSIX.
>>
>>54285122
I would suggest mmap()ing the entire file into memory, but they told you to use read() and write().
>>
import paramiko
import sys

f = open("<>", "W")
f.write("write a stupid message here")

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("<target address>", username= "<input username>", password="<input password>")

sftpClient = ssh.open_sftp()
sftpClient.put("name-of-this-python-file.py", "/tmp/" + "sname-of-this-python-file.py")
sftpClient.exec_command("python /tmp/name-of-this-python-file.py")

#hahahahahahahhahahahahahahah
>>
>>54285765
Okay, I changed everything, but it's giving me a bad file descriptor error.

/*
i. The two file names will be given to the program as arguments from
the user.
ii. The first file will be copied into the second file.
iii. You should compare the two files to see if they are the same.
iv. Do not use FILE functions. You must use open(), close(),
read() and write().
*/

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

#define BUF_SIZE 8192

int main(int argc, char* argv[]) {

char input_file_name[4096], output_file_name[4096]; /* Input and output file descriptors */
int input_file_descriptor, output_file_descriptor;
ssize_t ret_in, ret_out; /* Number of bytes returned by read() and write() */
char buffer[BUF_SIZE]; /* Character buffer */

printf("Please enter the first file name.\n");
scanf("%s",input_file_name);
printf("Please enter the second file name.\n");
scanf("%s", output_file_name);

input_file_descriptor = open(input_file_name, O_RDONLY);

output_file_descriptor = open(output_file_descriptor, O_WRONLY | O_CREAT, 0644);

/* Copy process */
while((ret_in = read (input_file_descriptor, &buffer, BUF_SIZE)) > 0){
ret_out = write (output_file_descriptor, &buffer, (ssize_t) ret_in);
if(ret_out != ret_in){
/* Write error */
perror("write");
return 4;
}
}

/* Close file descriptors */
close (input_file_descriptor);
close (output_file_descriptor);

printf("The first file has been copied into the second file.");

return (EXIT_SUCCESS);
}
>>
>>54285861
?
>>
>>54285881
something you can have a lot of fun with
>>
>>54284953
No, you just suck at cutting down trees.
>>
>>54285808
>mfw this article is real and true
>mfw your filename
>mfw I have no face

http://gizmodo.com/5847906/strange-misguided-man-glad-steve-jobs-has-died
>>
I've got a question that I'm not sure how to word for google to look for help.

I've got a c# program with 3 classes. 2 of them contain several objects with different data but a private access modifier.

Basically, I want to create a method that allows me to call certain information from those objects. For example, if the book class contains objects book1, book 2, and book 3, I want to be able to print and edit the titles, authors, etc from the menu class.
>>
>>54286153
Make a public method that affects them?

C++ has a thing called "friend", but I doubt C# has that.
>>
>>54286184

I've done that, to be more specific the issue I'm having is telling the program which object I actually want to get the information from. As of right now, there are 3 objects. When I ask it for the title with a public method it always returns the title of the last object created.
>>
>>54286200
Quick and dirty solution: give the books some kind of id (simplest way to do that: put them in an arrray on the menu and use an index), then have the menu modifier methods take a book id so the class knows which one to talk to.

This sounds like something is off about your architecture, though. You shouldn't be writing modifier methods that go fuck with completely different objects than the class the method belongs too.
>>
>>54286153
Public String getBookTitle

Public void setBookTitle(String title)
>>
>>54286153
Sounds like you need accessor methods to do what you want, but somehow what you're describing doesn't make sense. Why would a book class contain books?

If what you're trying to do is create a "shelf" of "books", then the shelf should just expose functions that it makes sense for a bookshelf to do/have done to (for example, expose an iterator to manipulate books directly, and help functions for searching for a book/reordering the books/etc).

If you're going to have a class modify the books through the shelf, then you should have the class making the modifications do it directly on the books rather than try to expose the functionality through the shelf (unless maybe you have the shelf and books implement an interface that describes the basically functionality of the books, so that you can pass shelves or books to methods without knowing which is which).

You should draw a basic UML diagram and post it, or better explain the premise.
>>
File: 1436319408829.jpg (181 KB, 606x728) Image search: [Google]
1436319408829.jpg
181 KB, 606x728
learning CS because le programmer
using GNU Prolog, I don't get why this is happening
here's my database:
man(david).
man(john).

woman(suzie).
woman(eliza).

human(david).
human(john).
human(suzie).
human(eliza).

parent(david, john).
parent(john, eliza).
parent(suzie, eliza).


but when I run the .pl file, or compile it, why does this happen?

yes
| ?- parent(john, X).

X = eliza

yes
| ?- parent(X, john).

X = david ? ;

no
| ?-


for the first one, it just states X = eliza and that it's true (yes), but for the second one, it asks if X = david ? and I'm given the option to put ; and then it says no.
>>
>>54286270
>>54286220
I've got it, thanks for the help.

It was such a stupid mistake I'm killing myself. I was writing Book.GetTitle instead of Book1.GetTitle.
>>
Is Humanity a fork bomb?
>>
Hey guys just checking in.

I'm learning javascript and I've got a side project going on. It's my dream to build my own social networking website like facebook, Mark is my hero, who inspires you guys?
>>
File: Capture.png (436 KB, 1202x832) Image search: [Google]
Capture.png
436 KB, 1202x832
new to programming, this is part of a python text based game I'm making for a group project.
>>
File: playing doctor (4chan version).gif (2 MB, 509x382) Image search: [Google]
playing doctor (4chan version).gif
2 MB, 509x382
Unsure what I should work on.

Should I get the rape dungeon editing/house interior working again (was working before the graphics/etc redo, but I changed the wall system and the res and some other stuff, and externalized all house layouts to files instead of hard-coding, so some stuff needs re-doing)

I could also work on loli-mood/gift preferences. I'm not quite sure how to handle that. I wanted to specify some known points for each loli in like something equivalent to R^6 with one dimension being savoury, one sweet, one spicy, etc... for tastes, then you could use those known points and see how a loli would react to new foods. I was thinking of several approaches. One could be to just attach weights to each preference she knows and then also have some distance function and sum over all the known preferences multipied by their weight. Someone on /jp/ was saying to make preferences polygonal regions and see which one intersects the query region the most, but that wouldn't really give you as much of a notion of distane unless you integrated over the regions (muh sextuple integrals) using the distance-density function.

Other options could be to work on cops.

>>54284794

That's why you need to go up a dimension. Then your program will run fine.
>>
>>54284963
its one of the reasons to not use exceptions in C++. thats how you define the message for a custom exception, wonderful right?
>>
File: 1461856128795.jpg (378 KB, 1000x1000) Image search: [Google]
1461856128795.jpg
378 KB, 1000x1000
>try and find a simple way to do complex thing because don't want to spend time learning
>find a great library to do exactly that
>it doesn't have any documentation at all and all you have are code snippets other people posted
>end up spending hours figuring it out

story of my life
>>
File: goldie.jpg (19 KB, 251x303) Image search: [Google]
goldie.jpg
19 KB, 251x303
>>54286680

>tfw most people dont know that devs spend most of their time just copy and pasting other people's stuff and lurking stackoverflow
>>
In Python, does setting a variable to equal
fileVariable.read()
create a string of the contents of the file? The python documentation isn't helping.
>>
>>54286680
>know that there's already a solution for your problem
>want to use it
>the solution isn't available for your programming language
How the fuck is there not an up-to-date curses port for C#
>>
>>54286711
file = open('myfile.txt', 'r')
your_string = filela.read()
file.close()
>>
>>54286712
whats wrong with CursesSharp? or MonoCurses?

also, ConsoleFramework might be a thing to look at. its a WPF-like API for TUIs
>>
>>54286312
pls respond
>>
>>54286744
CursesSharp hasn't been updated for the latest version of Mono and doesn't build anymore
MonoCurses doesn't have mouse support (in a fucking curses port, what)
I haven't looked at ConsoleFramework yet, thanks
>>
I need a book to learn Java with - my teacher's shit - are there any recommendations?
>>
File: happy.jpg (78 KB, 870x627) Image search: [Google]
happy.jpg
78 KB, 870x627
FINALLY I finished a maze-solving algorithm in R.

But it's only one of 3 or 4 ideas I have on how to do it. I must continue. I must find the best method. Then I post to github all my algorithms, and potential employers see my autistic dedication to meaningless online programming challenges. And they say "there's a guy who can really get things done!" and they offer me a cushy job with a big salary, sweetass benefits, and nebulously-defined responsibilities. It's coming. I know it's coming. Thank you /dpt/,
>>
>>54285647
>I'm pretty sure ADTs don't have to be opaque.
The whole point of ADTs is to have opaque types.

>>54285647
>They would be opaque if the struct definition was put in a .c source file with an incomplete declaration in the header.
And in that case you would have to rely on a getter to retrieve the sort pointer.

>>54285647
>isn't it true that if a language implemented in C has "true" objects, then C can have true objects?
No. A programming language and its implementation are two very different things.
>>
>>54285415
Look harder.

I've tested clang and gcc with no warnings turned on and I can't use gets anywhere without a big fat compiler warning.
>>
I created this only to find out that maketrans() is a thing.
http://pastebin.com/gerKrvwF
>>
>>54287120
first ltr = k
second ltr = m
lne: g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.
>>
File: Bjarne-Stroustrup.jpg (27 KB, 494x423) Image search: [Google]
Bjarne-Stroustrup.jpg
27 KB, 494x423
fucking kek
http://freefeast.info/personality-motivation/famous_it_personalities/bjarne-stroustrup-creator-of-c-famous-it-personalities/
>>
why on earth would anyone use spaces over tabs
>>
>>54287234
they enjoy carpal
>>
>>54287234
You can't get uniform look with tabs, they can be anywhere from 2 to 8 spaces depending on the system you're on.
>>54287239
>Not having his editor to insert spaces on TAB and erasing N spaces at once when deleting
>>
>>54287234
I use tabs for indentation, but often align my code with spaces to make it easier on the eye. Can't use tabs for that shit, as tabs don't have standardized length.
>>
>>54287330
tabwidth2 masterrace
>>
>>54287234
>>54287239
Some checkstyle programs require spaces instead of tabs and every single editor I've used has an option to insert spaces when tab is clicked.
>>
File: dpt programming advice.png (6 KB, 433x91) Image search: [Google]
dpt programming advice.png
6 KB, 433x91
>>54286633
>>
File: vag tearing.png (34 KB, 640x480) Image search: [Google]
vag tearing.png
34 KB, 640x480
>>54287487

You made me realize I was never actually setting the virginity variable for my lolis. I was however making them get knocked up + tearing their orifices if the hole was too big relatigve to their size. Oh well. I was gonna reorganize the code for sex history anyway.

void NPCTalkState::nakadashi()
{
Soul& soul = *owner.getSoul();
// @HACK HOLY SHIT THIS IS HACKY HAAAAAACK
owner.HACK = true;
Player *player = owner.getScene()->getPlayer();
ASSERT(player);
soul.mate(*player->getStats().soul, Random::get());
// player's dick is 11.5cm in circumference (average)
const float cmLack = 11.5 - soul.getVagTightness();
if (cmLack > 0.f)
{
soul.getStatus().vagDamage += cmLack;
soul.getStatus().vagStretching += 0.2f * cmLack;
}
}
>>
>>54287511
haven't seen you on aggy since you released your demo last summer
missed you
can't handle the bullying or what?
>>
Alright, so I'm new to C and I'm stuck. So I am trying to generate a dynamic two dimensional array. I thought it would be easy, but it's killing me. That's my code:

#include <stdlib.h>

uint32_t **gen_2dim_array ( const size_t width, const size_t height )
{
const size_t area = sizeof(uint32_t *) * width + sizeof(uint32_t) * width * height;
static uint32_t **out = ( uint32_t ** ) malloc ( area );
for ( size_t i = 0; i < width; ++i )
out[i] = ( uint32_t * ) ( out + width + i * height );
return out;
}
int main ()
{
const size_t width = 94;
const size_t height = 94;
uint32_t **array = gen_2dim_array ( 180, 180 );
for ( size_t i = 0; i < width; ++i )
for ( size_t j = 0; j < height; ++j )
array[i][j] = 0;
}

This segfaults on my machine. Weirdly, it only happens when width and height are 94 or larger. Below 93 it's fine.
>>
File: pools plus skin tones.png (126 KB, 1168x480) Image search: [Google]
pools plus skin tones.png
126 KB, 1168x480
>>54287543

I post when I make progress, but I was really busy since last summer so I didn't make as much.
>>
how can i make a pure abstract base class in c++ allow a derived class to return a function of a different type?

say for example i had some pure virtual function:
virtual vector<House*> containsHouse() = 0;
which is in the pure virtual header house.h, and was implemented in apartment.h and townhouse.h as
vector<House*> containsHouse() { return m_house; }
. But then in another class which is also implements the abstract class house.h and it was called car.h -- how would i then make it so car.h could have a function called
vector<Car*> containsHouse() { return m_car; }


i know i shouldn't be extending the pure virtual class to such an incompatible function class but i can't not use it for this assignment
>>
>>54287559
>>>/vg/agdg
>>
>>54287570
C++ doesn't support covariance/contravariance implicitly, but you could either convert each Car* and House* to the base class, OR you could cheat and very unsafely cast the vector<Car*> and vector<House*> to vector<base*>, which should work given that on every standard implementation all pointers have the same representation
>>
>>54287590
thanks for the response. i like the former idea about converting all the types to the base class and i remember my friend talking to me about this -- how would i go about doing this?
>>
>>54287606
also would this work if the base class is abstract?
>>
>>54287606
just a for loop into a second vector
>>
>>54287630
yes, keep in mind I said base* and not base
>>
>>54287552
Whoops, I just noticed that there's still "180" instead of height and width. Then there is no real magic number, it just segfaults every now and then.
>>
File: 1451040213076.jpg (77 KB, 591x705) Image search: [Google]
1451040213076.jpg
77 KB, 591x705
>it's a "only good library is licensed under GPL" episode
>>
>>54287687
GPL stands for Good Programming License
>>
>>54287696
the amount of incorrect statements you just said is 0
>>
I'm making one of those M/M/1 queues to work with a Dynamically Linked List, that I've already created, and the methods being called via an interface. Stuck on the idea of what is going where.

So I've got 3 files.

Queue.java (has the abstract methods to the QueueList.java's interface with blank methods)

QueueList.java (Controls the majority of the dynamically linked list

Simulation.java (Code for the M/M/1)

I just need to figure out where I'm calling what, and I'm good. Can anybody help me with this?
>>
>>54286153

the class of books is not the same thing as a container that holds all the books.

you want a data structure to "hold" references to all the books when you create them.

then you can loop through all the books in that data structure and get the title and date for each book.

Don't know C# but I'm guessing this would logically be an ArrayList.

Each book has a getter method that will tell anyone who asks what its title is.

So you could make a menu object, and then in that object you go look up all the books in your book collection, and then ask each one for its information and print it out.
>>
>>54285314
Your code is shit.
>>
File: 20160429_224917.jpg (3 MB, 4160x2340) Image search: [Google]
20160429_224917.jpg
3 MB, 4160x2340
>>54287826
>>
>>54287953
your code is shit
>>
>>54284953
that's one shitty looking axe i bet it would break really easily
>>
>>54287954
>gayhands
>>
File: mad as fuck.jpg (10 KB, 194x200) Image search: [Google]
mad as fuck.jpg
10 KB, 194x200
>stackoverflow
>"hey guys how do i do x using the standard library?"
>"use library y"
>"+1 for recommending library y!"
every fucking time
>>
>>54288220
kek, true, they like to recommend libraries over diy.
I prefer diy because i don't like dealing with licenses.
>>
File: 1432860473789.png (40 KB, 335x342) Image search: [Google]
1432860473789.png
40 KB, 335x342
>>54288220
>People pull in dependencies for simple functions they could easily implement themselves
>>
I'm writing a JavaScript native game engine.
>>
>>54287953
Why ?
>>
>>54287953
>>54288008
>a shit*
newfags
>>
>>54288291
>JavaScript
>Native
>>
>>54288252
its pretty simple to parse json, to deserialize and serialize data structures in C++. a simple function right?

simple interfaces != complex or bug-prone pitfalls in implementation.
>>
File: wagner.jpg (102 KB, 350x361) Image search: [Google]
wagner.jpg
102 KB, 350x361
Post some good programming videos to watch.

Anything from a great talk, a discussion, interview, Gaben.
I need something to watch when I'm not programming (like when I'm eating!).
>>
>>54288333
Anon, we've told you this before. Newfags like yourself need to leave. It's even worse when you're a newfag crossboarder. Are you new to the other boards too?
>>
>>54288354
most programming videos are just smug shitters and overrated fags talking about basic shit
>>
>have a lot of shared functionality between classes expressed through a shitload of interfaces
>realize that most of the interface implementations have identical implementations across classes
>move the shared interfaces into an abstract class and then inherit that, and implement additional needed interfaces on top of it
>end up with half the codebase's lines removed
Feels good man
>>
>>54288382
Just wait until you fall for the FP meme
>>
http://i.4cdn.org/f/SHARKWITHWHEELS.swf desu ne
>>
>>54288351
That's not what I'm talking about. I'm talking about those fags who pull in dependencies for functions that are a few lines.
I don't remember if it was python or javascript or whatever, but some ridiculously trivial package was pulled from their package manager (trims leading and trailing whitespace on a string or something), and it broke a shitload of high-profile packages.
Dependencies are a bad thing. You can't avoid them most of the time, but you should make an effort to minimise unnecessary ones.
>>
>>54288397
I forgot about /f/
>>
>>54288432
baka ne
>>
>>54288404
left-pad and it was Javascript.

thats just idiots delving waaaaay too deeply into SOLID .. and a way to pad their "github resumes." look $employer, I maintain a dozen packages that, totaled, have been installed 150 million times.

the funny bit about left-pad is that it had subtle problems (quadratic execution time for certain strings). so even though it was 11 lines, it wasn't ideally implemented.
>>
>>54288354
Find something that relates to your preferred programming language or technologies that you use.

I enjoyed the shit out of //build/ because I primarily work with the .NET stack.
>>
>>54288484
>primarily work with .NET
learn F#
>>
>>54288502
>functional garbage
no thanks
>>
>>54288502
I like F#, but frankly there's more resources on C#.

I've only been programming for about 5 years or so, so I still end up needing a good amount of documentation and examples to go off of.
>>
>>54288354
watch mathphile or whatever it was called on youtube or computerphile
>>
>>54288528
I definitely see that but one of the main reasons is that everyone's doing C#

>>54288520
It's multi-paradigm but functional first, what's wrong with it?
>>
>54288542
no TCO on Mono, no hints at TCO on coreclr either.

F# outside of Windows can be extremely slow because of this.
>>
>>54288542
Additionally, I'm not sure how F# would increase my productivity, or particularly help with my line of work.

There's already ways to implement some functional designs in C#, and they're adding more very soon. Pattern matching is going to be a thing.

I primarily work with databases and pulling data from APIs and merging everything into a data warehouse. C# makes that piss-easy, so I'm not sure how F# would help there.
>>
>>54288556
Sounds pretty shit, can always avoid recursive functions
>>
>>54288531
Numberphile
>>
File: json type provider.png (16 KB, 798x323) Image search: [Google]
json type provider.png
16 KB, 798x323
>>54288567
F# would significantly reduce your code size

>I primarily work with databases and pulling data from APIs and merging everything into a data warehouse.
What if I told you F# features can automatically generate statically typed access to a database?
>>
File: Capture.png (19 KB, 515x362) Image search: [Google]
Capture.png
19 KB, 515x362
can't really wrap my brain around this one
maybe you logic guys can take a crack at it?

the problem is how to take that sorted information and sortof combine the two structures to make the xml structure
>>
File: HgytXc9.png (21 KB, 755x468) Image search: [Google]
HgytXc9.png
21 KB, 755x468
>>54288587
That's pretty goddamn hot.

The way I pull 4chan .json is cancer in comparison.

So intellisense went out and parsed that file and automatically typed it into an object?

Or did you declare the objects somewhere?
>>
File: Gin.Tama.full.1912378.jpg (845 KB, 800x1500) Image search: [Google]
Gin.Tama.full.1912378.jpg
845 KB, 800x1500
>>54288354
https://www.youtube.com/watch?v=N8elxpSu9pw

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

https://vimeo.com/9270320
>>
>>54288626
JsonProvider is a type provider - an F# program that's compiled and run by the IDE before your actual program is compiled, which can then generate and inject types and other stuff into the namespace.
JsonProvider (as well as some other stuff) is part of a nuget package FSharp.Data

In this case you pass it an argument (a compile time constant string) and it fetches the website, reads the JSON and generates types based on it. There's another example for World Bank data somewhere.
>>
>>54288647
>Bisqwit
Now that's an odd creature.
>>
>>54288647
>zed shaw
REEEEEEEEEEEEEEEEEE
>>
File: 12321231231wa.jpg (10 KB, 200x200) Image search: [Google]
12321231231wa.jpg
10 KB, 200x200
>>54288647
>The Top 10 Ways To Scam The Modern American Programmer
>by Zed A. Shaw
He finally wrote an autobiography?
>>
>>54288599
nvm solved it
>>
File: zed.jpg (117 KB, 940x492) Image search: [Google]
zed.jpg
117 KB, 940x492
>>54288715
>>54288732

>2012
>zed shaw warns that top100 corporations will embrace open source because for them open source is a synonym for free labor
>zed advices programmers to embrace gpl3 to avoid top100 control on FOSS community.
>everyone laugh

>2016
>ibm, amazon, microsoft, oracle, apple, ... are now open sourcing all their stuffs
>free commits everyday from non paid programmers (muh github dev log, muh ego)
>everyone claps and joy, microsoft is now taken as an example of openness, the same microsoft that literally wanted to kill linus torvalds.

Zed may be bad at programming tutorship but he had that one right.
>>
>>54288672
Surely I can abuse this in C# somehow, no?
>>
>>54284745

Thank you for using an anime image in the OP.
>>
Now that my brain has already calcified, is 25 to old to start to learn how to program and become good at it? I think I've read somewhere that it takes 5-10 years to become really proficient, not to mention that people usually start to learn in their early teens, so I am at a huge disadvantage. Would it even be worth it to try?
>>
File: type provider 2.png (39 KB, 1023x487) Image search: [Google]
type provider 2.png
39 KB, 1023x487
>>54288844
http://stackoverflow.com/questions/13771700/could-f-type-providers-be-incorporated-in-c-sharp

also I don't know that the actual content is available at compile time, but a type provider could do that (which, incidentally, would allow you to incorporate assets into the .exe while keeping them as separate files before compilation)
>>
>>54288873
>Would it even be worth it to try?
With that defeatist attitude, no.
>>
>>54288342
Yup, I'm embedding V8 and give it access to window and user input.
>>
File: 1450075505927.png (643 KB, 678x653) Image search: [Google]
1450075505927.png
643 KB, 678x653
>>54288843
>literally wanted to kill linus torvalds.
kill yourself faggot
>>
>>54288873
Read this https://okepi.wordpress.com/2014/08/21/how-to-become-a-programmer-or-the-art-of-googling-well/
Before you stop trying.
>>
>>54288924
http://techrights.org/2009/01/12/bill-gates-jihad-vs-linux/
>>
https://github.com/fsharp/FSharp.Data/blob/master/src/Json/JsonProvider.fs

This is the source for the JSON provider

I believe type providers are run only when their parameters change, or when you load the project.
>>
>>54288291
>>54288908
basically CEF?
>>
>>54288924
Was her hair always this big?
>>
>>54288382 again
I've found that due to moving my events from an interface to an abstract parent class, I'm forced to call the abstract parent's constructor before the child's constructor, but parts of the parent constructor depend on values being set by the child's constructor. For example, in the parent, I have this method which runs as part of the constructor:
protected void Constructor() {
Parent=null;

BoundingBox.Moved+=Moved;
BoundingBox.Resized+=Resized;
Moved+=((object obj, MovedEventArgs args)=>RequestedRedraw(obj, null));
Resized+=((object obj, ResizedEventArgs args)=>RequestedRedraw(obj, null));
}

Clearly this depends on BoundingBox being non-null so as to access the events it exposes, but BoundingBox is set in the constructor that the Child is called with - thus, upon trying to instantiate a child, the program crashes will a null pointer exception (due to trying to access an event on null).

What is the "correct" way to solve this? The only results I could find on google basically amounted to "refactor", but I don't feel like moving the same eleventy billion events into the child classes is the right answer (that was the impetus for inheriting in the first place).
>>
>>54288879
Hrm...

I may just write an F# library for the 4chan calls and use it in an existing C# codebase.
>>
>>54288930
>How to become a programmer, or the art of Googling well
inb4autism

This is truth.

A good chunk of any programmer's time is spent shitposting or researching.
>>
>>54288732
kek
>>
>>54288967
Haven't heard about it. Basically "here is your array of canvas pixels, here is your update(events) function, do whatever you want with them)
>>
>>54288843
and what's wrong with that?
>>
>>54289015
They'll probably say something about how companies profiting off the work of others isn't fair to the contributors, and devalues contributing to open-source software. This results in developers not sending patches and features they write upstream, as they don't want "the man" profiting off their efforts.

The thing missing from this analysis is the fact that everyone gets access to a (hopefully) well developed and feature rich code base, and assuming the licenses are permissive can port or improve upon the work of others rather than reengineer the wheel.
>>
>when you tune into a conference video and hear the thickest fucking accent
>>
File: watermelon.jpg (393 KB, 1600x1200) Image search: [Google]
watermelon.jpg
393 KB, 1600x1200
>>54288354
https://www.youtube.com/watch?v=E3418SeWZfQ
>>
>>54289290
>Pajeet is this delusional
https://www.youtube.com/watch?v=cYJcfhxMkrQ
>>
File: unqual.png (30 KB, 969x362) Image search: [Google]
unqual.png
30 KB, 969x362
what is this bullshit reeee
>>
File: 1447921043042.jpg (7 KB, 180x210) Image search: [Google]
1447921043042.jpg
7 KB, 180x210
>>54289290
>java is used in aviation
>>
>>54289290
kek
>>
>>54289486
it's not used on plane but it's used a lot on the ground like in towers control. NASA uses java to control their robots in space from the ground.
>>
>>54289563
maybe in the past
I remember a talk at cppcon about them using c++ on curiosity
>>
>>54289630
>cppcon
>C preprocessor convention
Wow, that sounds dull.
>>
>>54288354
https://www.youtube.com/watch?v=oss7KmiHLmA
>>
>>54289666
>>54278703
>>
>>54289666
kek
>>
File: x5DIIzzu.jpg (18 KB, 240x240) Image search: [Google]
x5DIIzzu.jpg
18 KB, 240x240
I'm reading https://ngnghm.github.io/blog/2015/08/02/chapter-1-the-way-houyhnhnms-compute/
It's brilliant.
>>
READ
THE
CLASSICS

http://www.paulgraham.com/avg.html
http://www.paulgraham.com/hp.html
>>
>>54289676
Cringecomp 2016.
>>
>>54289717
>You may dismiss all this as dreamy philosophy, empty words without any consequences

Don't worry, I already did.
>>
File: hello.png (192 KB, 348x348) Image search: [Google]
hello.png
192 KB, 348x348
>At college campus
>Fucking windows everywhere
>Having to code in C++ Builder (crappity crappity crap)
>FML
>Ultrabloated fockin machenes
>network slow
>windows
>Teacher knows less than john snow
>F.M.L.
>>
>>54289839
Reddit is this way friend >>> reddit
>>
>>54289839
Pretty memey post you got here.

Stop bitching and cope, or find a different college.
>>
>>54289839
>he fell for the higher education meme
>>
>>54289839
i don't understand why people keep reposting that image, it's not funny or interesting

>>54289881
careful, bogeymaning reddit will get you banned
>>
>>54289935
boogeymanning banning will get you banned
>>
>>54289563
I read that some of the rovers have Java code running on them. I recall the guy who created Java was boasting about that.
>>
>>54289839
>Pay $
>Be treated like a retard by techer-tier retards
Enjoy your
C O L L E G E
E X P E R I E N C E
>>
For the ones of you that freelance, where do you get gigs? Creating/reviewing software/websites/mobile apps.
>>
>>54288958
that's a lot shorter than how I did it on OCaml, although I guess most of that is just a library doing the dirty work
if I implemented like the inference functions and a function to generate the ASTs for these kinds of things I guess I could use ppx_tools for quotations and it would be only slightly longer
>>
>>54290277
https://www.upwork.com/
>>
>>54290639
>https://www.pajeet.com/
>https://www.sandeep.com/
>https://www.kumar.com/
>>
File: ZAlNScF.png (20 KB, 561x536) Image search: [Google]
ZAlNScF.png
20 KB, 561x536
>>54290650
I'm really tempted.
>>
File: 3.png (84 KB, 580x267) Image search: [Google]
3.png
84 KB, 580x267
hey guys, i need to implement an application related to sports in OpenGL.

do you guys have any ideas that i can implement?
already suggested:
>bicycle game
>ping pong simulator
>>
>>54290685
LOL, go for it. Make it point to upwork.com

Also:

find-pajeet.com
>>
>>54290687
4CC Manager 2016
>>
>>54290687
>sports
drake.jpg
>>
>>54290650
>$58/hour
>Already made $28215 in 6 months
>Not even my main activity

Stay mad all you want while i take my part of the cake.
>>
File: 1383518116213.png (430 KB, 625x480) Image search: [Google]
1383518116213.png
430 KB, 625x480
>trying to write a cat program
>mfw shit keeps breaking

I don't even give a fuck anymore
>>
>>54290797
You can do it! i believe in you!
>>
>>54290797
a cat program as in it just prints the input? how is that difficult
>>
File: 1403794100574.png (1017 KB, 665x663) Image search: [Google]
1403794100574.png
1017 KB, 665x663
>>54290828
>a cat program as in it just prints the input? how is that difficult

nah printing from stdin was piss easy. it was taking that and writing the content to a file.

for some reason the file gets corrupted.

btw this is based on top of the MTX operating system so I am getting weird as fuck errors that I can't google.

>tfw run cat f1 > f2
>f2 made and has same size as f1
>do cat f1
>ERROR CAN'T WRITE TO DISK
>FILE CORRUPT
>RESTARTING BOOT PARTITION
>OS goes back to init() and runs my login

FUCK THIS GAY EARTH NIGGA
>>
>>54285776
>>54285765
>signed size_t
Wow I should look things up before I speak, but I didn't not expect there to be a signed type for size
>>
>>54290878
>>54290797
#include <stdio.h>
#include <string.h>
#define MAX 3000
int main(int argc, char *argv[])
{
FILE *fp;
char filename[MAX];
char ch;
int pos;

if (argc < 1) {
printf("Usage mycat <filename> \n");
return 0;
}

for (pos = 1; pos <= argc; pos++) {
strncpy(filename, argv[pos], MAX);
fp = fopen(filename, "r");
if (!fp) {
printf("%s: No such file or directory\n", filename);
return 0;
}

while ((ch = fgetc(fp)) != EOF) {
putchar(ch);
}
fclose(fp);
}
return 0;
}
>>
File: voronoi.png (19 KB, 1920x1080) Image search: [Google]
voronoi.png
19 KB, 1920x1080
Made something in c to draw voronoi diagrams. It's slow as fuck since it iterates over all pixels and calculates the distance for every pixel, but the upside of this is I can use arbitrary distance functions like for example taxicab geometry.
>>
>>54290792
Can you do anything with c++ and no freelance history(for verification, legitimacy, that kind of stuff), or is it mainly for web devs and java"men"? I could learn new tech easily, but it wouldn't be the same, you know?
>>
>>54290903

can't use fopen on this OS

down to open, read,close,write etc

I write char by char so:

fd = open(filename, O_WRONLY, O_CREAT, 0644);

write(fd, somechar, 1);

close(fd);

and yet that shit blows the fuck up
>>
Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

No match for "PAJEET.COM".


>tfw no match for you
;_;
>>
>>54290685
I think /dpt/ should fund it
>>
>>54290928
use opengl it'd be fast as fuck
>>
File: Untitled.png (448 KB, 840x490) Image search: [Google]
Untitled.png
448 KB, 840x490
meme'ber me?
>>
>>54291242
You mean with the shader language? Atm I use opengl just for drawing (textured quad).
>>
>>54291336
yup, just a pixel shader
>>
>>54290952
>Domain names in the .com and .net domains can now be registered with many different competing registrars.
what
>>
>>54291353
>yup, just a pixel shader
>pixel shader
>pixel

it's fragment shader.
>>
>>54291401
that wasn't me but it's the same shit it's decently common to say pixel shaders
Thread replies: 255
Thread images: 51

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.