[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: 43
File: functional programming.jpg (65 KB, 440x389) Image search: [Google]
functional programming.jpg
65 KB, 440x389
Previously on /dpt/ >>54934593

What are you working on, /g/?
>>
Working on setting up a nice Linux environment to use OCaml to write my language.
>>
>>54944744
Currently learning assembly. More specifically, practicing converting between the 3 number systems used so I can be faster at it.
>>
>>54944776
>assembly
"assembly" doesn't exist
>>
File: alignment-vs-autonomy.png (164 KB, 650x455) Image search: [Google]
alignment-vs-autonomy.png
164 KB, 650x455
>>54944744
Thoughts?

How does your team do software dev?
>>
>>54944808
i like to stimulate my prostate when i fap
>>
>>54944789
Look they're all different dialects of assembly. You wouldn't call southern a different language, no, it's just another way of speaking english. It's still english.
>>
>>54944829
You use your finger or a dildo?
>>
>>54944756
A nice Linux environment isn't possible.
>>
>>54944744
One of my opsec security mates suggested this book: Hacking The Art of Exploitation.

Is this actually a good book?
>>
File: fd.png (3 KB, 113x182) Image search: [Google]
fd.png
3 KB, 113x182
So I have a map file that looks like this:

111111111111
100000000111
101111110111
101000010111
101000010111
101000010111
101100110111
100000000111
100000000111
111111111111
111111111111


and I'm trying to load it into a 2D array in C like this:

char map_data[height][width];
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
c = fgetc(tile_map->file);
if (c == '\n') continue;
map_data[y][x] = c;
}
}


However it seems to be loading in the wrong data.

Help?

pic related is the output i recieve
>>
The
                                                                                                    best                                                                                                    programming                                                                                                    language                                                                                                    is                                                                                                    OCaml
>>
How do I convert an integer character to an actual integer in C?

For example, if I read a file and it contains '3', fgetc won't read 3 but will read the number that corresponds to the character 3, right? How I can I get the number 3 as an integer?
>>
>>54944939
atoi
scan functions
>>
>>54944937
>code tag abuse
>>
Why does every programmer these days have the hipster glasses and goatee? What happened to the image of a programmer being a fat neckbearded basement dwelling autist?
>>
>>54944950
Beard + thick-rimmed glasses + undercut = new programmer chic
>>
>>54944973
What year again did that image begin happening?
>>
>>54944903
Looks like the height and/or width are off. If you write a dummy character instead of leaving the garbage when you read a newline, you'll more easily see what's going on.

You also need to be careful of line endings - it may be more than just a newline.
>>
>>54944973
can confirm, shaved my beard and switched to contacts to avoid association with fuckin nu-male programmers, brogrammer 4 lyfe
>>
>>54944947
>
                                                                                                    implying
                                                                                                    the                                                                                                    obvious
>>
>>54944983
Since about 2012 or so. Maybe earlier.
>>
>>54944903
First of all, in Windows there are two symbols for an end of the line: \r\n
Then, when you read in cycle and say "continue", you skip a cell.
Don't use fgetc.
Try something like this:
FILE *file;
char str[width+2];
fgets(buf, width+2, file);
>>
>>54945142
fuck. I made a mistake
str = buf
>>
>>54945012
Same here. Recently I stopped shaving because finally I can grown a proper beard. Worn it for like 3-4 months (after it grown) and now I'm clean shaving again from the very same reason.
>>
>>54945142
Haha I didn't even know fgets existed. I thought you had to read files character by character.

Thanks!
>>
File: xdmv.webm (1 MB, 1920x1080) Image search: [Google]
xdmv.webm
1 MB, 1920x1080
Wrote a desktop visualizer for X last weekend. Just finished pulse support for it.
>>
>>54945384
>high functioning autism
>>
does c++ have premade tools like java does? do you just #include things like binary search trees etc etc etc or do you have to make them yourself?
>>
>>54945443
yes
>>
I'm back again. This is the last thing I need but I just can't figure it out. I want to make the progress bar show how many of the images are downloaded.

This is in a class called imageboard
int count = 0;
if(filename != "" && extension !=""){
QString link = "https://i.4cdn.org/"+board+"/"+tim+extension;
qDebug()<<link;
downloadFile(link, tim, extension,saveLocation,folderName);
count++;
emit valueChanged(count);
}


I made an object of type imageboard in mainwindow.cpp and then use this
connect(image,SIGNAL(valueChanged(int)),bar,SLOT(setValue(int)));


The issue is that it seems that the signal is only emitted once. It doesn't update again. I can post more code if it's needed
>>
Trying to learn Xlib/Xcb bullshit.
I have opted into no window events at all except WM_DELETE_WINDOW, yet I get a spurious "Event 64" from the window manager (event->response_type is 192) when I minimize the window.

Anyone know what the fuck this event is?
>>
File: ultra crying rage feels.jpg (106 KB, 601x601) Image search: [Google]
ultra crying rage feels.jpg
106 KB, 601x601
>>54945453
i was looking forward to making them myself
>>
>>54945658
you can always implement it yourself for practice. No one is forcing you to include anything
>>
>>54945658
I know that feel. I try and implement a lot myself outside platform abstractions like OpenGL.
>>
how to initialize this 2D boolean array in C++ with size M * N?

 

bool **adjacency;

>>
>>54946041
bump
>>
>>54944939
you have a char x_char
int x_int = int(x_char - '0');


im a c++fag so idk if that's the right type conversion syntax, but that's essentially how u do it
>>
>>54944744
>go to hackathon
>team up with some guy
>theme: file conversion
>set up a flask web server with bootstrap front-end
>allow user to upload photo
>get photo, use microsoft cognitive services API to get a photo description
>use some other API to segment description in small meaningful parts
>use bing API to image search meaningful parts and download one image for each
>put images together into a gif using imagemagick
>return gif to uesr
>user uploads photo and gets back a gif that describes the image
>extend it to text files (txt, docx, doc, pdf, etc) using zamzar conversion API
>win 1st place for hackathon
we just stitched together a bunch of APIs guys
>>
>>54946041
bool **adjecency = new bool[M];
for(decltype(M) i = 0; i < M; ++i)
adjecency[i] = new bool[N];
>>
>>54946244
whats decltype you're using there?

can't you just do:
bool **adjecency = new bool[M];
for(int i = 0; i < M; ++i)
adjecency[i] = new bool[N];



?
>>
File: colour-logo.png (39 KB, 2187x601) Image search: [Google]
colour-logo.png
39 KB, 2187x601
Opinions on OCaml? Is it fun? What kind of things is it good for?

I'm considering dual booting ubuntu to learn it better, windows support seems pretty shit for it.
>>
>>54946293
I meant to learn it, in the first place. No previous exp.
>>
>>54946304
>>54946293
OCaml has some very interesting features which make it useful:

1. It compiles to byte code and is fast. One can write embedded systems and OS in it.

2. Still it has higher level functional constructs and garbage collection, no need to worry about memory leaks.

3. Not sticking to pure functional programming makes it a bit easier (at least for me) as compared to Haskell. Also one doesnt have to worry about lazy evaluation like in Haskell .

4. F# is repackaging of OCaml by Microsoft on its .net platform. One can write apps for Windows platform for F# just like in C#. There seem to be lot of libraries around for F# unlike OCaml.

OCaml like C++, Nim and Rust is a systems language. Just that its functional first. The use cases of all these will be same.

Why you should learn it:
1. To learn Functional Programming.
2. To learn a fast high-level language.
3. for a Finance industry job, if one's company uses it.
>>
>>54946277
You never specified what type M and N are so I used decltype to make it agnostic.
>>
>>54946347
 error: cannot convert ‘bool*’ to ‘bool**’ in initialization



it gives me this error
>>
>>54944808
How my team does software dev:

Team consists of 4 people.
>me™, the Java/Android code monkey
>her™, the UI designer from Mexico
>him™, the project manager/iOS dev/brogrammer
>it™, the monolithic asshole CEO/boss

She sends a .psd to Him and he approves the design. I never have direct contact with her, because she is a woman and must be protected from monkey. He throws the .psd into my cage, and I extract the assets and start a nice day of Android Brogramming™. When I am finished, I push my code out of the cage and he looks at it. If it is good, I am awarded 2 bananas and one CrackRock™. If he is unsatisfied, he opens my cage and slaps me, leaving me vulnerable and crying on the ground. But I deserved it, I am just a monkey, I should have known better than to try to add unit tests to our codebase and waste valuable resources. Sometimes, when I am smoking a good monkey CrackRock™, it will come to the cage. No matter what I have done for the day, it will berate me and belittle my intelligence. However, it is the one that provides our company with bananas, allowing me and my other two treemates to keep living. When the day is over, I find the juiciest monkey bum and go nanners over my raging monkey cock. I wake up in a haze of cum and CrackRock™, and after getting myself together I begin another day at the zoo.

My job is bananas.
>>
Doing some shit in python for a summer class.

>tfw done with hardest C++ CS classes and I'm just cruising through with fun classes now

Also, Python is cool as shit.
>>
File: laptop_chimp.jpg (103 KB, 369x325) Image search: [Google]
laptop_chimp.jpg
103 KB, 369x325
>>54946412
>>
>>54946395
Woops the first new needs to be:
new bool*[M];
>>
I just graduated and don't have a job yet
Where can I find some ideas for projects to work on in the mean time to keep my mind sharp and possibly pick up a few more programming languages for marketability
>>
>>54946578
in your head you stupid monkey
>>
>>54946332
>Also one doesnt have to worry about lazy evaluation like in Haskell
Nota bene, it has support for lazy evaluation in the stdlib, but it's not as nice as Haskell.
>>
>>54946591
I'M NOT STUPID
RAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaa... ._.
>>
>>54944937
It's actually rust.
>>
>>54946573
new bool [M][]
you forgot to make it look cool
>>
>>54946293
Shit libraries, have to use a 3rd party standard library to get anything done, there are 3 competing standard libraries, 1 is incomplete but works for web stuff, 1 is complete but massive and can't be used for web stuff, 1 is buggy and broken.
Programming support on windows leaves to be desired.
Type system isn't as powerful as I'd want, but the module system is fantastic.
>>
>>54946332
Ocaml is as much of a systems language as haskell or go.
>>
>>54945384
>Beyond the wind - Taishi Remix -
>Shibayan
>CYTOKINE
Fucking fantastic taste
>>
File: Untitled4902.png (125 KB, 1920x1080) Image search: [Google]
Untitled4902.png
125 KB, 1920x1080
Not programming, but setting up a Gogs/git server for internal use in our organisation.
It will also contain router configuration and several deploy scripts for virtual machines.
>>
what's a nontrivial project i can work on thats doable as a rising junior in csci?
>>
Guys is lama book actually good to learn perl?
anybody knows good tutorials?
>>
File: MyNextLaptop.png (98 KB, 1065x411) Image search: [Google]
MyNextLaptop.png
98 KB, 1065x411
>>54946878

>Not programming, but...

Not programming, but this is my next programming rig. I hate most laptop brands; even Lenovo is turning into shit. Might as well try something new, and also built for Linux with no driver conflicts.
>>
>>54947029
>Ubuntu
>>
>>54947029
What's that?

Also what's wrong with Lenovo? I've had my Thinkpad X201 for a few years and it's holding well
>>
 
#pragma once
class point
{
public:
point();
~point();
};


what does this stuff mean? i googled about creating an object in c++ and it doesn't say. idk what pragma once is, or what point(); and ~point(); are
>>
>>54947055
#pragma once

compiler specific pragma that tells the compiler not to include the file more than once

point();
constructor declaration

~point();
destructor declaration
>>
>>54947055
Do you know anything about OOP?

pragma is like c style header guards.
#ifndef LONG_STUPID_LOOKING_HEADER_NAME
#define LONG_STUPID_LOOKING_HEADER_NAME
>>
>>54947110
>Do you know anything about OOP?
no i don't, because it's bad and for codemonkeys like you
>>
>>54947159
Yeh I can clearly see that after being overwhelmed by constructor.
>>
>>54947051
System76 only sells their machines with Ubuntu on them, but it should be compatible with all modern Linux distributions. I plan on installing OpenSuSE Leap on it, since it's the distro that has always just worked for me.

>>54947053
It's a System76 Kudu. System76 is a company that specializes in Linux laptops. I knew I needed to get a new laptop because the keyboard on my Thinkpad T440p is now dead (half the keys, including the spacebar and enter key do not produce any response; I am now typing this using a cheap USB keyboard), and since I've been finding programming on Windows to become increasingly annoying, I figured I'd get a Linux machine. With System76, I get no driver conflicts guaranteed. I also considered ThinkPenguin, but what ultimately sold me on System76 was more or less that there were less options for higher end machines with ThinkPenguin, and also, that they don't support the new AC band on Wifi, whereas System76 does out of the box.

>>54947159
There's nothing wrong with OOP, or with Functional Programming, or with combining the two. What is bad is taking either to their logical extremes. In OOP, this might be creating overly complex patterns for simple problems, and in FP, this might be making unnecessary copying to avoid state changes.
>>
>>54947110
pragma once is it, pragma is a non-standard compiler instruction and can do a variety of things.
>>
>>54947223
Why would you need higher end machines? Can't you do your computations on a rented server/VPS if you need this type of resources? Surely with the advent of cloud computing there are more important criteria when considering a laptop, no?
>>
>>54947279
Btw I don't mean to criticise your choice, I totally have a lot of things I find unpleasant with my Thinkpad, but just curious
>>
How do people work with laptops without trackpoint? Losing my track point would definitely cut into my productivity quite a bit
>>
>>54947224
ye that's what i meant, my bad for not stating once clearly. I was just refering to THE pragma in his code block.
>>
>>54947319
I have a trackpad and it's enough to use my computer.
>>
is there any version of java's this for c++? or do i have to name setter arguments something different than the object's variable?
>>
>>54947279

1. I don't do and won't do "cloud computing". I refuse to depend on another person's computer to get my work done. Using the cloud for backups is okay, but my files should be located on machine as much as possible.

2. It's name is Android Studio and it is a resource whore like no other.

3. Also, virtual machines. Something I have an interest in is kernel development, and I would like QEMU or VirtualBox to not run like dogshit.
>>
>>54947376
yes its called this.
but it's a pointer so u need to use this->
>>
Learning Java, not much else. I know C/C++/Javascript to an extent so it's been easy to pick up so far, there's a lot more overlap than I was expecting.
>>
>>54947399
How did you do kernel development on Windows?
>>
>>54946472
length s - (maximum $ map length $ group s)

Learn Haskell.
>>
>>54947453
You don't. You can try, but just don't.
>>
File: 1458069487920.jpg (769 KB, 2040x1244) Image search: [Google]
1458069487920.jpg
769 KB, 2040x1244
>>54947494
what is, in your opinion, the advantage of learning Haskell?

i see you solve simple problems quickly.

i might consider learning it
>>
>Haskell

{-# LANGUAGE TemplateHaskell, OverloadedStrings, OverloadedLists, GADTs #-}
{-# LANGUAGE MonadComprehensions, ParallelListComp, TransformListComp, RecursiveDo #-}
{-# LANGUAGE UnicodeSyntax, LambdaCase, MultiWayIf #-}
{-# LANGUAGE BangPatterns, ViewPatterns, PatternSynonyms, TupleSections #-}
{-# LANGUAGE RankNTypes, TypeFamilies, MultiParamTypeClasses, ExistentialQuantification #-}
{-# LANGUAGE DeriveFunctor, DeriveGeneric, DeriveFoldable, DeriveTraversable, DeriveTraversable #-}
>>
>>54947519
It's sufficiently different to be (a) interesting and (b) mind-expanding.

I find myself thinking 'applicatively', if that's a word, and less imperatively these days.
>>
>>54947402
ty, also how do i do what im trying to do here
 string x("(" + x + ", " + y + ", " + z + ")");

correctly?
>>
File: 1438020484791.gif (2 MB, 350x197) Image search: [Google]
1438020484791.gif
2 MB, 350x197
>>54946412
this was surprisingly accurate
>>
>>54946472
std::string::size_type getmin(const std::string &str)
{
std::vector<std::string::size_type> elems{};
elems.reserve(str.size());

foreach(const auto &ch: str)
elems.push_back(std::count(str.begin(), str.end(), ch);

return str.size() - std::max_element(elems);
}


Wonder if you could somehow do a simple list comprehension in C++.
>>
>>54946412
I never got the TM thing? I know it means trademark and stuff, but what do people use it for in this kind of context?
>>
>>54946412
kek
>>
>>54944808
Good goyim.
>>
>>54946952

Llama book? Yes. Camel book? Not unless you're already an experienced programmer.

I learned with the camel book, and was not an experienced programmer. It was painful. But at least the camel book is still useful when I need to figure out the odd areas of perl, whereas the llama book wouldn't be.
>>
>>54947624
It adds a flavor of ironic coolness.

You have to be a supreme meme connoisseur to understand.
>>
>>54947679
But like how does it relate to the initial meaning? I kind of get that it mocks the fact that big corporations feel the need to trademark everything, but not sure if this is all
>>
>>54947694
you're right, he used the meme poorly
>>
>>54947708
But i'm not saying that... I was just trying to understand not accuse them for misusing a meme lol
>>
>>54947453

I actually took an old beige box desktop that's been collecting dust in the corner of my living room (it's basically from 2000 or 2001 or so), and installed Debian on it. I've done some basic boot level programming on it with i386 assembly and a floppy. That said, I'd like to work in architectures other than just 32-bit Intel, and QEMU doesn't always like to play nice on Windows... and even when it does, cross compilers don't play well on Windows at all.
>>
File: 1439903195165.png (536 KB, 776x840) Image search: [Google]
1439903195165.png
536 KB, 776x840
Imagine you receive an android body by mail.

It has a 48 degrees of freedom (DOF) with 12 hrs of battery life (avg physical activity) with all necessary sensors (eye CMOS cameras, microphones, gyro/accel, tactile sensors, speech dynamic) and 10-core ARM CPU inside (there is a wifi as well, so offloading computation to the cloud is possible), and a microcontroller for precise motion control linked to main CPU.

You have a full access to software and firmware, you can use standard dev tools (compilers, runtimes) and OSes for main CPU and the microcontroller.

How would you program it?
What are the main technical problems in this project?
Which approaches/methods/algorithms would you use?
Which software would you use?
>>
>>54947787
I'd like to write an OS for my own simple 32-bit RISC architecture, but I have better projects to do. Maybe later.
>>
>>54947787
Why use Windows at all
>>
>>54947836

Because drivers are a bitch, and sometimes I like to play games. That said, I've rarely had time for games these days, and since I'm into older shit, a lot of it probably works in Wine these days anyways.
>>
#include "stdafx.h"
#include <string>
#include <sstream>
#include <iostream>
using namespace std;


class Point {
public:
void setX(double x);
void setY(double y);
void setZ(double z);
double getX(void);
double getY(void);
double getZ(void);
string str(void);
Point();
Point(double x, double y, double z);

private:
double x;
double y;
double z;
};

void Point::setX(double x) {
this->x = x;
}

void Point::setY(double y) {
this->y = y;
}

void Point::setZ(double z) {
this->z = z;
}

double Point::getX() {
return x;
}

double Point::getY() {
return y;
}

double Point::getZ() {
return z;
}

string Point::str() {
ostringstream os;
os << "(" << x << ", " << y << ", " << z << ")";
return os.str();
}

Point::Point(void){
setX(0);
setY(0);
setZ(0);
}

Point::Point(double x, double y, double z){
setX(x);
setY(y);
setZ(z);
}

int main(){
Point a(1, 2, 1.5);
cout << a.str() << "\n";
}


i never realized how retarded OOP is until i had to write the getters and setters myself without eclipse making them automatically
>>
>>54947864
I just have two PCs for these purposes. Bought one 100$ one for old games. Plays skyrim and stalker fine, good enough for me. I also use it to fool around with Unity.

Primary PC is linux.
>>
>>54947889
>2016
>Still bother with copypasted getters and setters
>Not making them inline
>>
>>54947889
template <typename T>
struct Point3 { T x,y,z; }

>muh OOPs
>>
>>54947889

Just make x, y, and z public.

>>54947900

Yeah, personally I'm a fan of the idea of "one laptop to rule them all." So I get something big enough for all of my development purposes, as well as my day to day usage.
>>
>>54947948
>Just make x, y, and z public.
>>
>>54947974
>posting /sci/ cancer in /dpt/
>>
>>54948002
>>>/pol/
>>
File: 1464723576745.jpg (38 KB, 362x346) Image search: [Google]
1464723576745.jpg
38 KB, 362x346
>>54948014
>>
File: dont bully the anime girls.jpg (174 KB, 900x630) Image search: [Google]
dont bully the anime girls.jpg
174 KB, 900x630
>>54948023
>>
>>54947889

Yeah, when I started learning C++ the first thing I did was go out and find an emacs package that would generate them for me.

I understand why getters and setters are a good idea, but damn it gets repetitive.
>>
>>54944744

Where can I find this pdf?
>>
>>54947974
If it's literally just
double x, y, z
, then you better make it just public. It's absolutely retarded to make it private, just because that's how you did OOP in school. It makes sense if your class contains something like
double *x
which contains a three dimensional array or something. Then getters and setters are important to prevent/debug segfaults and whatnot. For simple classes it's just obstructive.
>>
>>54948160
libgen
>>
>>54948160
libgen.io
>>
>>54948168
but then you have to keep track of which classes you gave private variables and which ones have public ones
>>
>>54947948
>one laptop to rule them all
>tfw 4 thinkpads remove the need for VMs
>>
>>54948237
>private
got something to hide?
>>
>>54948221
>>54948219

Thanks I always forget this address.
>>
>>54948219
>>54948221

>tfw no "let's read serious book X and discuss it" threads

Libgen has every tech book existing, even obscure soviet ones. It also has access to sci-hub database which means all published scientific knowledge.

Why don't we read it more?
>>
>>54948298
>Why don't we
because you are retards
>>
>>54948298

Random question but is there a story behind libgen? Why does it exist? It's saved me hundreds on books for college.
>>
File: jew parenthesis lisp sicp.png (627 KB, 1012x798) Image search: [Google]
jew parenthesis lisp sicp.png
627 KB, 1012x798
>>54948298
>>54948323
let's start now. first book: SICP. read it by friday and we'll talk about it then
>>
>>54948298
I'm the guy who asked for the OS book. We got assigned that and this as a supplement because I don't think my professor is actually going to spend lecture time on teaching C.

Is this ancient book even worth downloading or do is there anything better.
>>
how is the human consciousness a thing

the behavior of the brain could perhaps be modeled as a computer that does nerve impulse and hormone I/O

if you simulate a brain well enough, have you created a consciousness? if not, what is it that makes us special?

to what degrees are animals conscious? a lot of them demonstrate fairly complex behaviors which require non-trivial thoughts and not just instincts

what about the most primitive animals? what about plants?
>>
>>54948237
I never quite understood what the exact reasoning is in categorically making all attributes private like most schools/universities teach. If you have literally just a static sized class with attributes that you can freely change anyway, it makes absolutely no sense. If you have more complex data structures like trees or linked lists, then changing attributes such as the pointer to the next element would fuck up the complete data structure, so you want to prevent this from happening ever. In most other cases it's absolutely okay to make many of them public, you just need to think about what you are doing for like five seconds.
>>
Why is X11 so fucking shit?
>>
>>54948465
You could try 'C Programming: A Modern Approach' by K N King, if you aren't interested in K&R. Its about 5 times the length though and spends the first fifth of the book on basic printing.
>>
>>54947889
>getters and setters
wew lad, your point shouldn't be set after construction. It should only be changed by adding vectors to it. Likewise, you're supposed to used initialization list when constructing so that your fields will have values on initialization. For somethign as simplistic as a point in space you can just have the coordinates public anyway.
>>
>>54948501
That's all cool when you're the only person ever interacting with your code, but what happens when people are using your library and you go from having no sanity checks anywhere because they're not needed, to actually needing sanity checks all over the place? Either you break your API and everyone hates you or you prefer delivering a buggy as shit library. Either way, everyone hates you.

Instead, you could use proper getters/setters by default so that the API never breaks no matter what tests you need to put or what the underlying representation of the object is (for example, maybe you want to change the backing store from a native array to a C array with operations bound via FFI).
>>
I want to learn Python and found these courses, which should I use?

https://www.udacity.com/course/intro-to-computer-science--cs101
https://www.codecademy.com/learn/python
https://developers.google.com/edu/python/
>>
>>54948491
humans are capable of moral thinking, they can differentiate right and wrong. animals that are incapable of moral thinking aren't "people" so it's ok to use them in ways using people would be considered immoral. if you made a computer capable of moral thought then you would have to respect it as a person. you're coming across as a brain slave whose intelligence is looping around on itself instead of being made use of
>>
>>54948378
>Random question but is there a story behind libgen? Why does it exist?

Originally it was a collection of technical books scanned by ex-soviet comrades. It was distributed on DVDs by mail. Then they added a web interface with search and expanded the collection until it has grown to the present size. They also published full collection as a set of torrents.

Looks like ex-ussr collectivism and disregard for copyright law (both on personal and on legal levels) contributed to development of libgen. Russians love free stuff and like/need technical literature.

>>54948465
It's ok, I'd go with http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf
>>
>>54948140
>>54947889
if you have a getter AND a setter, it should be public!!
>>
what should you do?

A
#define N_MAX 100

int array[N_MAX];

memset(array, -1, sizeof(array)


or

B
#define N_MAX 100

int array[N_MAX];

memset(array, -1, N_MAX * sizeof(int)
>>
What are some programming bugs that have killed people?
>>
>>54948553
Because

l e g a c y
>>
>>54948647
is should be public anyway
>>
>>54948465

Libraries change all the time, but C itself doesn't change much, so yeah, it's fine.

If your course is dealing with anything POSIXy, maybe check out The Design and Implementation of the FreeBSD Operating System.
>>
>>54948650
they're both equally shit
>>
File: cousin snapchatted me this.png (2 MB, 1035x1841) Image search: [Google]
cousin snapchatted me this.png
2 MB, 1035x1841
>>54948647
lol you're right. idk university courses beat you over the head with private for literally everything
>>
>>54948624
>animals that are incapable of moral thinking aren't "people" so it's ok to use them in ways using people would be considered immoral
>if you made a computer capable of moral thought then you would have to respect it as a person
weak argument imo

and i'm not talking about morals, i'm talking about what it is that makes us have a perception, why are we seeing/hearing/feeling things and having conscious thoughts, why is this
>>
File: 1372739721317.gif (2 MB, 196x235) Image search: [Google]
1372739721317.gif
2 MB, 196x235
>wanted to do embedded development
>end up java codemonkey

my dreams...
fading before my eyes...
>>
>>54948650
Unfortunately, it's not scalable. The first one handles changing the type of array but won't handle a case if you change array to pointer, the second case handles changing to pointer but not changing the type.

Also people will bitch here about using function syntax with sizeof because of autisms
>>
>>54948739
It's not too late to pick up C and learn about the wonders of pointers
>>
what else should i do now that i've got a point object made? i'm just bored and doing stuff teaching myself c++
>>54948716
it's may be a weak argument but just bc its a concise one. you could go read a bunch of philosophy textbooks if you want a stronger one
>i'm talking about what it is that makes us have a perception, why are we seeing/hearing/feeling things and having conscious thoughts, why is this
because you exist. this is what i'm talking about your brain looping around itself, you're like a guy wondering why 1 + 1 makes 2
>>
>>54948553

It's old, and a lot of the stuff it does was groundbreaking when it was implemented. They got some stuff wrong. Add to the fact that it was designed for a multiuser environment (i.e. one minicomputer/mainframe and several graphical terminals) instead of a desktop. Trends in programming and computing have changed, so thinks like Intrinsics are only used by old programs like xterm, while everything else runs GTK or Qt.

It all works, though, which is more than you can say for most of its supposed "replacements." I like the fact it's a protocol-based design, and I used it for remote applications a lot back in the day.
>>
>>54948777
lol k
>>
>>54948763
>But "sizeof()" really *is* a function.
>>
File: Clayman78.jpg (401 KB, 1224x1397) Image search: [Google]
Clayman78.jpg
401 KB, 1224x1397
>>54948491
That's an interesting question.

I tend to mostly disregard consciousness as a concept because we have no good empirical definition of consciousness for which one can design an experimental test.

There is a property of self-awareness which can be demonstrated with a mirror test. It 's hypothesized that this weird behavior in mirror tests results from animal's brain containing a simplified self-model which reacts to seeing itself. This is much more down-to-earth concept.

I think intelligence and learning can be achieved without any (humanlike) consciousness. Strictly speaking, machine learning has already created systems that demonstrate intelligence and learning (for example, see arxiv.org/abs/1602.01783 )

This is my (biased) perspective as a person which prefers machine learning to philosophy.

>the behavior of the brain could perhaps be modeled as a computer that does nerve impulse and hormone I/O
You don't even need special IO, you just need a big enough cluster of conventional CPUs (or GPGPUs), enugh RAM and right simulation software (for a more detailed look at this problem look at http://www.fhi.ox.ac.uk/brain-emulation-roadmap-report.pdf

>>54948656
toyota "unintended acceleration" bug
>>
>>54948769
I did though, and I studied C and systems programming extensively in university.

Wrote a few emulators and parts of an OS in my own time.

I didn't pursue career stuff much in college, and focused on classes and cool CS stuff instead.

As a result, I couldn't be too choosy when it came time to get a job, and java codemonkey jobs are far more abundant than interesting low-level work, so I got whatever I could and got to work.
>>
>>54948647

For simple things, and where you don't need to check for valid values, sure.

Of course, if you make it public and then end up refactoring, you're stuck with 'em if you don't want to break the API.
>>
>>54948716
>and i'm not talking about morals, i'm talking about what it is that makes us have a perception, why are we seeing/hearing/feeling things and having conscious thoughts, why is this

I think this is either:
* An illusion. Humans delude themselves all the time. There is a experiment that shows that human action selection can be predicted ~200ms before the person becomes aware of it.

* A property that is shared by all physical matter, maybe with some dependence on surrounding conditions.
>>
>>54948656
therac-25
that one plane
that one shuttle (retarded muriburgers used imperial units on a scientific measurement task and assumed all numbers were in imperial while they were actually SI)
>>
>>54948839
Hope you make some big $ at least
>>
>>54948656
https://en.wikipedia.org/wiki/Therac-25
>>
>>54948777

Create a line object that contains two points, then a polygon object that contains a vector of line objects, then draw them on the screen using Cairo or SDL or OpenGL or whatever.
>>
>>54944744
just a blackjack game in javascript with the ui obviously being html and css but Im gonna use it to help me learn how to count cards. After im gonna do one to help me learn how to find percentages of winning in poker
>>
File: canvas.png (21 KB, 800x600) Image search: [Google]
canvas.png
21 KB, 800x600
>>54948777
Draw random triangles.
>>
>>54948911
>The defect was as follows: a one-byte counter in a testing routine frequently overflowed; if an operator provided manual input to the machine at the precise moment that this counter overflowed, the interlock would fail.
>The feeling was described by patient Ray Cox as "an intense electric shock", causing him to scream and run out of the treatment room.
neat
>>
>>54944939

type casting
 num = (int) '1'; 
>>
>>54949000
This.
>>
>>54948911
>Leveson notes that a lesson to be drawn from the incident is to not assume that reused software is safe: "A naive assumption is often made that reusing software or using commercial off-the-shelf software will increase safety because the software will have been exercised extensively. Reusing software modules does not guarantee safety in the new system to which they are transferred..."
B-B-BUT MUH DON'T REINVENT THE WHEEEEEEEEEEEEEL
MUH NOT INVENTED HERE
PREMATURE OPTIMIZATION IS THE ROOT OF ALL EVIL XDXDXD
>>
>>54949014
>MUH NOT INVENTED HERE
>PREMATURE OPTIMIZATION IS THE ROOT OF ALL EVIL XDXDXD
What the fuck does do these have to do with this at all?
Why are you shitposting so forcefully?
>>
>>54949049
reinventing the wheel and NIH are equivalent
premature optimization is the root of all evil is the hottest stackoverflow codemonkey meme
>>
How the fuck do I install GHC 8?
>>
>>54949371
Install Gentoo
Seriously though, what OS are you using
>>
in C++ what am i supposed to put in the header and what am i supposed to put in the cpp? visualstudio creates both whenever i create a class
>>
>>54949417

You put your declarations in the header, and any inline functions.

Put your definitions in the cpp file.
>>
>>54949417
only a trashman uses .cpp files

>>54949371
It's out?
>>
Will work for 15$/hr

plz hire
>>
>>54949442
ok i understand, for some reason the tutorial i looked at put both the header code and the body in the cpp file one after another
>>
>>54949453
pajeet will do it for $2/hr
>>
>>54949521
Ivan >>> Pajeet
>>
>>54949530
will they be able to deport you if you don't work extra hours without pay?
>>
i fucking hate myself
>>
>>54949516

Here's the idea:

The header file contains anything other files need to know about your class. That way, when you're compiling a file that uses your class, you can #include your .h and the compiler will know everything it needs to know about the class (how much memory it needs to reserve, what methods or properties are available and what their types are, etc.).

But you don't want actual implementations in the .h file because you'd be compiling them again every time you #include the header file. You put the implementation of your class (methods, etc.) in the .cpp file, and only compile it once.

You compile your .cpp file into an object file (.o on UNIX, dunno about VS), then when you link your project all the .o files are linked together into one executable or library or whatever.
>>
>>54949590
>>>/r9k/
>>
>>54949560
I don't even consider immigration. Just plain old remote work.
>>
File: Steve Jobs.jpg (27 KB, 793x233) Image search: [Google]
Steve Jobs.jpg
27 KB, 793x233
>>
>>54949753

Steve Jobs was kind of a fag, 2bh.
>>
>>54949771
Steve Jobs invented GUIs
>>
>>54949753
>>everybody should learn to program a computer
>died of PC
>>
>>54949784

The Xerox guys left your mom all GUI last night.
>>
>>54949784
Steve jobs invented operating systems
>>
>>54949753
>>54949784
Such a visionary
>>
File: 1398230075058.jpg (39 KB, 640x475) Image search: [Google]
1398230075058.jpg
39 KB, 640x475
I want to create an oil company/peak oil simulator, for starters I just want to create a main menu window and another window with a hubbert curve and a "next turn" button that progresses through time, as you click the next button the curve will grow then peak and fall back down. I have no experience besides making a fizz buzz and hello world. Am I going in too deep for a noob? What would be the best language to use, I was thinking about java or C++.
>>
>>54949784
Steve Jobs invented programming
>>
>>54949753
>teaches you how to think
maybe if you're a retard
>>
I want the programming field to become so saturated people only do it because they enjoy it. Will this happen?
>>
>>54949897
i doubt it, the barrier of entry is really high to become a top tier programmer, it's not like art where any retard can bullshit their way and call themselves an artist
>>
>>54949897
i want to be able to have a paying career with the computer science degree i'm in school for
>>
>>54949833
>I want to create an oil company/peak oil simulator

LOL that's actually a nice idea!

>Am I going in too deep for a noob? What would be the best language to use, I was thinking about java or C++.

Just use javascript/canvas
>>
>>54949923
Found the shitter.
STEAM needs to replace STEM
Abstract thought is necessary to be more capable than Pajeet.
>>
>>54949956
>Just use javascript/canvas
KYS

just because JS is what you're familiar with doesn't mean it's what everyone should be using
>>
>>54949897
I want the programming field to become so saturated people will start automating their day to day tasks everywhere and we end up in the post-work society.

Imagine a world where you can buy a cheap robot with standard OS and program it in easy to learn but fast language like JS. Web changed the world of information, and such robots could change the physical world.
>>
>>54949968
and womens studies too because knowing the importance of diversity is strength and is more important than just being good at writing a bunch of code
>>
>>54949968
what the fuck you retard?

>Abstract thought is necessary to be more capable than Pajeet.
so programming won't get saturated obviously because people can't even do it

RETARD
>>
>>54949977
>just because JS is what you're familiar with doesn't mean it's what everyone should be using

I'm familiar with C and assembly as well, and many other languages.

See my C/SDL2 game: http://pastebin.com/AcmcNzMX

JavaScript/Canvas is just good tool for the job.

Rage is bad for your health, rage-kun (^:
>>
>>54949833

Figure out the math first, and then write a simulation for it. It doesn't matter what language, really. Python would be a safe bet - lots of people use it for math and statistics related stuff, so there's plenty of information online about it.

Once that's working, learn to work with graphics and GUIs in something like Java, C#, Python, or VB.NET for all it matters and then port your simulator to it. Porting from one language to another is easy, since the logic is already there.
>>
>>54949987
kill yourself

>>54950016
kill yourself
>>
>>54949968
autists with zero capability for art are the most capable in STEM though
>>
I want to make a a UWP music player that supports encoding like Foobar
>>
>>54950024
Prove it.
>>
>>54950020
>rage-kun: the post
>>
>>54949987
in a post-work society everyone would literally be completely dependent on the government. the more leverage the government has over you the less liberty you have. subversive speech could result in your stipend being docked
>>
i'm a 140+ IQ autist with artistic ability

i'm such a fucking genius fuck you plebs
>>
>>54949833
Python is THE language for modelling data. Don't quote me on that.
>>
>>54950057
>in a post-work society everyone would literally be completely dependent on the government.

Depends on robot ownership structure. In a good outcome goods-producing robots and factories will be owned by large enough portion of population.

>>54950064
Feynman had 125 IQ, you will probably never achieve 1/10th he did.
>>
>>54950074
R
>>
>>54950107
lol ok js fag
>>
File: smile_with_a_carat_nose.gif (2 MB, 500x500) Image search: [Google]
smile_with_a_carat_nose.gif
2 MB, 500x500
>>54950116
O.K.
>>
wow lmao people who have strong opinions need to kill themsleves
>>
for(int i=0; i < 100; i++){
if (i % 15 == 0)
System.out.println("Fizzbuzz");
else if (i % 3 == 0)
System.out.println("Fizz");
else if (i % 5 == 0)
System.out.println("Buzz");
else
System.out.println(i);
>>
>>54950107
maybe but even then you can't honestly think the population's just going to be allowed to idly sit at the same level with 90% people unemployed. just by virtue of existing people take up resources. UN's already aiming for something like an 80% world population reduction by 2060. shit's creepy, not cool at all. i'd rather humanity be at 99% employment with everyone working their asses off but doing cool shit like colonizing mars and venus and expanding than just sitting on earth having robots make us dorito chips
>>
File: 1416886161408.png (94 KB, 1600x900) Image search: [Google]
1416886161408.png
94 KB, 1600x900
>>54950134
>le golden mean meme
>>
>>54950180
>UN's already aiming for something like an 80% world population reduction by 2060
source? and do they have any realistic plans for achieving it like genocide
>>
File: 14125992.png (186 KB, 528x498) Image search: [Google]
14125992.png
186 KB, 528x498
>>54950180
wake up sheeple :DDD
>>
How do you structure your C projects? I wrote a linked list and now I want to use it in a project. Should I put the source and header in a lib/ folder within my project folder?
>>
>>54950107
>In a good outcome goods-producing robots and factories will be owned by large enough portion of population.

Subtly advocating socialism, I see. I'd prefer that everyone (myself included) starves to death before we debase ourselves with such a vile ideology.
>>
>>54950203
>>54950216
http://www.un.org/popin/icpd/conference/bkg/wppa.html
>>
>>54950017
>Python Java C# VB.Net

Aren't you the little fucking carcinogen? Jesus
>>
>>54950180

>maybe but even then you can't honestly think the population's just going to be allowed to idly sit at the same level with 90% people unemployed
Depends on what to count as "allowed". Yes, elites want us to be hardworking good goyim (so we don't revolt) while they live their comfortable ultra-rich lives. But what do I as a middle class citizen want?

>UN's already aiming for something like an 80% world population reduction by 2060.
Haven't seen such stats, [citation needed]
Official extrapolation was 11 billion @ 2100.

> i'd rather humanity be at 99% employment with everyone working their asses off but doing cool shit like colonizing mars and venus and expanding than just sitting on earth having robots make us dorito chips
I think that choice is a false one. It looks like a real choice is having people working mcjobs or having people live semi-comfortably from basic income. Basic income world looks happier than a mcjob one.

We have quite high employment now and people work mostly bullshit jobs.
>>
>>54950245
only one of those are worse than js
>>
>>54950230
It really is a vile ideology. To accept "post scarcity" socialism where no human labor is needed is to accept stagnation. You can always create more work where there are no factories built and develop/build products that man has yet to learn to manufacture. When a robot takes your job, you don't ask for a new job, you find a place for a new job.

>2016
>no fast food clerks ever
>you are now supervising the robotic colonization of mars and carrying out basic emergency repairs
>>
>>54950245

Whatever gets the job done. Those are languages that are either a) easy to create GUIs in or b) there is plenty of help and sample code available.

Granted, I haven't used VB.NET, but if it is anything like VB6, my grandmother could create a GUI program in it.

The guy is new, I'm not going to recommend something like C++.
>>
File: 1459566805282.jpg (33 KB, 640x640) Image search: [Google]
1459566805282.jpg
33 KB, 640x640
>>54950238
>1974
>>
>>54950248
the elites will not allow you to have 12 children when too many people doing that means they don't get their yacht. the less people they have to support is better for them
>>
Is programming a good career path? Is computer science a good degree choice?
>>
>>54950230
On the contrary, having widespread ownership of productive assets is quite capitalistic. Socialism would be society/state owning everything.

Current status quo is neither capitalism nor socialism, it's a kind of crony capitalism with strongly tied big corps and government.
>>
File: c44ch.png (128 KB, 505x864) Image search: [Google]
c44ch.png
128 KB, 505x864
>pic related

Android programming:

It's a form where an 'sales guy' can submit a car 4 sale.

How would I approach this?

First question:

Is it possible to do everything (sending the file to a folder on my server, inserting the path to my 'Car'-table in phpmyadmin, same with the details).

Is the following database structure ok?
- CarID
- CarBrand
- CarType
- CarFuel
- CarPrice
- ImagePath

?

In a later stage, I would have to show all the available cars in a layout for the viewers to see what cars are available for sale.

Thx
>>
>>54950320

Do you want to learn to program with a bunch of SJWs or do you want to learn to program and how that program works on the metal?

CS for the former, CE the latter
>>
>>54950320
>Is programming a good career path?
yes if you're not retarded

>Is computer science a good degree choice?
not really, having a degree helps when searching for a job but it doesn't have to be computer science and you still need to be mostly self-taught and be experienced to have a real chance of landing a good programming job
>>
>>54950350
>to do everything
*
... In one database insert query?
>>
>>54950320
>Is programming a good career path? Is computer science a good degree choice?
yes and yes, as long as you're not mediocre in either.
>>54950352
CS isn't about codemonkey shit it's about time complexity and k-means. SJWs only get as far as JS and Ruby cause they only care about the internet.
>>
>>54950284
>It really is a vile ideology. To accept "post scarcity" socialism where no human labor is needed is to accept stagnation

Funny how you talk about it while living in literally stagnating crony capitalist society. Even venture capitalists say this: https://medium.com/conversations-with-tyler/peter-thiel-on-the-future-of-innovation-77628a43c0dd

>PETER THIEL: Yes, I think there are, those three separate things. There’s the question of stagnation, which I think has been a story of stagnation in the world of atoms, not bits. I think we’ve had a lot of innovation in computers, information technology, Internet, mobile Internet in the world of bits. Not so much in the world of atoms, supersonic travel, space travel, new forms of energy, new forms of medicine, new medical devices, etc. It’s sort of been this two-track area of innovation.
>>
>>54950392
>time complexity and k-means
this is really basic stuff that you could learn on your own in the first weeks of programming
>>
>>54950330
>On the contrary, having widespread ownership of productive assets is quite capitalistic.

What you are describing is, more or less, communally owned means of production. This is socialism, or communism, or whatever you'd like to call it.
>>
>>54950284
Barring the existence of a soul, robots will eventually be more adept at everything, with less energy input needed. So what reason will there be for humans to exist?
>>
>>54950352
Well it's funny you say that. Whenever I look at computer science courses, like literally look at the people on them, they seem more like Chavs. Maybe this is how it is in Britain compared to the US. It looks more like the degree that people take because they know that compewturs are the future and they don't want to work in McDonald's like their 7 siblings. That's actually what's putting me off.
>>
>>54950284
>When a robot takes your job, you don't ask for a new job, you find a place for a new job.

When cars replaced horses, horse population declined (presumably, by starvation). Do you want for all unnecessary people to follow the same fate?

It is becoming harder and harder to contribute to society, the ratio of people that are able to do it is beginning to shrink.
>>
>>54950352
Looks like I'm doing CS :-)
>>
>>54950307
On the other hand:

1) More people = more tax paying slaves
2) More people = more raw material from which a tiny fraction of new elites can emerge via a fierce competition.

We are biological robots for them.
>>
>>54950411
what reason is there for humans to exist now?

you're not making sense
>>
>>54950403
You can learn anything on your own since kahn academy and wikipedia exist. Degrees usually breech deeply into those topics and having a bachelor's/master's in it is like a testament that you're knowledgeable in it. Might be archaic but just the way society is.

>>54950417
This is true, but a lot of those people get weeded out of the system before 3rd year, and they don't take up employment positions anyway since they can't do fizzbuzzes on the off chances that they somehow graduate.
>>
>>54950411
time to swallow the biggest redpill of them all
https://www.youtube.com/watch?v=FFWAQJDKcvs
global elite is going to exterminate humanity to pave way for artificial intelligence to be the new face of "humanity" just like out of that AI movie with the 6th sense kid, where the far future humans weren't humans at all
>>
>>54950485
>alex jones
>rich fuck who lives in a mansion
heh
>>
>>54950479
>Degrees usually breech deeply into those topics
>deeply
not really
>>
>>54950404
Communally owned means everybody and nobody owns a factory.

Having a big class of small property owners is different. Many families own land and houses (note that in many countries including US owning a house is politically and economically (via low mortgage rates) encouraged) . Why shouldn't they own productive robots?
>>
>>54950512
not an argument
>>
What about specific game dev courses? They seem like total novelty things.
>>
>>54946412
copypasta-worthy
>>
>>54950462
There should not be reason to exist. Let people live a happy life and that's it. If someone wants to party all her life - so be it. If someone wants to colonize mars - so be it.
Thread replies: 255
Thread images: 43

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.