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

/dpt/ Daily Programming thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 316
Thread images: 30

File: pair_programming.png (198KB, 640x480px) Image search: [Google]
pair_programming.png
198KB, 640x480px
This is /dpt/, the best subreddit of /g/

Pair programming edition.

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

/!\ ** Read this before asking questions ** /!\

http://mattgemmell.com/what-have-you-tried/
http://www.catb.org/~esr/faqs/smart-questions.html


What are you working on?
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>61143699
First Fortran C.
>>
>>61143699
Second for scheme
>>
File: whenyoumasteredlisp.webm (3MB, 1280x720px) Image search: [Google]
whenyoumasteredlisp.webm
3MB, 1280x720px
/dpt/-chan, daisuki~

>>61143764
>not racket

>>61143699
thank you for using an anime image

>>61143699
>What are you working on?
Exploring the darkest corners of Racket

>>61142472
>>61143756
i don't see any instruction decoding in your code. do you consider exit as an instruction?
>>
Pretend I'm an idiot and explain to me the difference between an expression and a statement in a way that I can understand.
>>
what would be the best way to point at files in a directory in python so i can manipulate them?
a dictionary?
>>
>>61143881

It's a statement if you put a semicolon on the end.
>>
>>61143876
Racket is a Scheme
>>
>>61143907
Use lists, all other containers are bloat
>>
>>61143925
idiomatic racket code doesn't look like your usual scheme code.

>>61143881
an expression is evaluated to return a result.
a statement is executed to produce an effect.
>>
>>61143946
All valid Scheme programs are valid Racket programs.
>>
>>61143876
>i don't see any instruction decoding in your code. do you consider exit as an instruction?
Yeah basically, the whole point is that the trivial bytecode VM has only two instructions, 0xff which means halt (represented by CRT exit function) and anything else is a nop. Obviously a real VM with stuff like variable-size instructions, separating the instruction word into bitfields for opcode, addressing mode, operands and so on would be much more complicated.

>>61143881
An expression has a value, a statement not necessarily. And some expressions can't be used as a statement, but only part of one.
printf()
is a statement (because it means something on its own) and also an expression because it does return a value.
goto hell
is a statement, but not an expression, because it has no value. 2+2 is an expression because it has value, but not a statement in a meaningful sense since it doesn't actually do anything unless assigned to something as part of a larger statement.
>>
>>61143978
wrong. racket lists are immutable.
>>
>>61143945
Use binary, all other languages are bloat.
>>
>>61144023
Use the nourishing song of the universe. All other languages are bloat.
>>
Go is a really comfy language.

It's like C and Java had a baby but C was sexually assaulted by Javascript around that time period so it's not known who the father really is but the baby is still cool.
>>
File: 1498123577136.jpg (262KB, 2000x2000px) Image search: [Google]
1498123577136.jpg
262KB, 2000x2000px
>>61143699
We are making a web browser! >>61078788

WEBSITE: https://retrotech.eu/netrunner/
IRC: #/g/netrunner channel on Rizon
Come and join >>>/g/ntr
>>
>>61144047
Sounds like an awful language when you put it that way
>>
>>61144044
Kindly show a valid Scheme program (R5RS) that is not a valid Racket program.
>>
Daily reminder that testing is for code monkeys.
Axiom array : Type -> Type.
Check array.

Axiom length : forall T : Type, array T -> nat.
Check length.
Arguments length {_} _.

Axiom nth :
forall (T : Type) (i : nat) (a : array T), i < length a -> T.
Check nth.
Arguments nth {_ _} _ _.

Axiom mk_array :
forall (T : Type) (n : nat), (forall i : nat, i < n -> T) -> array T.
Check mk_array.
Arguments mk_array {_ _} _.

Axiom mk_array_length :
forall (T : Type) (n : nat) (f : forall i : nat, i < n -> T),
length (mk_array f) = n.
Check mk_array_length.
Arguments mk_array_length {_ _} _.

Lemma trivial1 :
forall (T : Type) (n : nat) (i : nat)
(f : forall i : nat, i < n -> T),
i < n -> i < length (mk_array f).
(intros T n i f H1).
(assert (length (mk_array f) = n)).
(apply mk_array_length).
(rewrite H).
(apply H1).
Qed.
Check trivial1.
Arguments trivial1 {_ _ _} _ _.

Axiom mk_array_nth :
forall (T : Type) (n : nat) (f : forall i : nat, i < n -> T)
(i : nat) (Hi : i < n),
let Hmk : i < length (mk_array f) := trivial1 f Hi in
nth (mk_array f) Hmk = f i Hi.
Check mk_array_nth.

Definition duplicate : forall (T : Type), array T -> array T :=
fun T a => mk_array (fun i Hin => nth a Hin).
Check duplicate.
Arguments duplicate {_} _.

Theorem dup_has_same_length :
forall (T : Type) (a : array T), length (duplicate a) = length a.
(intros T a).
(unfold duplicate).
(apply mk_array_length).
Qed.
Check dup_has_same_length.
Arguments dup_has_same_length {_} _.

Lemma trivial2 :
forall (T : Type) (i : nat) (a : array T),
i < length a -> i < length (duplicate a).
(intros T i a H1).
(apply eq_ind with (x := length a)).
auto.
symmetry.
(apply dup_has_same_length).
Qed.
Check trivial2.
Arguments trivial2 {_ _} _ _.

Theorem dup_is_same :
forall (T : Type) (a : array T) (i : nat) (Ha : i < length a),
let Hda : i < length (duplicate a) := trivial2 a Ha in
nth a Ha = nth (duplicate a) Hda.
>>
>>61144002
>goto hell is a statement, but not an expression, because it has no value

hell is a label, it has a value equal to some memory address or offset
>>
File: camera.jpg (134KB, 496x496px) Image search: [Google]
camera.jpg
134KB, 496x496px
>>61144052

>Not written in Go
>>
>>61144099
>reading comprehension

>>61144107
eww
>>
>>61144085
But i dont need theorems with idris
>>
>>61144119

Why would you not like a language with C performance but without the autism so you can actually enjoy using it
>>
while Q is not empty:
u ← vertex in Q with min dist[u] // Node with the least distance will be selected first
remove u from Q

In this pseudocode , how would you find the
min_dist[u]
without a costly min() or sort() function?
>>
File: japanimebymichaelbay.webm (3MB, 864x480px) Image search: [Google]
japanimebymichaelbay.webm
3MB, 864x480px
>>61144082
(define a (1 . 5))
(set-car! a 5)
(display a)


>>61144002
that's the least efficient technique for instruction decoding.

from least to most efficient

1 conditional jump (your)
2 jump table
3 pre-decoding
>>
I'm a stupid namefag and I should kill myself
>>
>>61144128
>theorems
Those are just programs.
>>
File: 3kL3N1x.png (603KB, 630x630px) Image search: [Google]
3kL3N1x.png
603KB, 630x630px
>golang

https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e
http://qr.ae/drvVS
http://qr.ae/drvm8
http://yager.io/programming/go.html
http://nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
http://java.dzone.com/news/i-don%E2%80%99t-much-get-go
http://dtrace.org/blogs/wesolows/2014/12/29/golang-is-trash/
http://www.lessonsoffailure.com/software/google-go-not-getting-us-anywhere/
http://www.lessonsoffailure.com/software/googles-go-not-getting-us-anywhere-part-2/
http://www.lessonsoffailure.com/software/google-go-good-for-nothing/
https://gist.github.com/kachayev/21e7fe149bc5ae0bd878
>>
>>61144135
What language are you talking about? Surely not Go.
>>
How can I make money off of programming without ever having to leave my neetcave to go to college with others or attend job interviews and eventually become employed and work alongside others?
How do I make money with programming by myself independently? Options like crypto trade bots for example and other jewery
>>
>>61144128
This post barely makes any sense.
>>
>>61144202

Oh yeah those are a bunch of trustworthy sites we all recognise by name alone
>>
>>61144099
hell is an expression, but
goto hell
is not. Goto is in the very abstract sense, a "function" that takes an expression (label) as input, but has no return value; like a call to a void function, it isn't an expression, because it doesn't give you a result you can do anything with.
>>
>>61144210
>go to college
Is it possible to get a non-webdev job without a degree nowadays, when CD grads are a diamond dozen?
>>
File: pooinloo4.jpg (51KB, 980x158px) Image search: [Google]
pooinloo4.jpg
51KB, 980x158px
I thought it was only a meme
>>
File: 1442047946905.png (285KB, 1200x1200px) Image search: [Google]
1442047946905.png
285KB, 1200x1200px
>Linus indents 8 spaces
>Stallman indents 2 spaces

Is Linus compensating for something?
>>
>>61144229
I opened one up and it had a detailed example of Go's deficiencies. This served to reassure my dislike of Go.
>>
>>61144274
linus doesn't know how to change the defaults
>>
>>61144159
Good point, however in a real bytecode VM the instruction decoding wouldn't be the only overhead; if the VM instructions are more complex than machine instructions (which they often are) then they'd have to be implemented by functions each of which amounts to at least several instructions by itself.
>>
when will python get the break all statement?
>>
>>61144274
8 spaces is standard.
>>
File: 1484252280462594039.jpg (597KB, 2200x2200px) Image search: [Google]
1484252280462594039.jpg
597KB, 2200x2200px
best tutorial/online course to learn Python (and programming in general)?
>>
>>61144274
The only sane indentation is 4 spaces.
>>
>>61144316
https://learnxinyminutes.com/
>>
>>61144278

Comparing it to python and saying "omg it doesn't support <meme feature> so therefore it sucks" ignoring the fact that it's supposed to be a simple C like language
>>
>>61144299
A what?
>>
#include <iostream>
struct S {
// three-bit unsigned field,
// allowed values are 0...7
unsigned int b : 3;
};
int main()
{
S s = {7};
++s.b; // unsigned overflow (guaranteed wrap-around)
std::cout << s.b << '\n'; // output: 0
}


#include <iostream>
struct S {
// will usually occupy 2 bytes:
// 3 bits: value of b1
// 5 bits: unused
// 6 bits: value of b2
// 2 bits: value of b3
unsigned char b1 : 3;
unsigned char :0; // start a new byte
unsigned char b2 : 6;
unsigned char b3 : 2;
};
int main()
{
std::cout << sizeof(S) << '\n'; // usually prints 2
}


C++ > rust
>>
>>61144304
So are Windows and JavaScript, that doesn't mean they're good.
>>
File: futo_ahegao.png (148KB, 675x351px) Image search: [Google]
futo_ahegao.png
148KB, 675x351px
>>61144274
>Linus indents 8 spaces
Don't forget to also komment your kode!
>>
>>61144230
>a "function" that takes an expression (label) as input, but has no return value; like a call to a void function,

functions are a mathematical concept that has not counterpart in programming.
a function takes an argument, is declarative, and does return a value.

seriously, you shall stop referring to c for explaining computer science or mathematical concepts.

expressions based computation: lambda calculus
statement based computation: turing machine
>>
>>61144341
>Windows
>standard
lol
>>
>>61144327
No, it compared to Rust and Haskell and the inability to write generic functions in Go. And then it goes on, literally a page of thorough examinations of the utter spew Go is.
>>
>>61144338
So now show the Rust equivalent.
>>
>>61144319
Research shows that 3 spaces is ideal, but programmers have a natural aversion to non-powers-of-two
>>
>>61144341
It's a unix standard, so it is good.
>>
>>61144350
>functions are a mathematical concept that has not counterpart in programming.
I meant "function" in thte C sense - i.e. a construct that takes 0 or more arguments, and may return values or have side effects. Mathematical functions are expressions and not statements, since they have no side-effects there is no point in "calling" one without assigning its value to something.
>>
>>61144406
What is ``unix"?
>>
is "virtual" in c++ the same thing as "abstract" in java?
>>
File: Program_LEarn.png (47KB, 1595x940px) Image search: [Google]
Program_LEarn.png
47KB, 1595x940px
What languages should I add or remove from this list. I'd like to cut it down/grey out some until later. I'm for sure learning c/c++ right now using "Programming Principles and Practices Using C++ 2nd Edition" by Bjarne Stroustrup. I'm also using other resources and learning mathematics as I go along but I'd like to learn 2-3 other languages along with C++ that I can use as a good foil to gain a greater grasp of the concepts that I'm learning with C++. I've used C# for about two years and want to gain a greater grasp of the fundamentals of programming/mathematics/computation. I'm not trying to get a job programming right now, I don't really know if I'd want one in the future, but I'm just genuinely interested in communicating with computers and making them do shit. I've also thought about getting some lego robotics stuff to learn some embedded/robotics programming but I've reserved that for later on in life when I have more space and free time. Sorry if this is a dumb question, or a vague question with lots of opinionated answers. Pic related is what I've set up from asking this question phrased differently before and from looking at the /g/ wiki as well as looking at the programming book repository as well as just looking at wikipedia, youtube videos etc.
>>
>>61144483
remove none
add lua
>>
Does anyone have any good references to sql server query plans and how to compare them?
>>
>>61144483

Remove Python
Remove Haskell
Remove Java
Remove Scheme
Remove Idris
Remove Javascript

Add OCaml
Add Haxe

Final List: C/C++/Haxe/OCaml/Bash and love :)
>>
In my programming class I'm supposed to implement a linear sort and binary search, everything has gone fine except the linear sort part I've been stuck on for days.

On an array of any size greater than 500, the last 5-10% of the elements after the linear sort algorithm are all identical, and sometimes the command line in the IDE scrolls irregularly or freezes and I have to clear the buffer or kill the program. Is my computer just too old and too weak to process an inefficient algorithm on progressively larger lists without hitting some kind of limit in the IDE?
>>
>>61144475

Not quite.
virtual means the method can be overridden. This happens by default for all Java instance methods and doesn't need to be marked, but you need to explicitly ask for it in C++.
class Base
{
virtual void sayHello() { std::cout << "Hello from Base!" << std::endl;}
}

class Derived : Base
{
void sayHello() override { std::cout << "Hello from Derived!" << std::endl; }
}

int main()
{
Derived d;
Base *b = &d;
b->sayHello(); // Hello from Derived
}
class


C++ does not have abstract functions. It has pure virtual functions, which are the same thing.
class Base
{
virtual void sayHello() = 0; // Pure virtual function.
}

class Derived : Base
{
void sayHello() override { std::cout << "Hello from Derived!" << std::endl; }
}

int main()
{
Derived d;
// Base b;
// Cannot construct a Base because sayHello is abstract.
}
class
>>
Check out my fizzbuzz
from itertools import count, cycle, islice
from operator import add

def fizzbuzz():
f = ["", "", "Fizz"]
b = ["", "", "", "", "Buzz"]
it = zip(map(add, cycle(f), cycle(b)), count(1))
yield from (s or str(n) for s, n in it)

print(*islice(fizzbuzz(), 100), sep='\n')
>>
>>61144603
so the methods are virtual but you don't have "virtual class"?
>>
#include <cmath>

#include <iostream>
#include <sstream>
#include <stack>

static double pop (std::stack<double> &s) {
if (s.size () == 0) {
throw "empty stack";
}
double x (s.top ());
s.pop ();
return x;
}

static double add (double x, double y) {
return x + y;
}

static double mult (double x, double y) {
return x * y;
}

static double sub (double x, double y) {
return x - y;
}

static double div (double x, double y) {
return x / y;
}

static double (*getop (const std::string &word)) (double, double) {
if (word == "+") {
return add;
} else if (word == "*") {
return mult;
} else if (word == "-") {
return sub;
} else if (word == "/") {
return div;
} else if (word == "**") {
return pow;
} else {
return NULL;
}
}

void parseword (std::stack<double> &s, const std::string &word) {
double (*op) (double, double) (getop (word));
if (op != NULL) {
double y (pop (s));
double x (pop (s));
s.push (op (x, y));
return;
}
std::istringstream iss (word);
double x;
iss >> x;
if (iss.fail () || !iss.eof ()) {
std::string message ("unknown word: ");
message += word;
throw message;
}
s.push (x);
}

void mainloop (int argc, const char *const *argv) {
std::stack<double> s;
for (size_t i (1); i < (size_t) argc; i++) {
parseword (s, argv[i]);
}
double x (pop (s));
std::cout << x << std::endl;
}

int main (int argc, const char *const *argv) {
try {
mainloop (argc, argv);
return 0;
} catch (const char *msg) {
std::cerr << "# error: " << msg << std::endl;
return 1;
} catch (const std::string &msg) {
std::cerr << "# error: " << msg << std::endl;
return 1;
} catch (...) {
std::cerr << "# unknown error" << std::endl;
return 2;
}
}
>>
>>61144259
Haha wow really anon? You're lucky then. I've had to deal with Indians a lot. They're smelly (no meme, it's the first you notice, poor hygiene I suspect), intentionally deceptive, have very low work ethic and terrible at their job when they actually do it.

Just last week I had to re-write a piece of code to program a SOM via a serial port because pajeet sent 1 byte at a time over the line. Making the process take 18hours. I should have checked his code before hand. After I batched the write()s it took 30s. And I found a case where he didn't parse the hex file right. Luckily it wasn't applicable for the hex file I had to use.

They're a terrible time sink and I keep telling the boss about these instances. He just thinks they need code review and he leaves it for them to review themselves. Doesn't work obviously. They don't even use subversion as instructed and breaking version numbers is the norm.

Avoid Indians at all cost.
>>
File: page.png (33KB, 984x966px) Image search: [Google]
page.png
33KB, 984x966px
>>61144563
I'd like to be able to make a website/server and actually use it. I want to be able to make multiplayer games and have them function properly even if its just for meme hobbyist projects. I'd like to be able to understand networking for both my own home by being able to network and securely set up devices as well as be able to host and build web/server applications that I can actually use for personal usage. I just added your suggestions and I'm going to try and read through and filter them later using the information gathered. Thank you for your responses. I assumed Javascript/HTML5/CSS was just the way web pages were built? I also think SQL is the primary interface to access databases? I don't know I've never really built a webpage or a database before.

I assume I'm going to have to tackle all of those things separately as different learning activities/projects.
>>
>>61144677

No.
Though, the second example *is* an abstract class.
>>
>>61144563
>haxe
Isn't that some scripting language for flash or something?
>>
>>61144784

> I assumed Javascript/HTML5/CSS was just the way web pages were built?

Haxe can transpile to JS, so no problem here.
You can also use the Wt Toolkit (C++), so no problem here.
HTML/CSS is necessary, but i'm talking about programming languages anyway.

> I also think SQL is the primary interface to access databases?

Yes.
>>
Would you recommend sololearn To learn coding
>>
>>61144819

ActionScript 3
C++
C#
Flash
HashLink
Java
JavaScript
Lua
NekoVM
PHP
Python 3
>>
File: image001.jpg (236KB, 1624x626px) Image search: [Google]
image001.jpg
236KB, 1624x626px
>syntax doesn't matter
APL isn't as ugly as sepples but I think it's fair to say you would not program in APL because of the syntax.
>>
>>61144900
It's not pretty. But I'd do apl over c++.
At least you can look at code and actually see what it's doing without knowing every other piece of code like in C++.
>>
>>61144253
Does this actually work? Does it have mod2^3 behavior? I didn't know C could do that. C is so high level it's crazy.
>>
Is there any language really worth looking at when I know a few (C, C++, C#, Java, Python, JS) and am productive in them?
>>
>>61145096
Yes, OCaml.
>>
>>61145119
Can you please elaborate why is it worthwhile?
>>
best source to learn Python as a first language and to learn programming in general?
please help, desu
>>
File: Screencast_2017-06-30_00_40_34.webm (3MB, 1920x1080px) Image search: [Google]
Screencast_2017-06-30_00_40_34.webm
3MB, 1920x1080px
I'm not a good programmer. In fact, this is one of my first "projects" ever. What's a fun tiling algorithm for tiling windows? I'm trying to create a tiling script of KDE. At the moment I'm just splitting Windows but it's troublesome if I close the biggest window and leave the smaller ones.

Also, my carpal tunnel is getting real fucking bad, what do?
>>
>>61145144
Fast and safe.
>>
>>61144386
the rust """"""""equivalent"""""""" would be exceedingly verbose
>>
>>61145242
And I forgot, one of the easiest language to use.
>>
>>61145233
>Also, my carpal tunnel is getting real fucking bad, what do?
get a real keyboard and learn to touch type properly

https://www.aliexpress.com/item/Tada68-Mechanical-keyboard-gateron-swtich-65-layout-Dye-sub-keycaps-cherry-profils-enjoypbt-keycap-cherry-profile/32807055607.html
>>
Where can I learn more about C tooling? Stuff like advanced compiler options, debugging, unit testing, makefiles, etc... C books don't really cover that king of thing.
>>
I am trying to call a function from another file in C++, but it doesn't work.
I just get the error: 'aaa' was not declared in this scope.
Why doesn't this work? How do I bring the function into scope?
Here are the files.

main file:
#include <functions.h>

main()
{
aaa();
}


functions.cpp:
#include <functions.h>
#include <iostream>

void aaa() {
std::cout << "aaa" << std::endl;
}


functions.h:
void aaa();


pls help.
>>
>>61145421

You're using <> which indicates an installed library include, rather than """ which indicates an included in your project directory.
>>
>>61145455
I changed <functions.h> it to "functions.h" in both files, but the error still persists.
>>
>>61145421
do something with your makefile
>>
>>61145528
problem is, I don't know what to do with it.
anyway here it is. I'd be glad if someone could help.
CC := g++
SRCDIR := src
BUILDDIR := build
TARGETDIR := bin

EXECUTABLE := main
TARGET := $(TARGETDIR)/$(EXECUTABLE)

# create a list of code-files
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))

CFLAGS := -c
INC := -I include

$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@echo "Compiling $<...";
$(CC) -c -o $@ $< $(INC)

$(TARGET): $(OBJECTS)
@mkdir -p $(TARGETDIR);
@echo " Linking $(TARGET)";
$(CC) $^ -c -o $(TARGET) $(INC)
>>
>>61145497
is functions.h added to your project?
>>
>>61145617
I think so.
At least the compiler doesn't complain.
>>
>>61145583
That's a little too much for compiling two files.

 $ g++ -I. -o prog main.cpp functions.cpp


If you understand that command, you should be able to simplify the makefile and also understand why it didn't work in the first place (tip: #include <header_in_include_dir> vs. #include "header_which_is_not").
>>
>>61145157
a-anyone?
>>
>>61145689
>>61145617
>>61145455
>>61145528
thanks for the help.
The mistake was trivial. I changed the function name in the wrong file...

>>61145689
with
$ g++ -I ../include -o prog main.cpp functions.cpp
everything compiles now.
I just need to figure out why the fuck the make file in >>61145583 doesn't want to link.
>>
Let's say I have an Erlang/Elixir application. I want to make a nice GUI frontend so the user can access and control this headless Erlang/Elixir application. That should be possible, right? Can anyone point me in the direction for finding info on how to get two separate applications running on the same PC to communicate with one another?
>>
>>61145837
Go to university.
just kidding.
Grab some recommended book and read and work through absolutely everything.
Don't skip parts that are too difficult.
>>
>>61145861
>I just need to figure out why the fuck the make file in >>61145583 (You) doesn't want to link.
Figured it out. had to change
 $(CC) $^ -c -o $(TARGET) $(INC) 

to
 $(CC) $^ -o $(TARGET)

which makes sense I guess.
>>
>>61145920
Any idea what the caret macro is?
>>
>>61146065
$^ refers to all the dependencies of the current target.
>>
I think I've invented a new type of list but obviously once I've made it I'll discover some guy made it in 1948 before computers were really a thing just to really activate my almonds.
>>
Daily Python General, hehe
>>
>>61146180
Pray tell, you may get an answer to your worries quicker and move on to something else.
>>
I have an array of structs in C holding two strings and one double, 'result'. How can I sort the array so the struct go in decreasing order of 'result'?
>>
>>61146280
Use qsort.
>>
>>61146280
https://en.wikipedia.org/wiki/Heapsort
>>
How can I read the contents of the specific C header file that gets included when I use the #include <> directive in my development environment?

I know you can just google the name, but I don't know if there's versioning issues or anything with that.
>>
>>61146290
>>61146292
Oh shit I had no idea there was a standard library function to do this.

Thanks anons
>>
>>61146280
That depends.
Are you okay with it being slow? qsort
Want it to go fast? Switch to C++ and use std::sort.
>>
>>61146364
Absolute worst possible case is ~10000 arrays of structs, with each array having ~1000 structs. So 10 million comparisons I guess.

A few seconds run-time should be okay I think
>>
>>61146364
(You)
>>
>>61146364
>>61146403
was i just memed
>>
>>61146322
Well the header file is an actual file on your computer, on Unix-like operating systems I think there's a special "include" system folder that all C/C++ compilers use, on Windows there's usually a bunch of them somewhere under the compiler's directory.
>>
I've written C, C++, C#, ASP, Java, Scala, Objective-C, Swift, Python, Ruby, Haskell, Clojure, Common Lisp, Lua, JavaScript, TypeScript, Ada, OCaml, Prolog, x86 assembly, Smalltalk, Modula-3, Pascal, BASIC, and PHP professionally. I've taken part in Agile, XP, Scrum, Kanban, reactive, user stories, all the other buzzwords. I've used SQL, noSQL, XML, JSON, YAML, ASN.1, protobuf, and many other fads.

I have come to the conclusion that all software engineering is bullshit. There are no good languages, no good methodologies, no best practices, no solutions. Every new approach, library, framework etc. that comes out is just snake oil. It won't help.
>>
>>61146403
In practicality, it is actually true, though.

>>61146414
No.
Salty Cfags just don't want to admit that their language is inferior.
>>
>>61146430
C is fine if macros don't trigger you.
>>
File: 1498699758916.png (81KB, 512x288px) Image search: [Google]
1498699758916.png
81KB, 512x288px
>>61146430
Ok, you picked one of the very rare examples where the C++ standard libraries is faster than the C standard library.
There is nothing stopping you from implementing your own sorting function.
Also, C++ is still much slower in general.
>>
>>61146447
Of course they don't, I've used C plenty.
But,
>C fags have to use macros to get around their shitty languages performance issues.
C++ does not have this issue. It performs well by default.
>>
>>61146462
Macros are fine, just ask any Lisp user.
>>
How do I into getting money with whats it called "mining"?
I want an easy, simple way.
>>
File: der ewige C.jpg (78KB, 387x550px) Image search: [Google]
der ewige C.jpg
78KB, 387x550px
>>61146447
>when your standard library is so slow you have to replace it with handrolled macros
>>
>>61146462
Macros enhance expressiveness, not performance.

>>61146478
Lisp macros are a completely different animal from C/assembly macros.
>>
>>61146485
Macros have nothing to do with the CRT being "too slow". They're to handle compile-time logic.
>>
>>61146482
fuck wrong general
>>
DON'T WASTE YOUR TIME ON LISP OR SCHEME
IT'S NOT GONNA FLY
LEARN RUST OR GO OR PYTHON today IF YOU REALLY WANT A JOB TOMORROW
>>
>>61146485
>referencing qsort
Anon we've established this. Under the same circumstances that is no inlining because the code is being dynamically linked no other language would perform better (aside from JIT languages potentially).
>>
File: pug.jpg (246KB, 400x800px) Image search: [Google]
pug.jpg
246KB, 400x800px
>61146612
>LEARN RUST OR GO OR PYTHON today IF YOU REALLY WANT A JOB TOMORROW
>rust
>any job
>>
>>61146696
ToMoRrOw
>>
Why are AVX2 gather instructions so fucking slow? And why did they wait until the next iteration of AVX to include a scatter counterpart?
>>
Lmao this is illegal in Lisp
(with-open-file (urandom "/dev/urandom" :direction :input)
(princ (read-byte urandom)))
>>
>>61144008
>racket lists are immutable
lmaooo
>>
>>61146180
What type of list?
>>
I want to make a little program that crawls a site and downloads images. What libraries in python are suited for this? I want to start with a simple script, and later to build it up to a small gui app that crawls something like tumblr for example.
>>
please rate my hello world program, wrote it for my intro to systems programming class

#include <stdio.h>
#define fuck int
#define you main(){
#define mate printf(
#define suck "hello world!\n"
#define a )
#define nigger ;
#define dick }

fuck you mate suck a nigger dick
>>
>>61147077
nigga just use your brain
>>
>>61147077
beautifulsoup or urllib2

also, learn to STFW
>>
>>61147106
Thanks! I've played a bit in Scrapy, but it seems like an overkill for my purposes.
>>
>>61147088
would this even compile?
>>
>>61143699
Does pair programming always include hugging your partner?
>>
say I'm testing printing all of the coincidences of a binary search of an array (in this case, user input "numero") by use of an ArrayList.

Current code first does a bubble sort on the main array, and then searches from right to left for a match. Then I'm trying for it to look back for more matches while adding them to an ArrayList, stopping when there's no more. Then the method returns the ArrayList for the main method to print it.

I need a hand on seeing what I'm doing wrong here, since it seems there's an endless loop at the point where it finds the first coincidence.

   public static ArrayList search(int[] array, int numero) {
int start = 0;
int end = array.length - 1;
int center;
ArrayList aux = new ArrayList();
while (start <= end) {
center = (start + end) / 2;
if (array[center] == numero) {
aux.add(center);
while(array[center] == numero){
if(array[center -1 ] == numero);
array[center] = array [center - 1];
aux.add(center);
}
} else if (array[center] < numero) {
start = center + 1;
} else {
end = center - 1;
}
}
return aux;
}
}
>>
>>61147198
don't mind the if statement inside the second while, I accidentally copied an old iteration of the code
>>
>>61147151
Yes
>>
File: it_compiles.webm (1MB, 1920x1080px) Image search: [Google]
it_compiles.webm
1MB, 1920x1080px
>>61147151
check it cuckboi

sorry it took so long, had to transcode from mp4 to webm which requires 4000 man-hours of labor if done by hand
>>
>>61147272
damn thanks. didn't know it can do that
>>
File: 1458045642472.jpg (149KB, 714x568px) Image search: [Google]
1458045642472.jpg
149KB, 714x568px
>>61147272
>>
>>61147272
which DE is that?
>>
>>61147389
i3 with extensive configuration
>>
Interviewed for a junior dev position today, saw three people. The first two were okay, basic stuff like fizzbuzz, sorting algorithms, and data structures, I got on well with them and I don't think I made any mistakes, but the third guy was a complete asshole.

He started by asking me to write something in Haskell when I haven't used it since my first semester in college, he then told me I shouldn't put it on my resume if I can't use it. Next he asked me to solve a geometry problem, I haven't done math since high school so I couldn't answer that one either.

Finally he asked me something in Java, I asked if I could do it in Python instead (I could have done it in Java but Python's a better language), he looked at me in a weird way for a moment so I told him that it's always better to quickly prototype things in a high-level language first. Anyway I did it and he kept being really petty about pointing out corner cases my code wouldn't work for, even though it was only a prototype and unit testing would catch those things. It was kind of obvious he was just singling me out because I showed initiative and didn't use Java. After that he asked if I had any questions and thanked me for my time.

Thanks for reading my blog. My question is: how common are people like that in software engineering? I haven't heard back from the company yet but I already know I don't want to work in that guy's team.
>>
>>61147411
about as common as people in the general population

just ignore with them or fuck with them if you're in the mood
>>
>>61144202
>Fundamentally, it’s apparent that gccgo was always the right answer. The amount of duplication of effort in the toolchain is staggering. Instead of creating (or borrowing from Plan9) an “assembly language” with its own assembler, “C” compiler (but it’s not really C), and an entire “linker” (that’s not really a linker nor a link-editor but does a bunch of other stuff), it would have been much better to simply reuse what already exists. While that would have been true anyway, a look at the quality of the code involved makes it even clearer. For example, the “linker” is extremely crude and is incapable of handling many common link-editing tasks such as mapfile processing, .dynamic manipulation, and even in some cases simply linking archive libraries containing objects with undefined external references. There’s no great shame in that if it’s 1980 and we don’t already have full-featured, fairly well debugged link-editors, but we do. Use them.
>implying
>>
If you're software rendering a 3D game like they did back in the 90s, how would you get that onto your monitor? Can you even write directly to VRAM these days? I'm guessing you can probably go through a graphics API like OpenGL, but that would kind of defeat the purpose.

Asking for a friend.
>>
>>61147624
Depends on which operating system you're talking about.
>>
>>61147624
I think you can directly write to the framebuffer on Linux which gets displayed through OS magic. Don't know about Windows.
>>
What's the point of virtualenvwrapper bloat when you can use this. Symlink it in to the project dir and call it as an argument to `source`

#!/bin/sh
venvpath="$HOME/.virtualenvs/"
project=`basename $(pwd)`
activate="/bin/activate"

source $venvpath$project$activate
>>
>>61147633
Windows, mostly.
>>
>>61147624
You can't actually write to the frame buffer directly on modern GPUs it's just not in the pipeline to do that.
The best approximation would be to write your own driver that sends commands that approximates it.

On Linux you can write to fb0 but it's a virtualized system. Not actually writing data to the frame buffer.

You're sol really.
>>
>>61147166
Only on dpt
>>
>>61147166
>tfw no qt haskell gf to cuddle with while we pair program and fix compiler errors
>>
What's the name of that lightweight C/C++ editor that had a magic lamp as a logo?
>>
>>61147849
You might be thinking of Geany, which is a text editor and multi-language IDE.
>>
>>61144159
what fucking anime is that
>>
>>61144159
>(define a (1 . 5))
This is not a valid Scheme program (R5RS)
>>
>>61147863
That's it!
>>
>>61147863
Can Geany compile C++? It lists a few languages, including C, but also claims there's other languages it can compile.
>>
>>61144002
Why not have 0x00 as exit? Any invalid program will fail early.

In my own programming language I wrote a basic interpreter with built-in native calling conventions and system calls capability. Then I wrote a simple JIT in the language itself.
>>
>>61147901
I'm glad!
>>61147921
Beats me, I don't actually have it. I just use gedit and make.
>>
>>61147869
pretty sure that's wings of honneamise
>>
who /piss bottle/ here?
>>
>>61147964
I did this when I was going to college out of state.
I don't know what brought it on but at some point I just stopped doing my laundry, decided I couldn't go to class because I smelled too bad, and didn't leave my room for a week, over the course of which I did nothing every day but lie in bed crying, ate nothing but peanut butter out of the fucking jar, and pissed in empty water bottles.
They sent the RA after me and she kicked my fucking door down and made me go eat something and they found the piss bottles and a serrated knife so I got the boot and got referred to a psych on the way out.
>>
>>61148041
You're pathetic.
>>
>>61148067
You don't have to remind me.
>>
>cdr? I barely even knew 'er!
Currently working on SICP but also (and more importantly) making this pun work
>>
>>61148041
well on the bright side you might qualify for autism bux
>>
>>61147624
Can't you make a big ass OpenGL texture out of your CPU-rendered graphics and then push that to the GPU?
>>
>>61148293
You can but that'd be windowed.
It'd be more wise to write to fb0 on Linux then. Or hijack the desktop window (yes window desktop is just a hierarchy of windows) and take over their rendering context and just draw in there.

I'm not sure anon was intending to just make it seem like he's modifying the frame buffer though. Given that he's talking about how the gpu memory isn't accessible.
>>
>>61148293
Encoding the pixel data into a full fledged texture format would probably add a lot of latency. There's probably a faster way of doing it with just raw buffers.
>>
>>61148041
get some therapy, some motivation and clean yourself up anon. find an interesting problem and get to work
>>
>>61147800
How does a BIOS display anything then? There must be some kind of VGA emulation or something, although I wouldn't be surprised if it's restricted at the OS level.
>>
>>61148454
>how does bios do it
I don't have a clue but if you're programming from within the OS you're unlikely to conveniently find a way to deal with these things.

I'm sure you can escape a protective OS somehow but writing your own driver is probably the easiest way to actually do it. As mentioned.
>>
File: kaguya_?_NEET.png (234KB, 620x640px) Image search: [Google]
kaguya_?_NEET.png
234KB, 620x640px
what the fuck is even a coroutine someone help me
>>
>>61148585
A lazy function for parallelism.
>>
>>61148585
>Coroutines are computer program components that generalize subroutines for non-preemptive multitasking, by allowing multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks, exceptions, event loops, iterators, infinite lists and pipes.
>>
File: what_is_a_coroutine.png (28KB, 796x341px) Image search: [Google]
what_is_a_coroutine.png
28KB, 796x341px
>>61148585
I got you, bro
>>
>>61148639
wat
>>
>>61148637
>>61148639
Google's probably already reported you idiots for searching that shit

Enjoy getting v&
>>
>>61148621
This desu.
They're never the best option. If you want parallelism for performance reasons (the common case) don't bother with it.
>>
>>61148668
For searching coroutine?
>>
>what are you working on?

Final Fantasy Tatics AI.
>>
What datastructures or algorithms are absolutely terrible but are still used a lot?
>>
>>61148746
Linked list
>>
>>61148716
Without a government issued programmers license.
>>
>>61148746
Linked lists. Btrees. Stacks and queues are generally used poorly but they're not bad on their own. Maps are used too much (but they're very convenient).
>>
>>61148750
Scala linked lists have better performance than vectors for many tasks.
>>
/dpt/, /dpt/, what do you think of my programming practices?
repdict = {"#@,":"print('foo')","#@[]foobius":"y = 5\nx = y+2\nprint(x)","#@what do i do?":"print('i do what i want, i do what i want!')"}
thisfile = open(__file__,'r',encoding = 'utf-8')
fstr = thisfile.read()
thisfile.close()
for r in repdict:
fstr = fstr.replace(r,repdict[r])
fsplit = fstr.split("\n")
fsplit = fsplit[(fsplit.index("raise SystemExit")+1)::]
fstr = "\n".join(fsplit)
exec(fstr)
raise SystemExit
#@,
#@[]foobius
#@what do i do?
>>
is a text stream in C the same thing as a string? or is there any context i'm missing?
>>
>>61148901
What is a text stream in C?
>>
>>61148939
char array
>>
Is this a good talk?

https://www.youtube.com/watch?v=7xSfLPD6tiQ&list
>>
If I'm an idiot who is learning code because I find it fun, and I have the basic grasp of python down should I learn c, c++, or c#?
>>
>>61148972
Why do you want to learn one of them?
>>
>>61148901
no because it isn't a valid string without a null terminator. sometimes depending on what you do you need to manually add it to the end.
>>
>>61148980
My minor was in linguistics, and I simply learn /study programming like it's a foreign language (which it sort of is) which I find enjoyable.

Also it's a buzzwordy resume enhancer.
>>
>>61148901
i think you're missing context in the phrasing of your question more than anything else, but...
aside from being probably completely different data structure types, i guess the most obvious difference would probably lie in the fact that a string's data is associated only with the byte string the compiler is designed to interpret the written code as, while the data in a stream can have a specified encoding/interpretation(if i recall correctly).
speaking in struct terms a stream would probably be more like an iterable data structure that contains information on how to interpret its data structure as well as other things, whereas a string may be a struct containing a pointer to a byte string and/or the byte string itself.
also, regrettably c strings(to my knowledge) contain no data on where they end aside from the null byte at the end of the string, so certain iteration practices on them aren't really recommendable. i don't know if that's a problem with text streams but i doubt it.
>>
>>61149032
But why C, C++, or C#?
>>
>>61148956

>>61149038
here,
i wrote my answer assuming by "text stream" you meant something more like a C nearest-equivalent of C++'s stringstream. seems like i was wrong.
>>
>>61148819
Then Scala vectors are trash
>>
>>61149038
damn.. i'm trying to learn C from The C Programming Language 2e, and everything was going great until page 15 when introduce character IO. I have read the section at least 6 or 7 times, but I guess I don't know enough about how a computer works under the hood to know what is going on. I have experience programming in Java, but my knowledge of computers in general is lacking; I know C was designed to be portable but the Unix OS is sort of like its native habitat to my understanding. I only really every used Windows, and don't know much about other OS's or anything like that.

Know of a source to catch me up? I have a terrible tendency to fixate on things I can't unravel, and it really keeps me from advancing.
>>
>>61149032
Programming is not like a language.
It's more like talking about highly structured and specific things.
Sorry that you are wrong.
If you want to learn something for real, then learn math.
>>
>>61149107
>Programming is not like a language
That's not entirely true.
>>
>>61149140
define language and then we can talk about this topic.
Otherwise we will just not agree.
>>
>>61149091
i'm the same way, i tend to fixate on problems until i solve them.
i'm afraid i don't have the greatest recommendations, but if you're starting from java then C++ may be easier to learn, in which case i might simply recommend going over cplusplus' tutorial section.
C is a very simple language with few features implemented by default, but aside from some added syntactic sugar/compiler magic like templates, C++ is extremely similar to it to the extent that(at least in simple cases) C code tends to work in C++ with almost none or only relatively simple modifications, so it might help to start learning C++ first if you're interested in C since you can use higher level concepts like Java while still learning about things like pointers/lower level memory manipulation. i wouldn't recommend C#, as it's far more like Java than C, and will teach you almost nothing about the lower-level things i think you want to know.
i can't recommend too many resources directly. i've never even looked at what you mentioned, but
http://www.cprogramming.com/
Learning C the Hard Way(currently for sale only, the old free version should still be available on the internet archive; there's controversy over this and some people might kill me for mentioning it but he does walk you through a good deal of programming concepts like hash tables and data structures)
cplusplus.com(for C++, obviously, but it will explain things like array structure and pointers)
are a couple.
maybe you knew all of those already but in any case good luck. i'm no expert myself but i think i was once in near the position you describe yourself and have progressed at least somewhat.
>>
>>61149164
A system of communicating.

Not him.
>>
>>61149107
I'm the other guy. Yes it would be best if we ironed down a definition first, but unfortunately I'm not too familiar with category, type, formal language theory, or anyhthign like that.

I agree he should focus more on math though.
>>
File: is this nigga serious.jpg (59KB, 1280x720px) Image search: [Google]
is this nigga serious.jpg
59KB, 1280x720px
>>61149032
>thinks there's anything remotely analogous between natural languages and formal languages
What's your major, stupid studies?
>>
>>61149314
Desu there is.
Look at Noam Chomsky.
>>
>>61149249
I don't understand what you mean with that definition.
Is according to you every system with which it is possible to communicate a language?
An empty room and the possibility to send and receive electric waves could be considered a language by that definition,
but I would argue that the not the system, but rather the interpretation of what is send and received, ciphered and deciphered , the information behind it is important, and something akin to a language.
Is this enough though for something to be considered a language though?
I don't necessarily think so.
Take for example you throw down something a well. After some time you hear your object reaching the floor. You have received information, and can decipher it.
Still one wouldn't say that the coin spoke, or would consider this exchange of information language.
You need to brush up a bit on the preciseness of you vocabulary, if you wish to define something.
I will stick to my point.
Even if one would consider programming languages, as languages,
the act of programming is not a language. It is more of an act of describing what to do or how something is.

Anyway I'll go to sleep, so I won't read replies.
>>
I don't know SQL or web frameworks. I would like to start with python/flask as I like to reinvent the wheel and django has beaucoup features. What's the best way to understand database interaction/creation with flask?
>>
>>61149239
most appreciated anon
>>
Python is such garbage
>>
>>61149450
>the system of communication used by a particular community or country.

Its literally a simple concept.
>Still one wouldn't say that the coin spoke, or would consider this exchange of information language.
Yeah, people tapping on machines to send dots and lines didnt speak so its not a language :^)

kill yourself you pretentious faggot.
>>
File: 1450688847064.jpg (11KB, 301x167px) Image search: [Google]
1450688847064.jpg
11KB, 301x167px
>>61149496
>>
>>61148585
A function that can pick up where it left off.
>>
>>61149496
>Yeah, people tapping on machines to send dots and lines didnt speak so its not a language :^)
>Yeah, people tapping on machines to send dots and lines didnt speak
this just in, everyone who ever wrote morse code was a mute
>>
>>61149588
!=
>>
Will interviewing for a programming job be a problem if I'm deaf-mute?
>>
>>61144338

unsigned char :0; // start a new byte


I've used bitfields in this style before, but I've never seen this done.
>>
>>61149615
No they need you to fill their diversity quota
>>
I'm considering trying out either Erlang or Elixir. It sounds like Elixir is a lot more friendly to program with than Erlang, and that you can do anything with it that you could with Erlang.

But it has me wondering-- why is it that so many companies out there are praising Erlang, but Elixir seems to be memed (or at least the Elixir+Phoenix stack)?

I'm coming from a primarily Python (data science) background, and have recently been making some web apps for some finance majors at my school using Flask.

My interest in functional languages is growing quite a bit as well, so I figured I would kill two birds with one stone (functional webapps) by playing around with Elixir... worth it?
>>
>>61149631
Check out Elm, too.
>>
>>61149314
This -> >>61149416
CNF was derived from Noam Chomsky's studies of trying to find patterns in human speech and found it's uses in computer science with the regular structure of programs. Also, NLP is a big part of AI.
>>
>>61149483
for a in [b for c in range(0, 26) for d in range(0, c) for e in range(0, d) for f in range(0, e) for g in range(0, f) for h in range(0, g) for i in range(0, h) for j in range(0, i) for k in range(0, j) for l in range(0, k) for m in range(0, l) for n in range(0, m) for o in range(0, n) for p in range(0, o) for q in range(0, p) for r in range(0, q) for s in range(0, r) for t in range(0, s) for u in range(0, t) for v in range(0, u) for w in range(0, v) for x in range(0, w) for y in range(0, x) for z in range(0, y) for b in range(0, z)]:
print a
>>
>>61149091
finally if you really want to understand things like the differences between strings, streams, chars and char arrays, unsigned and signed char, what exactly the text you write into code means to a compiler, etc. i really recommend building a firm understanding of both pointers/addresses/memory and encoding/byte interpretation.

you want to know what's going on in memory, and the different ways of interpreting byte data, and the recursive+variable nature of that interpretation(ex: the compiler knows a character(i.e. char) representation of the value 12 and a value representation of the string "12", that both of those could be different from a char array of {'1','2'}, and all of the above are entirely different from the data structure created by something like "string b = "12"), and also an awareness of/habit of questioning what number system you're looking at(most often hex or decimal).

learn about pointers, encoding, structs, and different ways values(bytes) are interpreted by compilers(both as they're written on your screen and internally) if you want to have any depth to your understanding of differences between things like string, stream, char, and char[]. not that i've achieved some state of enlightenment on the matter myself or something but even if you try to test things yourself you'll only get confused if you don't know how the compiler derives values from your written code as it appears to you on-screen, and how it spits them back out in the console.
>>
>>61149615
You obviously have to inform them. I wouldn't imagine it's a problem in practice on a team.
>>
>>61149679
(continued)
ex: you should know that the character あ can never be reproduced if you store it like this:
char c = 'あ';
unless you wrote/used some outlandish encoding/interpreter, and why(because, for most compilers/systems at least, the compiler looks at that character as a double-width character and a char can only hold a single byte of data; the compiler is capable of deriving both bytes from the entered character but one would be lost in conversion to char).

an extra special twist is that if you wrote a file with あ in utf-8 encoding and then inspected it with a hex editor you would find that even though the compiler sees/can see your entered code as a 2-byte character the output value will be 3 bytes(i think, i might be thinking of another character like 新, but the principle exists). this is because the 2 bytes the compiler reads from your entered code are actually(something like a) pointer to a character code in the unicode encoding system, so the compiler looks at the 2 bytes(which is how it interprets the code you're looking at), and then spits out 3 bytes by using those 2 bytes to look up a point on a table of symbols(and the symbol the 2 bytes point to happens to be 3 bytes long).

sorry for all the random near-unrelated information, i don't know what's wrong with me right now. i just keep writing.
>>
is there any kind of fizzbuzz to test my beginner knowledge in oop?
>>
>>61149732
Sounds like you just want a debugger and read the memory.
Should clear up a lot.
>>
>>61149772
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
>>61149732
yet again,
something a little related to your original question, however, would be that the character あ, even if entered into a char array like char c[2] = {'あ'}, would probably still have its second byte truncated, while if you wrote string c = "あ", then it would be much more likely to be preserved. i'm not positive it would really work like that, but i think it's safe to assume at least that in one of these:
char c[2] = {'あ'};
char c[1] = {'あ'};
you're going to be "losing" data, both if the compiler cannot automatically determine that the literal between '[char]' is to be unpacked into 2 bytes even though '[char]' represents a char literal(which i doubt most C compilers would do). instead in the top option you would probably get an array of the first byte of あ and a null char '\0', or an array of the first byte of あ(instead of both of its bytes).
>>
So I'm going to learn java in college very soon but I have a lot of free time so what else should I learn in the meantime?
>>
>>61149679
>i really recommend building a firm understanding of both pointers/addresses/memory and encoding/byte interpretation.
Thank you very much. Though my knowledge of how computers actually work desires much, I have had a fair amount of math - algebra was my favorite, so working in those sorts of formal systems / general structures I am comfortable with.

Though I am familiar with what things like byte data, memory, and pointers are, my knowledge is only surface level at best. I know almost nothing about what a compiler is other than that it is a program that converts code written in the target language into machine code. se are definitely things I need to learn more before progressing too much further
>>
>>61149823
What's your math and cs experience levels?
>>
>>61149823
learn java by yourself
>>
>>61149732
>>61149803
Woah thank you anon! I read through it once and it makes sense for the most part, but I haven't eaten all day so I'm going to go make a sandwich and come back and mull over it again. will you be around much longer? Thanks again!
>>
how can programming help me make elf yamada sensei real
>>
>>61149955
AI, lad.
>>
>>61149843
0
>>61149851
I'll get deeper into it later to not waste time learning things twice
>>
>>61149974
i want her to hug me
>>
>>61150033
the hardware will be here, you just gotta bring the software.
>>
>>61149988
Get an easy calculus book for maths, I'm thinking Stewart or Thomas' Early Transcendentals

For CS either try to figure out how an assembly language or a compiler works. They'll both be very difficult compared to Java but so long as you're actually in a related major it'll pay dividends later
>>
Tabs or spaces, /g/?
>>
File: harold.png (936KB, 1280x720px) Image search: [Google]
harold.png
936KB, 1280x720px
>>61150126
https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
>>
>>61150126
spaces and an editor that treats tabs as spaces, this is not debatable
>>
>>61150126
Tabs.
Spaces are messy.
>>
>>61150141
Then why does vim default to tabs?
>>
>>61150126
1 tab = 3 spaces
>>
>>61150126
I like to mix it up. Keep things fresh.
>>
>>61150126
both
>>
>>61150126
so basically for programming we use fonts where tens of thousands of characters have the same width, which is pretty cool, but then there are retards that actually think that having a character that changes width depending on both the text around it and editor settings is completely fine. it's not completely fine. it's batshit insane
>>
What should I learn if I want to help Libreboot support more hardware? How do I get into reverse engineering? Helping with the Switch hacking scene would be good also.

For Libreboot, I think I want to try to RE the T60p's ATI GPU and then get some of the slightly-unsupported models working, like the X200T which is slightly different from the supported X200.
>>
>>61150126
Tabs.
If you litter your indentation with spaces you can't choose to render different sizes for your normal spacing in code and the indentation.
Of course you can change the number of spaces you insert in the normal spacing and the indentation to receive the perfect granularity but you will find stupid ratios like 75 spaces for a level of indentation and 21 spaces for a space. When you could easily just have that hidden away in rendering.

And you could complicate things by differentiation indentation spaces and non-indendation spaces but that also has issues.

tl;dr
Only brainlets use spaces for indentation.
>>
>>61150126

>Anything other than C or C++
Whatever the community standards are

>C, C++, or any other language with no set community standard
Smart tabs (tabs to indent, spaces to align, two lines are only considered aligned if they contain the same number of tabs and non-tab characters). This ensures that regardless of the editor's tab width, all lines will be perfectly aligned.
>>
>>61144210
create cool software and have a patreon. demo your software on YouTube and take input from viewers
>>
>>61150126
>all those replies

/dpt/: bikeshedding edition
>>
>what are you working on?
libclang based static+dynamic analysis so i can understand what the fuck is going on in frida and x64dbg so i can build static+dynamic analysis for x64

>>61150253
>render different sizes for your normal spacing in code and the indentation.

so this is how retarded tabs people are. incredible.
>>
>>61150306
/dpt/ is the personification of bikeshedding.
>>
i'm trying to understand the "diamond problem" but it won't work for shit

#include <iostream>
using namespace std;

class Base{
public:
virtual void write(){
cout << "Base write.\n";
}
};
class D1 : public virtual Base{
public:
void write(){
cout <<"D1 write.\n";
}
};

class D2 : public virtual Base{
public:
void write(){
cout << "D2 write.\n";
}
};

class DD: public D1, p2{
public:
void write();
};

int main() {

D1 *d1 = new D1();
D2 *d2 = new D2();
DD *dd = new DD();

d1->write();
d2->write();
dd->write();
}

do you guys have any idea what i'm doing wrong
>>
>>61150325
>do you guys have any idea what i'm doing wrong
using OOP
>>
File: 137593505136.jpg (14KB, 240x320px) Image search: [Google]
137593505136.jpg
14KB, 240x320px
>>61150325
>using namespace std
>>
>>61150325
>class DD: public D1, p2{
its actually
>class DD: public D1, public D2{
i fucked up pasting the code, but its not where the error is
>>
>>61150325
Misspelling D2. That's what you're doing wrong. Line 24.
>>
Does /g/ have experience with social software? I've studied early mailing lists and discussion forums and now anonymous chans like this one.

Based on my years here and my study, I've given up on chans. By design, they eliminate identity and thus reputation, hoping that posts will be judged on their own merits. What resulted however is that people still engage reputation circuits in their brains. You simply can't get rid of it. In the absence of identity, the brain made one out of thin air. Based on content, they heuristically map posts to some kind of collective identities related to their subject matter and assign reputation based on that identity. So they react not to the content of the posts but to the perceived identity of the poster, which is formed by every single interaction the reader's ever had with the community about some subject, and unique to every single reader on this site.

This theory explains much of the phenomenon I see around here. It explains, in part, board culture. Identities aren't names but a collective interest. It explains why there are groups even though everyone's anonymous. It leads to group cohesion, the vilification of other groups and delimitation of dogmatic ideas.

If 4chan had monitoring systems, they could experiment with these ideas, maybe prove or disprove them
>>
>>61150316
>retarded
It's a preference dummy. A preference that your retarded idea of styling code makes difficult for no reason at all.

In fact if you use more than one space per level of indentation for your indentation you're demonstrably wrong about using spaces as indentation since it's just a less flexible solution.

Even dumber is that most of you have editors that inserts spaces when you press tab, a key dedicated to the right style. So you go out of your way to simply be wrong.
>>
Ok, guys, I'm looking to make this my final rewrite.

I'm like 5 revisions into a social network originalyl designed for a LAMP stack, but no one EVAR suggests PHP. I started picking up Golang, and it's not bad.

Now, MariaDB seems to offer check constraints that regular MySQL does not, but for a social network/blogging site, would Postgres or MariaDB be better (no data mining at all; just heavy read-write)

I've heard Postgres is good, so I wanna ask.

Additionally, I am considering switching to Nginx instead of Apache, so I'd like to know what y'all think of that, too.

It's also make a sicc stack name: Plague Engine (PLaG Ngin -- Postgres, Linux, and Golang over Nginx)
Serious edge, methinks.


So, either links you found useful, or just a quick explanation would be very appreciated

Thanks
>>
>>61150325

>new
auto d1 = make_unique<D1>():
auto d2 = make_unique<D2>();
auto dd = make_unique<DD>();
>>
>>61150343
Interesting. What do you think of per thread IDs like on /pol/ and /int/?
>>
File: loli.png (63KB, 703x551px) Image search: [Google]
loli.png
63KB, 703x551px
copped a 3d loli obj model today, and some skins, will apply them then make a kneeling / leg spreading animation, then maybe some demo network code in WebGL
>>
>>61150380
>It's a preference dummy.
just like you can sleep on a bed or on nails. just preference.
>difficult for no reason at all
how? i literally press tab and the number of spaces i want is added to the file.
>In fact if you use more than one space per level of indentation for your indentation you're demonstrably wrong about using spaces as indentation since it's just a less flexible solution.
again, explain how. it's actually the exact opposite. if I want to change from 2 to 3 spaces per indentation or whatever i can do that with one click/keypress with no possibility of the editor fucking up, if I want to change the indentation level with tabs on a file where someone aligned manually anything at all, it just became error prone, which is not a problem with space because the editor knows exactly where each letter was supposed to be in the original rendering of the file when it was created.
>>
>>61150343
I still find it better than people who point to character for verification. You have no idea how glad I am that we don't often have arguments devolve into 'but this famous programmer says this!'. Most of our conversations handle the subject matter, or are just insults. Exceptions are notably SCIP. When you read anywhere else it's almost always repetition. The back and forth of discussions almost immediately reveals the source of their belief because they don't actually know why they think what they do.

If you're concerned about board culture and people being upset about uses of words or Newfags that's another thing. It's certainly getting more problematic as the culture gets eroded by the continuous wave of /pol/ invaders who have no clue about the irony of them coming here.
I don't think it will return to normalcy but anonymity isn't the problem.
>>
>>61150416
>editor fucking up
OK. So you use a bad editor. Paints a picture.
>I can use a method of adjusting that has very low accuracy
A low standard for results. Ok.
>if I want to change the indentation level with tabs its error prone
Complete misunderstanding of the circumstance. Doesn't realize it can be tweaked for the user view and not in the source file.

I'm not sure it's worth a response. But I'll give it this anyway.
>>
File: 1430416812241.jpg (83KB, 1192x333px) Image search: [Google]
1430416812241.jpg
83KB, 1192x333px
>>61150410
>>
>>61150410
>>>/vg/agdg ??
This is not programming.
>web
Doubly so.
>>
>>61150450
>OK. So you use a bad editor. Paints a picture.
name a single editor that can read minds of people not even standing at the computer.
>I can use a method of adjusting that has very low accuracy
where did i write that? working with spaces there is no single operation with less than 100% accuracy
>Doesn't realize it can be tweaked for the user view and not in the source file
yes, two people working on the same project viewing a different file is ideal. you should also try running a git hook so that people that prefer camelcase don't have to see underscores and that one guy can have his hungarian notation. it would suit your style preferences.
>>
>>61150410
basically everywhere lolis are illegal if they are photorealistic and that does look like a detailed model

reported to the fbi and the janitors
>>
>>61150453
kek
>>61150458
its a combination of things. there will be a C# / Node server and some websocket code.
>>
I started Python on the first, and my first web app for a project I'm working on in Django.

But apparently, everybody's using Rails now, so I'm trying to learn Ruby, and it's weird as shit.

Why the fuck do people use it over Django? It's very rigid, but it's easy.
>>
>>61150406
They help kill misattribution of identity shitposts by establishing temporary poster identities. So, only a newfag unfamiliar with the software would commit the faux pas of referring to people with different IDs as samefags, or attempting to samefag his own thread with the same IDs visible.

The collective content-based identity, however, appears to follow posters everywhere, simply because they are a function of the post's reader's perception of who the poster is, rather than the actual identity of the post's writer. The identity is not established when you start reading the post; it is gradually formed as you read it. When you look at a post and you see an anime picture, your brain will recognize that pattern and remember every single poster who used anime pictures and your interactions with them, assigning that post as being from "people who post anime pictures". If you look at someone who posted anime picture and about programming, the identities of the two isolated "anime" and "programming" groups will intersect in ways I don't quite understand myself. Identities seem to contaminate one-another as they intersect; I begin to associate programmers with anime.

>>61150426
>or are just insults

That's the thing anonymity was designed to prevent. Without an ego in play, who are you really insulting? What has Anonymous got to lose by being insulted?

The truth is that everyone is participating in an iterated game. You may enjoy having a particular argument at some point, but you probably won't enjoy doing it 10 times every month. New people will do it, but people who've done it many times will just shitpost. So as time goes on, the range of responses to a particular idea shrinks, to the point they're just insults.

Just look at the DPT and it's anime image wars. They've been doing it for years. Years. Group cohesion is evident.

>If you're concerned about

I'm just thinking about whether chans turned out to be better than regular, handle-based forums.
>>
>>61150508
Ruby and Ruby on Rails are dying. Just use whatever you like.
>>
>>61149823
First you brush up on your basic math:
Arithmetic, a little geometry, elementary algebra, and some basic trig.

Next get a standard calculus text and dive in. You should also get a linear algebra and discrete math books as well; make sure the discrete text is proof based (I recommend A Transition to Advanced Mathematics by Smith).
Once you're a couple chapters in to your discrete book (you will want to have covered basic proposition and higher order logic, and basic proofs), you may begin learning programming and computer architecture. As a litmus test, if you don't know what this statement is

∀P((0∈P∧∀i(i∈P-->i+1∈P))-->∀n(n∈P))

you aren't ready to take the reins of a computer.

Now, forget what you do know about computer programming:

First, you learn boolean logic operations
then, you learn transistor logic
then, you learn how to build functional units from logic gates
then, you learn CPU design
then, and only then, you learn assembly language
then, after you have mastered assembly language (not dabbled, but mastered it), you learn C
then, after you have mastered C, you may learn the higher-level languages of your choice, but you will always use C and assembly as your primary languages because everything else is unnecessary bloat.

By this time you should be finished with your calculus (up to advanced integration techniques and vector basics), discrete, and linear algebra, and are ready for the next wave of math: abstract algebra, analysis, multivariate and vector calculus, and, after you have progressed a way in those, topology.

Finally, you become familiar with topoi, and study the internal logic of categories then familiarize yourself with (general) type theory, and its applications to programming. I also recommend studying how to reformulate mathematics in terms of globular categories for use in automatic theorem proving, because there is an inherent programming-like 'feel' to it.
>>
>>61150516
Shut up, you pseudo-intellectual faggot.
>>
>>61150426
>culture gets eroded by the continuous wave of /pol/ invaders

This is a perfect example of what I mean. Anything that resembles political talk will be recognized as such by readers, who will assign them an identity: /pol/. Part of learning board culture seems to be learning who these collective identities are, and how people react to them in socially acceptable ways on a given board. Often, the /pol/ poster gets told to leave with >>>/pol/, with zero consideration for his post. We see here a reputation system at work: it allowed the person replying to the /pol/ poster to dismiss his ideas with minimum effort based solely on the poster's perceived identity. For this reason, saying this site is anonymous isn't accurate. How can this happen if everybody's anonymous?

Clearly some kind of identity is emerging. You can clearly identify groups. General threads such as this one are one clear example; a board within a board.
>>
>>61150508
django is good, dont get caught in a gumption trap over languages
>>
>>61150551
>So they react not to the content of the posts but to the perceived identity of the poster, which is formed by every single interaction the reader's ever had with the community about some subject, and unique to every single reader on this site.


agreed
>>
>>61150586
What's wrong with /pol/?
>>
I need help /dpt/,
This:

int main()
{
char name[128], ch;
int i = 0;

printf("Hello Adventurer! Welcome to the world of K, an unforgetable Quest lies ahead of you. Good luck. \nPlease Enter Your Name: \n ");
while(ch != '\n')
{
ch = getchar();
name[i] = ch;
i++;
}
name[i] = '\0';
printf("Is %s your name?\n",name);

return 0;
}


or this:

#include <stdio.h>
int main()
{
char name[30];
printf("Enter name: ");
gets(name); //Function to read string from user.
printf("Name: ");
puts(name); //Function to display string.
return 0;
}


??????????????????????????????????
>>
>>61150613
>>61150551
What's pseudo-intellectual about what I posted? You need only venture into Intel vs. AMD threads to watch two groups of Anonymous people continuously shitposting at each other. Group dynamics of this caliber don't exist without identity, and on this site identity appears to be an emergent property of the subject of the post. People are what they post.

>>61150639
I personally have no problem with /pol/, I just said people often have that reaction. I believe it's because they rapidly change the topic of discussion.
>>
>>61150586
>posting the wrong category of content in the wrong subforum is people assigning identity.
Yeah. Right.
>zero consideration
Of course it has been considered. There's something about that given post that makes it not belong, so it has been considered. Such as this entire post thread you've made. It's clearly >>>/q/ or >>>/b/ at best. What does this have to do with programming?
You haven't even presented your techniques if there were any.
Dismissing someone based on them spouting nonsense racism in a programming thread is not assigning identity. Where you direct them is not assigning identity. It's simply a redirection for the contents of the post. You could be a full on nazi and post whatever you want here about programming. But people only care about the contents. It's rare for people to actually dismiss people who make solid arguments. Regardless of where they lean. There's a lot of posts that completely lack arguments. That's where the insults come out. You see tons of redirection that's just insult.
>dpt as an example
dpt and the likes have come forth as a response to deteriorating discussion in the casual /g/ threads. If you've had any programming discussion there you will find that they're all CS freshmen at best.
It's generally like that everywhere these appear. Sometimes completely counter to the point of the board (see /int/), sometimes in a disruptive way (see /v/ before they made /vg/). But it's never really about identity.
We have some identity struggles here though. We have people promoting languages which gets very repetitive and people dismiss those users right off because they're sick of the same thing over and over.
>>
>>61150653
alt+c
>>
>>61150653
use fgets to read a string
http://www.cplusplus.com/reference/cstdio/fgets/
use printf %s to print a string
>>
>>61150670
>What does this have to do with programming?

Any program that enables social interactions must deal with these issues. Not talking about this just leads to programmers creating buggy software that doesn't quite accomplish it's purpose. It's a design issue: how would you change 4chan to facilitate stronger anonymity?

Also, I've seen quite a lot of chan projects in dpt. That's what made me start reading up about the subject in the first place

>those users

How do you know it's them? Could be a new user every time. But you know there are groups of people on /g/ who shill languages. You've seen them before. Somehow you know it's them.
>>
>Fixed Class.class.is_a?(Class.class.class.class.class)

git commit message goals

https://github.com/crystal-lang/crystal/issues/4374
>>
>>61150782
>how do you know
You'd have to be really new to a small thread like /dpt/ to not notice posting styles. Sure it's presuming people don't drastically change but it's fairly accurate a lot of the time. As evidenced by referencing older posts.
>>
>>61150836
Been noticing the rust shills have been quiet recently.
>>
>>61150528
>Ruby and Rails are dying

I hear this shit about literally every web app framework. Some people tell me that Django is dying whereas others tell me that Rails is dying.

Rails definitely has more jobs than Django when it comes to web apps, but why is this?

Why would I ever use ruby over python for making applications? What was the cause for the increase in Rails devs and decrease in Django devs?

Currently node.js is the most popular framework according to google analytics. But why is this?

What features do I have in one that I don't have in the others.
>>
What possible reason is there for the program name to be passed in to main as a command line argument?

Was it trendy at one point in time to rename the same executable and expect different behavior?
>>
>>61151105
>Currently node.js is the most popular framework according to google analytics


It is official; Netcraft now confirms: Node is dying
One more crippling bombshell hit the already beleaguered Node community when IDC confirmed that Node market share has dropped yet again, now down to less than a fraction of 1 percent of all servers. Coming close on the heels of a recent Netcraft survey which plainly states that Node has lost more market share, this news serves to reinforce what we've known all along. Node is collapsing in complete disarray, as fittingly exemplified by failing dead last in the recent Sys Admin comprehensive networking test.
You don't need to be a Kreskin to predict Node's future. The hand writing is on the wall: Node faces a bleak future. In fact there won't be any future at all for Node because Node is dying. Things are looking very bad for Node.

All major surveys show that Node has steadily declined in market share. Node is very sick and its long term survival prospects are very dim. If Node is to survive at all it will be among OS dilettante dabblers. Node continues to decay. Nothing short of a cockeyed miracle could save Node from its fate at this point in time. For all practical purposes, Node is dead.
Fact: Node is dying
>>
File: 1475774072977.png (41KB, 871x693px) Image search: [Google]
1475774072977.png
41KB, 871x693px
>>61151105

node.js still has a long way to go before it even starts becoming even remotely relevant though

http://intriggerapp.com/blog/web-technologies-benchmark-report/
>>
>>61151249
Thanks for confusing me more and not answering a single one of my questions.
>>
>>61151115
>to rename the same executable and expect different behavior
This is still being done, check out busybox. It's also useful whenever a program needs to print its own command, like in help / usage messages.
>>
New thread:
>>61151312
>>61151312
>>61151312
>>
Python experts:

raw = data-asin="B004S3Y16Y"'
ASIN = raw.strip('data-asin=').strip('"')
ASIN = raw.split('"')[1]


redpill me on which has the lesat O(n)
>>
>>61147003
Works for me. Are you doing something wrong?
>>
>>61151316
unreadable garbage
Thread posts: 316
Thread images: 30


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.