Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 98 KB, 640x640, 1499578106447.jpg [View same] [iqdb] [saucenao] [google] [report]
63436461 No.63436461 [Reply] [Original] [archived.moe] [rbt]

Previous thread: >>63432478

What are you working on, /g/?

>> No.63436479

cats suck

>> No.63436485

>>63436461
Second for Jeff Dean

>> No.63436486

>>63436479
you too

>> No.63436503

How come every article that uses pictures of code in the header uses minified jQuery?

>> No.63436504

>>63436479
your mom sucks for $5

>> No.63436508

>>63436450
It's pretty much just a const std::string&, except that for some reason they decided to turn that concept into its own class.

>> No.63436516

drinking kills programming, it's true
makes me regret becoming a programmer desu, I like it a lot

>> No.63436518

>>63436504
Bitch I suck for free

>> No.63436528

>>63436516
You need stimulants instead.

>> No.63436529

>>63436516
It kills more than just programming, it kills your brain and your personality in many ways.

>> No.63436544

>>63436508
Well it also works for char * which means you don't have to convert to std::string type.

>> No.63436548

>>63436518
still no one's interested

>> No.63436551

>>63436502
It's not funny because you don't get it.
You actually think I'm criticizing dynamic typing.

>> No.63436571

>>63436548
Did I say I *offer* to suck for free?
No.
I said I *do* suck for free.
It's not a proposition, it's a claim

>> No.63436574

>>63436528
eh
I miss the feeling of getting completely shitfaced with your buds and passing out on someone's lawn naked

>> No.63436598

>>63436574
I see absolutely no reason why you couldn't program while doing that.

>> No.63436609

Do you need to love programming to get a job in it? At a crossroad in my life and I want to make a livable wage.

>> No.63436624

>>63436609
no

>> No.63436628

>>63436574
Your IQ, if it was above average, permanently drops 1-2 points every time.

>> No.63436652

>>63436628
I highly doubt that, I would be a potato right now.

>> No.63436653

>>63436609
I'm sure more than half of the codemonkeys hate it.

>> No.63436669

>>63436652
>if it was above average

>> No.63436690

>>63436652
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4368388/

>> No.63436693

What about startup brocultures where people drink whiskey every week thou

>> No.63436696

I'm truing to get two radio buttons display in column. I tried to write both GridLayout(0,1) and GridLayout(1,0) and they still show on one row. What gives?

public class MenuPanel extends javax.swing.JPanel {
public MenuPanel(){
super();

javax.swing.ButtonGroup group = new javax.swing.ButtonGroup();

MenuOptions burger = new MenuOptions("Burger");
MenuOptions fries = new MenuOptions("Fries");
javax.swing.JPanel menuColumn = new javax.swing.JPanel(new java.awt.GridLayout(0,1));
this.add(menuColumn.add(burger));
this.add(menuColumn.add(fries));
}
}

>> No.63436718

>>63436693
I'm not sure what broculture is but drink up man.

>> No.63436729

>>63436652
>I would be a potato right now.
As compared to being a brilliant world transforming PhD that you were destined to be, maybe you are a potato right now.

>> No.63436759

>>63436729
No, I'm pretty sure I would doing the same thing. I would just be complaining on /dpt/ about alcohol instead of drinking.

I think I like my choice better.

>> No.63436774

>>63436696
try new GridLayout(0, 2)

>> No.63436784

>>63436696
>>63436774
Wait, I misread that. try GridLayout(2, 0).

>> No.63436793

>looking over lecture slides on sorting algorithms
>its just tons of uncommented code
>merge sort is particularly bad
>university refuses to video lectures to inflate attendance
>youtube videos are better material than the resources of a 9k a year learning institute

Higher education was a mistake

>> No.63436797

>>63436479
You suck

>> No.63436800

Are you kidding anon? Alcohol and whores are pretty much mandatory for php webdevs such as myself. The stress would've killed me by now if not for those two

>> No.63436802

>>63436690
>In our over all analysis, abstainers did not differ from light consumers of alcohol in IQ. Abstainers have previously been shown to be a special group regarding factors of sociability (low), emotional stability (low), and psychiatric diagnoses (high)

>> No.63436812

>>63436628
[Citation needed]

>> No.63436818

>>63436759
Ok, it did turn you into a potato.

>> No.63436824
File: 126 KB, 400x400, d28.gif [View same] [iqdb] [saucenao] [google] [report]
63436824

Reminder that dynamic typing is shit. Programs should run without user input.

If you don't understand the connection between the two, you don't get the joke.

>> No.63436829

>>63436802
>Abstainers have previously been shown to be a special group regarding factors of sociability (low), emotional stability (low), and psychiatric diagnoses (high)
L M A O
literally 4chan dot org

>> No.63436837

>>63436461
Every stack implementation in C I've seen with linked lists leaks memory.
What's going on?

>> No.63436845
File: 206 KB, 1680x1014, Screenshot_20171118_133909.png [View same] [iqdb] [saucenao] [google] [report]
63436845

I'm learning android with udacity courses

>> No.63436847

>>63436802
>light consumers

>> No.63436870

>>63436784
>>63436774
Still doesn't work. I probably messed up somewhere else

>> No.63436881
File: 351 KB, 700x700, 1507195586136.png [View same] [iqdb] [saucenao] [google] [report]
63436881

>>63436802
>light consumer masterrace
why can't I get a gf then ?

>> No.63436896
File: 53 KB, 1280x720, potatoes.jpg [View same] [iqdb] [saucenao] [google] [report]
63436896

>>63436818
I could learn to live with this.

>> No.63436922

>>63436837
It's probably just example code and they didn't bother cleaning up.

>> No.63436930

>>63436837
Shouldn't this clean all the memory?
int main()
{
struct data d;
d.number = 0;

struct stack *s;
s = initStack();

long i = 0;
while (!full(s) && i < 100000000) {
push(s, d);
i++;
}

printf("press enter to pop all...\n"); getchar();

while(!empty(s)) {
d = pop(s);
}

printf("press enter to quit...\n"); getchar();
}

>> No.63437143

What do you think about having a compiler on a production server?

>> No.63437149

>>63436837
feest u eyes
#include <stdlib.h>
#include <string.h>
typedef struct cons {
void *first;
struct cons *rest;
}* stack;
stack *mkstack(void) {
return calloc(1, sizeof(void *));
}
int stack_empty(stack const *s) {
return !*s;
}
void push(void const *v, size_t n, stack *s) {
struct cons *c = malloc(sizeof(*c));
c->first = malloc(n);
memcpy(c->first, v, n);
c->rest = *s;
*s = c;
}
void gettop(void *v, size_t n, stack const *s) {
if (*s) memcpy(v, (*s)->first, n);
}
void settop(void const *v, size_t n, stack *s) {
if (*s) {
(*s)->first = realloc((*s)->first, n);
memcpy((*s)->first, v, n);
}
}
void pop(stack *s) {
if (*s) {
struct cons *c = (*s)->rest;
free((*s)->first);
free(*s);
*s = c;
}
}
void rmstack(stack *s) {
while (*s) pop(s);
free(s);
}

disclaimer i wrote this on a phone and haven't tested / even tried compiling

>> No.63437170

>>63436930
What about the result of initStack()?

>> No.63437176

justify this sepplesfags
#include <iostream>
#include <functional>

int main()
{
std::function<void()> x;
std::cout << sizeof x;
}

32

>> No.63437233

>>63437176
Baka, that's not how you do functions in C++.
#include <cstdio>
int main() {
printf("%zu\n", sizeof(void(*)()));
return 0;
}

8

>> No.63437262

>>63437233
that the fucking point, retard

>> No.63437264

>>63436845
Try the pirated udemy course, it has much more content.

>> No.63437281

>>63437262
So you mean the point is that there's literally nothing wrong with function values in C++?
got it

>> No.63437298

>>63437281
I'm asking what the hell they're smuggling in a std::function besides a function pointer and an environment pointer

>> No.63437327
File: 131 KB, 1797x1055, pencil_skirt,x1055,front-bg,f8f8f8.2.jpg [View same] [iqdb] [saucenao] [google] [report]
63437327

>>63437298
But why would you want to know that when std::functions are shit and you shouldn't use them?

>> No.63437344

>>63437298
>what are they smuggling in to std::function to make it so big
your mom

>> No.63437347

>>63437327
This is a recurring theme - anything in the c++ std library is trash and you should avoid it.

>> No.63437351

>>63435661
I didn't say anything about element type
>>63435815
you seem to be mad because you have trouble understanding english
>>63436125
you're quoting "can't declare an array" like you're going to refute that but your post doesn't have any array declaration; how dumb are you?
>I remember you
of course, I've been smacking you for years, here comes some more
>what kind of data structure does p point to
it points to an uninitialized object; an uninitialized object is not a data structure
>Does it have a name?
allocated uninitialized object
>>63436364
>I'm not saying it's anything, anon
of course, you know you're a retard and are taking precautions now
>what one might call a sequential collection of elements with indexed random access
slice? vector? buffer? there are many names one might use
>that sort of thing is called an "array"?
maybe in some languages, but not in C; in C, there's this document called "standard" which precisely defines the meaning of "array", you can't just randomly call whatever you want an array

>> No.63437383
File: 54 KB, 800x800, flat,800x800,075,f.jpg [View same] [iqdb] [saucenao] [google] [report]
63437383

>>63437347
Yeah, obviously, but C++ is a good language.

>> No.63437425 [DELETED] 

>>63437383
Idris or Agda lads?

>> No.63437426

>>63437383
>muh zero cost abstractions

>> No.63437440

Idris or Agda lads?

>> No.63437447

>>63437351
>you seem to be mad because you have trouble understanding english
You literally suggested that arrays should store their length so that you get the length of an array if you need it, and that the compiler could just optimize out the storage if the length is never used.

If you really are talking about getting the length of an array, and not that of any of the several things an array can become when you pass it around, that suggestion is blatantly stupid, because the length of an array is always available at compile time.

>> No.63437473

>>63437440
Agda pretty fucking obviously

>> No.63437479

>>63437447
>because the length of an array is always available at compile time.
VLAs

>> No.63437490

>>63437447
>You literally suggested that arrays should store their length
I made no such suggestion, you are confused again; go back and read the reply chain

>> No.63437494

considering reading through the c99 specification
thoughts? anyone done it? is it a good read?

>> No.63437502

>>63437494
deprecated

>> No.63437510

>>63437176
what am I supposed to justify here

>> No.63437516

>>63437494
It's more of a reference, not something you just read. It's boring.

>> No.63437527

>>63437298
>what the hell they're smuggling
Just look, you dumb fuck, it's all in the header; that's how templates work!

>> No.63437582

Let me make this very clear. Computer programming is hard. Really hard. It is a long road from where you are, little butterfly, to the top of the mountain. A programming expert. A real guru. Right now you're not even an amateur, don't you dare put that on your resume. You're nothing. You think you're some shit, no, you're a script kiddie who downloaded some warez of the internet and pushed a button. So listen carefully - before you begin writing your first lines of code, get familiar with basic concepts in abstract algebra, discrete mathematics, and computational complexity theory. Don't even dream of getting a job before you've mastered the polynomial hierarchy. Read all 8 volumes of "The art of computer programming". Do all the exercises. Then read "Concrete mathematics", and then read the proof of the PCP theorem, from start to end, in one go. If you don't understand it, go to step 1 and repeat. Invent your own assembly language, and write a C compiler with it. Then run it by hand. On the linux kernel. Step by step, pen and paper. And when you've finally reached the end of the boot sequence, get started on a python interpreter. And when you've had your first dream in MIX, wake from that dream and write that down come to me. If it compiles , you're ready to begin your journey. You're not an expert in programming by any means, but you've mastered the basics. You're worthy of touching a compiler. A job as a programmer? that's decades away. Maybe a few lifetimes. If you even get there. But lets celebrate the small victories.

>> No.63437591

Anyone code something related to cryptos? I feel like I'm being really retarded by not trying to ride this once in a lifetime opportunity to riches.

>> No.63437600

>>63437176
#include <iostream>
#include <functional>
#include <memory>

int main()
{
std::unique_ptr<std::function<void()>> x;
std::cout << sizeof x;
}

>> No.63437602

>>63437582
>Computer programming is hard
stopped reading right there

>> No.63437607

>>63437591
It's a fucking bubble lmao

>> No.63437613

>>63437582
kanpai!

>> No.63437643

>>63437490
Yeah, you're right. When I said: >>63435370
(which was my first post in the conversation)
I was responding on the assumption that you were the guy who said this: >>63434986
However, looking back through the conversation, I see you aren't.

Anyway, my point *to that guy* still stands:
>for a compiler to determine whether an arrays length is ever used, it would have to be able to follow the array through all these possible transformations, which would AT BEST amount to running the whole damn program.

>> No.63437644

>>63437582
What if I have unironically done all of those things?

>> No.63437671

>>63437607
https://en.wikipedia.org/wiki/Greater_fool_theory

Besides I'm not talking about investing in or holding cryptos long term. I'm talking about making something and tricking idiots into investing in it (read: give me money).

>> No.63437727

>>63437582
You're objectively wrong. A programmer is not an expert in programming, a programmer is one who programs. So there's absolutely nothing wrong with pursuing a job as a programmer when you're not an expert. There's a big difference between an expert and a professional, especially in areas of expertise sufficiently large and difficult to be called fields of study, such as computer science. Plenty of professional programmers are script kiddies, and there's literally nothing wrong with that, because people have families to feed and even something as small as what you call "nothing" is a valuable skill that employers need and look for.

>> No.63437832
File: 24 KB, 680x486, 1473619593033.jpg [View same] [iqdb] [saucenao] [google] [report]
63437832

Anyone here actually works a programming job or are you all just hobbyists/NEETs

I'm going through a Software Design course and having to lead a development team of students is HELL. I feel like I have to check through everything they do because they manage to fuck up the simplest things even though we went over everything a million times. And we haven't even started programming yet; I dread the end of midterms when I'll have to deal with them again.
Is it like this out in the field or is it just a clueless college kids thing? It's a matter of life and death so please answer with that in mind

>> No.63437898

>>63437832
>Is it like this out in the field

Yep.

>> No.63437935

>>63437832
dumb frogposter

>> No.63438024

Problem:
Write a program where the input is N. The program has to find X, where X is the possibly smallest number of which multiplication of digits gives N. (any language)

Example:
N = 12
X = 26 (because 2*6 = 12)

N = 54
X = 69 (because 6*9 = 54)

...took me a while desu.

>> No.63438052
File: 102 KB, 526x326, unnamed.jpg [View same] [iqdb] [saucenao] [google] [report]
63438052

So, looking for some ideas/help.
Now that the education is done and i've worked for a great company for awhile i have tons of energy.

Now I want to start programming on my free time. And I have an idea i want to execute, but i have no idea what tools i should use, so i'm looking for input:

>I want to make a simple base-management game. Think X-Com rather than clash of clans.
>Not neccessarily multiplayer.
>Text based.

Easy enough. But:
>I want to display it on my webpage
>I want it to be able to evolve into an "actual" game down the road.
>Memes aside doing it object or ECS would be nice, so i want to avoid JS as far as possible
>Some server input/logic

What tools do i use? I've played around in 20+ languages and know 5-6 at a professional level, but all my solutions are really really clunky.
For the web and potential "home" distribution doing a model-view-controller setup is quite obvious and easy it being text based, but i haven't gotten any further than that.

Any ideas appreciated.

>> No.63438076

>>63438052
Hey Alex

>> No.63438100

>>63437832
Hi, I'm a programmer IRL. I have worked at companies where this was a problem and I have worked at companies where it wasn't a problem. Both kinds of companies had junior programmers, but they differed in how they managed them.

The way to avoid this is to have all programmers (not just the junior ones) demonstrate that their work is correct before they submit it for code review. There are a number of techniques for this, and it makes sense to adopt several. Here are a few. Pick and choose the ones that apply to the type of development you do.
- manually testing sample scenarios
- unit tests
- integration tests
- system tests
- model checking
- type checking

On a small team of experienced developers, these things aren't so important. On a large team or a team with inexperienced developers, these techniques are critical to avoid wasting the time of managers, senior devs, and the QA team.

Also, you have to accept that junior developers won't always write the best code. Point out the problems during code review and have them fix it. Don't worry about small style problems; focus on architectural issues.

>> No.63438104

Why don't people understand different OSes are good for different kinds of people?

Windows is an affordable technical solution that requires minimal technical know-how and offers only moderate functionality. Ideal for rednecks and normie brainlets (minimal technical know-how) who have no muns (affordable) and need a computer for their classes or jobs (moderate functionality).

Mac is a very expensive toy that requires only moderate technical know-how and offers minimal functionality. Perfect for rich snobs who have no need for productivity because they're already rich (minimal functionality) and see computers as nothing but fashion accessories (expensive) that reflect their high opinion of their own intellect (moderate technical know-how).

Linux is an early 90's piece of garbage that's completely free and offers maximal functionality but only by requiring maximal technical know-how. It's best for literal autists who can't get a job because of their social disability (free) and need to figure out how to be self employed so they can live (maximal functionality) and also happen to know computers inside and out because they're autists (maximal technical know-how).

And believe it or not, that pretty much covers the range of kinds of people there are.

That's right: literally everyone is terrible.

But that's beside the point.

>> No.63438107

>>63438052
>know 5-6 at a professional level,
>but all my solutions are really really clunky.
sounds about right
literally anything can transpile to js these days, just pick your favorite language.

>> No.63438131

>>63438104
k tard. wrong thread.

>> No.63438138
File: 262 KB, 1400x569, 1504625720610.jpg [View same] [iqdb] [saucenao] [google] [report]
63438138

>>63436479

>> No.63438140

>>63438076
Good try. A was the right start though.

>>63438107
I'd rather avoid doing that for the simple reason that it brings alot of unknowns into it. Don't want to spend hours working around that X isn't possible to compile properly etc.

>> No.63438156

>>63438100
Thanks for raising my spirits, anon

>> No.63438166

is there a way to execute php commands in a command line argument? e.g. php "echo hello world;"

>> No.63438169

>>63437176
https://stackoverflow.com/a/13503614

>> No.63438175

>>63438024
no run-time requirements is easy-mode
for i in range(N, N**2):
if reduce(lambda s,x: s*int(x), str(i), 1) == N:
return i

>> No.63438200

>>63438166
got it, -r

>> No.63438202

>>63438166
php -r "echo 'hello world';"

>> No.63438214

>>63438166
php -r 'echo "hello world\n";'

>> No.63438267
File: 10 KB, 179x281, images.jpg [View same] [iqdb] [saucenao] [google] [report]
63438267

I have a MySQL database installed in my computer.

Can i query its tables with Javascript?

>> No.63438312

>>63438267
https://www.w3schools.com/nodejs/nodejs_mysql.asp

First result on google.

>> No.63438367

>>63438312
thanks anon!

My idea was to support MySQL, PostgreSQL, Oracle, SQLite and MariaDB.

IS there another JS library for the other databases i mentioned?

>> No.63438377

>>63438024
Too easy, obviously won't work if x does not have the form 2^a 3^b 5^c 7^d.
def mindig(x):
o = []

for d in range(9, 1, -1):
while not x % d:
o.append(str(d))
x //= d

return ''.join(reversed(o))

>> No.63438420

>>63438367
No. Only MySQL.

>> No.63438469

>>63438024
Ez
import std.stdio;

void main()
{
int N;
readf("%s", &N);

import std.range, std.algorithm, std.array, std.format, std.conv;

//dfmt off
auto products = iota(1, N + 1).filter!(n => N % n == 0)
.map!(n => [n, N / n])
.map!(p => (format("%s%s", p[0], p[1])).to!int)
.array()
.minElement(); //dfmt on

writefln("X = %s", products);
}

>> No.63438501

>>63436930
forgot return statement at the end. How does the stack struct and methods look like?

>> No.63438619
File: 35 KB, 692x687, 1480594828800.png [View same] [iqdb] [saucenao] [google] [report]
63438619

I decided to get a random assortment of books. How did I do?

>> No.63438630
File: 260 KB, 483x368, 1504953336683.png [View same] [iqdb] [saucenao] [google] [report]
63438630

>>63438619
>Microsoft C

>> No.63438631

>>63436461
sdfsd

>> No.63438639

>>63438469
This is the same program but in APL.
⌊/(⍎∘(∊⍕¨)⊢,N∘÷)¨((0∘=∣∘N)/⊙⊢)⍳N←⎕

>> No.63438645
File: 1.92 MB, 2203x1359, Screenshot from 2017-11-18 17-41-24.png [View same] [iqdb] [saucenao] [google] [report]
63438645

>>63436461
Learning me some Java

Also, profits are back up.
I like money. A lot. So lately my latest obsession has been writing scripts and programs to monitor my profits.

>> No.63438671

>>63438639
Now make a hello world using gtk bindings in APL

>> No.63438685

>>63438645
>managing virtual money

kek'd

>> No.63438754

>>63438501
This is the whole program
#include <stdio.h>
#include <stdlib.h>

struct data {
int number;
};

void printData(struct data* dataPtr)
{
printf("%d\n", dataPtr->number);
}

struct node {
struct data data;
struct node *next;
};

struct stack {
struct node* top;
};

struct stack *initStack()
{
struct stack *stack;
stack = malloc(sizeof (struct stack));
stack->top = NULL;
return stack;
}

int empty(struct stack *stack)
{
return (stack->top == NULL);
}

int full(struct stack *stack)
{
return 0; // linked list stack is never full
}

int push(struct stack *stack, struct data data)
{
if (full(stack)) return 0;
struct node *oldtop = stack->top;
stack->top = malloc(sizeof (struct node));
stack->top->next = oldtop;
stack->top->data = data;
return 1;
}

struct data pop(struct stack *stack)
{
if (empty(stack)) {
puts("you can't pop an empty stack");
exit(1);
}
struct data data = stack->top->data;
struct node *newtop = stack->top->next;
free(stack->top);
stack->top = newtop;
return data;
}

int main()
{
struct data d;
d.number = 0;

struct stack *s;
s = initStack();

long i = 0;
while (!full(s) && i < 100000000) {
push(s, d);
i++;
}

printf("press enter to pop all...\n"); getchar();

while(!empty(s)) {
d = pop(s);
}

printf("press enter to quit...\n"); getchar();
}

It works as a stack but it leaks and I don't know why

>> No.63438799

>>63436696
cool button group that you don't use bro.

>> No.63438810
File: 1.57 MB, 2097x1261, Screenshot from 2017-11-18 17-57-28.png [View same] [iqdb] [saucenao] [google] [report]
63438810

>>63438645
Forgot to mention, the app is multi-threaded (has 3 threads) and is obviously a gui application

Thread-0: Core application logic, including the HTTP requests, the major calculations, and the cli front. This thread runs an infinite loop and will stay alive forever until you kill it with control-C. (it has a Thread.sleep() in the loop so it won't murder the CPU; The total execution time refers to how long the execution was for the main method. It's basically mark start time, execute core logic, mark finish time; echo time elapsed and sleep)

Thread-1: Dashboard Window

Thread-2: DebugWindow

And yes, I've been dealing with NullPointerException's and
Exception in thread "Thread-0" Exception in thread "Thread-2" java.util.ConcurrentModificationException


And other various thread-related crap. Slowly I am learning.

Also, the first execution always takes the longest because the object is getting itself all setup, and its pulling your account and transaction information.

But subsequent executions occur really fast, because it only re-queries the latest prices, and re-calculates all the math. But it won't re-query account or transaction info, so every iteration after the first usually takes only 0.1 seconds or so. I have it set to refresh every 40 seconds.

>> No.63438831

>>63438671
W ← '⎕' ⎕NEW 'MSGBOX'
W.CAPTION ← 'Hello World!'
W.TEXT ← 'Hello World!'
W.STYLE ← 0
W.ICON ← ¯1
W.DEFAULT ← 1
W.SHOW

>> No.63438843

>>63438810
You're the guy who's doing triangle arbitrage or something right?

Seems like a fun project. But coinbase seems to want a fucking stool sample before I can register an account with them.

>> No.63438850

>>63438754
You forgot to free s, just run it through valgrind next time.

Also is this really necessary?

i < 100000000

I got an out of memory on my VM, you could have set that to 2 and had the same result.

>> No.63438879

>>63438754
It's leaking the stack container itself. You're deallocating everything you pop but you never deallocate the empty stack itself.

>> No.63438895

>>63438810
You generally don't want to use threads like that unless you're really trying to keep resource usage down. It's fine to spin up a thread for every HTTP request you do, so that each of them can be processed asynchronously without blocking any other thread (unless that thread is explicitly waiting for that one to finish something.

You also don't really have to explicitly start threads for anything gui-related either, assuming you're using Swing or something similar. It starts all the necessary threads for that.

>> No.63438896

>>63438630
Why does everyone post this guy when in fact he is objectively wrong

>> No.63438917

>>63438896
Looks like somebody didn't get his beating this morning.

>> No.63438940

>>63438850
I don't know how else to observethe memory leak, so I fill the memory with whatever.
Thanks for the tip on valgrind, I may try it, but the code is so simple, I feel like free is doing something else too I don't know

>>63438879
I tried that too
free(s->top);
free(s);

But still the memory usage is off the roof
Somehow all these calls to free I do don't make a difference

>> No.63438964

>>63438024
#include <stdio.h>
#include <stdlib.h>

int main(int *args, char **argv)
{
int input = atoi(argv[1]);
char output[2];

for(int index1 = 1; index1 < 10; ++index1)
for(int index2 = 1; index2 < 10; ++index2)
if(index1 * index2 == input) {
output[0] = index1 + '0';
output[1] = index2 + '0';
puts(output);
return 0;
}
printf("There are no pair of multipliers whomst value is %d.", input);
return 0;
}

fuck this, im brute forcing.

>> No.63438974

>>63438843
>guy who's doing triangle arbitrage or something right?
I think that is someone else

>coinbase seems to want a fucking stool sample before I can register an account with them.
Yea, they want to make sure that you're a real person before they let you start making a bunch of trades.

They don't want people manipulating the market by using a bunch of bot accounts. (or even human-operated fake accounts)

The idea is that by acquiring your driver's license and bank number and all the other garbage, they're making sure you're thoroughly identified and linked to your account. That way they can hold you responsible if you try to pull some shit.

But its actually really nice. Because if once you've jumped through the hoops, you have much higher trade limits. I could theoretically do up to $10,000 in trades per week, if I wanted to. (not that I actually HAVE that much money; but if I did, I could)

>> No.63438987

>>63438964
>IQ level
>Ctard tier

>> No.63439000

>>63438940
The memory usage through the roof is because of those 100 million structs you're allocating. That's not leaked memory, it's the GiBs your program is allocating.

The only leaked memory is sizeof(struct node).

>> No.63439009

>>63438974
$10k doesn't seem like a high limit for weekly trades...

Anyway my problem with all the ID they need is that I don't have a driver's license, don't have a passport and I'm from an ass-backwards country so they are a pain to get.

Just give a nigga some buttcoins, I have the money...

>> No.63439028

>>63437494
Its not like the scheme reference. Its very long and boring. Might be good if you're writing a parser or interpreter though.

>> No.63439033

>>63439000
But I'm freeing each and everyone of them inside the pop() function. And then I have no way to access them. That's a leak.
These stuct node are allocated with a malloc and everyone is popped and freed. Why is the memory not reclaimed?

>> No.63439042

>>63438810
This is dumb. Why are you multithreading this?

>> No.63439044

>>63438895
>It starts all the necessary threads for that.
Oh. Well damn.

I didn't even check to see if it *could* run on a single thread. I just assumed it wouldn't, because I remembered trying to do similar shit in powershell on windows.

In powershell, you can also create gui applications using XAML and Windows Presentation Foundation (WPF), but if you try to launch a window, your primary thread locks up. The script will freeze and won't do any other execution while the window is open.

The only way to get around it is to use multiple threads. (and they do not make it easy; .NET is a real bitch sometimes)

So I just naturally assumed I'd need a thread for each gui window in Java.

Thankfully, threads are super comfy in Java. Very easy to work with.

>> No.63439061

>>63436461
Is there a good json library for C?

>> No.63439067

>>63439061
>C
>string
Pick one.

>> No.63439075

>>63439061
Jansson maybe?

>> No.63439086

>>63439033
It is reclaimed.

~ $ c99 -Wall -g stack.c
~ $ valgrind --leak-check=full ./a.out
==4536== Memcheck, a memory error detector
==4536== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==4536== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==4536== Command: ./a.out
==4536==
press enter to pop all...

press enter to quit...

==4536==
==4536== HEAP SUMMARY:
==4536== in use at exit: 8 bytes in 1 blocks
==4536== total heap usage: 13 allocs, 12 frees, 2,216 bytes allocated
==4536==
==4536== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1
==4536== at 0x4C2CE5F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4536== by 0x1087F3: initStack (stack.c:25)
==4536== by 0x10891D: main (stack.c:69)
==4536==
==4536== LEAK SUMMARY:
==4536== definitely lost: 8 bytes in 1 blocks
==4536== indirectly lost: 0 bytes in 0 blocks
==4536== possibly lost: 0 bytes in 0 blocks
==4536== still reachable: 0 bytes in 0 blocks
==4536== suppressed: 0 bytes in 0 blocks
==4536==
==4536== For counts of detected and suppressed errors, rerun with: -v
==4536== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)


(This substituting 100 million for 10).

>in use at exit: 8 bytes in 1 blocks

That is what you leaked, it's struct stack *s. The rest was freed.

>> No.63439088

>>63439044
Wrong. It looks like its stopped execution, but it's because you've tied your presentation logic to your data layer like a bad programmer. UI updates should be done synchronously.

/g/ is full of scrubs.

>> No.63439121

>>63439061
json-c

>> No.63439122
File: 41 KB, 603x402, 347721f8644a001d09e491fc03b01074-650-80.jpg [View same] [iqdb] [saucenao] [google] [report]
63439122

turned myself into an adult naviii
BOOM big reveal, i'm an adult, what do you think about that
i turned myself into an adult
I'M ADULT LIIINK

>> No.63439132

>>63439028
It's only 200 pages for the important parts.

>> No.63439141

PICKLE RICKERS IN THE HOUSE TONIGHT

>> No.63439155
File: 628 KB, 540x304, tumblr_no4syjmJpX1qmtyk0o1_540.gif [View same] [iqdb] [saucenao] [google] [report]
63439155

Wondering why every C++ GUI library sucks.

>> No.63439177

>>63438469
>double map
Nauseated

>> No.63439180

>>63439155
Qt is okay-ish, depending on what you are looking for.

>> No.63439184

>>63439155
Can you think of any good GUI library that's pleasant to use? Not just for C++, for anything.

>> No.63439185

>>63439155
FLTK

>> No.63439204

>>63439155
because the language sucks

>> No.63439209

>>63439184
Unironically winforms is the comfiest. But it's pretty limited.

>> No.63439220

>>63439184
javax.swing

>> No.63439225

>>63439220
Fuck no.

>> No.63439243

>>63439184
Only ones which have been remotely tolerable for me are Cocoa for OSX & VCL for Delphi

>> No.63439254

>>63439155
wxWidgets

>> No.63439258

>>63439088
>/g/ is full of scrubs.
Damn man, why you gotta be so harsh?

I'm doing the best I can. I didn't go to school. I'm 100% self taught. And I have a full time job, so there's not much time left for learning these days. (except when its a slow day at work)

I think i'm doing pretty well, all things considered.

Also, I generally keep my data objects in one place, and my gui objects in another. I only "tie" my presentation to my data-layer in the sense that when something significant happens, I either:
- if it is an event, the presentation objects will in some way reach out and grab the required data from the data objects
- if it is the completion of some backend calculation, the app objects will either push the data to the gui, or will trigger one of the gui methods to basically simulate an event

I don't really know how else one would separate the two, seeing as they are required to work together. It seems like life is usually easier when everything has hooks into everything else. So long as the hooks are designed well, what's the problem?

And did you mean that UI updates should be done asynchronously? or did you really mean synchronously?
Because synchronous doesn't make any sense in my opinion. Most of the time, it seems like the event-driven way of doing things works better than synchronous stuff. Why have something wait on something else, when you can have it just proceed on with its business, and just trigger one of those hooks to reach out and do something when the time is right?

>> No.63439299

>>63439258
Don't worry buddy, you're doing okay.

The UI should call down to business logic in an asynchronous way. That way it doesn't freeze while you wait for the result of your action.

You probably want to add a "loading" thing while an action is running, so that you can't start a new action during an action.

Ideally speaking anyway. It doesn't really matter for a program you're just messing around with on your free time.

>> No.63439317

What are some forums for people interested in old technology, emulation, etc.?

>> No.63439347

>>63439317
If you mean like vidya and stuff, >>>/vr/ is actually a pretty good board.

>> No.63439351

>>63439317
>forums
have fun with the "not 4chan" syndrome.

>> No.63439372

>>63439086
I freed the stack too so now valgrind reports no leaks but it still leaks.
At least that's what htop and every other system monitor program is telling me.
The memory is freed only when the program quits
$ gcc -g -o stack stack.c
$ valgrind --leak-check=full ./stack
==9911== Memcheck, a memory error detector
==9911== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==9911== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==9911== Command: ./stack
==9911==
press enter to pop all...

press enter to quit...

==9911==
==9911== HEAP SUMMARY:
==9911== in use at exit: 0 bytes in 0 blocks
==9911== total heap usage: 10,000,003 allocs, 10,000,003 frees, 160,002,056 bytes allocated
==9911==
==9911== All heap blocks were freed -- no leaks are possible
==9911==
==9911== For counts of detected and suppressed errors, rerun with: -v
==9911== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
$ valgrind --leak-check=full ./stack
==9925== Memcheck, a memory error detector
==9925== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==9925== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==9925== Command: ./stack
==9925==
press enter to pop all...

press enter to quit...

==9925==
==9925== HEAP SUMMARY:
==9925== in use at exit: 0 bytes in 0 blocks
==9925== total heap usage: 10,000,003 allocs, 10,000,003 frees, 160,002,056 bytes allocated
==9925==
==9925== All heap blocks were freed -- no leaks are possible
==9925==
==9925== For counts of detected and suppressed errors, rerun with: -v
==9925== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Or maybe I'm not interpreting correct the htop reading? I don't know what's going on!

>> No.63439407

>>63439372
>The memory is freed only when the program quits
Obviously, your shitty program allocated all that memory and will keep it until you "pop all".

That's not leaked memory, that's the memory used by your program. Leaked memory is when you lose track of a block memory.

>> No.63439415
File: 740 KB, 1834x1200, 1489461328707.png [View same] [iqdb] [saucenao] [google] [report]
63439415

>>63438964
I really hope you were joking

>> No.63439424

>>63439407
That's why I have the final getchar()
I pop everything add yet the memory usage doesn't drop

>> No.63439507

>>63439177
A double map is just two nested maps broken down. Compilers usually optimize it away regardless.

>> No.63439516

>>63439424
That probably has to do with the malloc implementation The allocator is just waiting to reuse those blocks on your next call to malloc. If every call to free actually released that memory back to the OS, it would be slow as hell.

If it's glibc you're using, you can force it to release all memory back with malloc_trim() but this is not portable at all.

You shouldn't be concerning yourself with this crap, you'll never notice it in a program that doesn't allocate 10GBs and then blocks.

>> No.63439538
File: 43 KB, 1182x905, Screenshot from 2017-11-19 11-53-59.png [View same] [iqdb] [saucenao] [google] [report]
63439538

In a couple of years, C will not even be in the top 10 language list. How does it make you feel, /dpt/?

>> No.63439549

>>63439538
Fantastic.

>> No.63439551

>>63436461
Thinking about making a number-crunching app/calculator thing with arbitrary precision

I've been juggling several options, but among them:
a) byte array (each element is a char)
b) Byte linked list (each element is a byte, and gives O(1) insertion time if I have a pointer to the last element)
c) Digit linked list (same as above, but allows for easy printing)

If I were to do either c or b, how would I implement representing the number in decimal notation?

>> No.63439556

>>63439538
Just fine, I don't want to be grouped in with those javascript people.

>> No.63439566

>>63439538
i dont give a fuck what language you retards code.
As long as i can cuddle up with my spartan c every morning as i start work.

>> No.63439588

>>63439538
I'm gonna make a hip new web framework for C.
Everyone on github will love C.

>> No.63439604
File: 91 KB, 945x482, 1491081808904.jpg [View same] [iqdb] [saucenao] [google] [report]
63439604

>>63439538
>He didn't see it coming

>> No.63439622

>>63439516
>malloc_trim()
Dude!!! Thank you!!!
That was it! It was driving me mad and it was an OS optimization all along!
Thank you!! You teached me valgrind and malloc_trim!
You are awesome!

>> No.63439647

how can i implement a way to track the progress of a loop without having a condition inside the loop?

for(size_t i =...){
foo();
if(i > goal){
adjust_goal();
update_progress();
}
}


this is what i wouldn't want because the conditional is gonna slow down my program as these loops might run tens of millions of times.

>> No.63439680

>>63439647
Nest 2 loops
in the outer loop, run the inner loop x times, then update
and inner loop runs y times to x*y = the amount of iterations

Or similar.

>> No.63439695

>>63439647
foreach(progress, thing; range)

>> No.63439698

>>63439647

if (unlikely(i > goal)) and compile with -O3

>> No.63439746

>>63436461
I want to create a strategy engine on c++. And advice?

>> No.63439750

Quick primer on hungarian notation? What are recommended names? Should I typedef dirty to char as well as prefix it with something to catch sanitization fuckups in the linter?

>> No.63439761

>>63439750
>hungarian notation
But why?

>> No.63440133
File: 99 KB, 800x770, Screen Shot 2017-11-18 at 6.51.21 PM.png [View same] [iqdb] [saucenao] [google] [report]
63440133

>>63439551
Okay after thinking about this for a while, I came up with the following:

Pre-calculate the strings of numbers up to some pre-defined limit (say, n = 400) by using option (c) and repeatedly multiplying by two.

By the time I need to convert an arbitrary array to a string, I would simply take each string and add the respective digits.

Example in pic related

>> No.63440171

>>63439184
Xlib

>> No.63440260

>>63436461
What the hell is a plist, and why does it exist in my Scheme distro? When I look it up, I only get Common Lisp resources. I can't figure out what it's actually used for either.

>> No.63440263

>>63439258
> And did you mean that UI updates should be done asynchronously? or did you really mean synchronously?

He completely did not mean that. Your UI updates should be done entirely synchronously on a single thread that no other thread has access too. Otherwise you get crappy laggy applications.

You need controllers that handle your data, and bundle it into a view model for your presented to display.

All that data generation can happen async, and it should, but when it comes time to update your UI that should be done synchronously.

>> No.63440349

>>63440260
property list.

Just a way of storing a list of properties in a serialised way

>> No.63440419

>>63432622
Forces the parameter to be available at compile time, duh. This allows it to be used in constant expressions.
This is a really useful feature that the committee needs to add already, it's not even a difficult feature.

>> No.63440436

where to learn git

>> No.63440456

>>63440263
Either you're trolling me, or you're being completely serious and I'm just seriously not getting it.

Do you have any articles or instructional videos that go in depth on what you're saying? Something that can explain why single-threaded synchronous apps would outperform multi-threaded async apps?

I've tried MVC architecture before. It seems incredibly bloated and unnecessarily complicated. Like they're just forcing you to write extra code in the name of `good design principles`.

I write my own controllers and data structures. Models are unnecessary, when all you need to do is define the relation between the data structure and the view components. It usually seems easier to just write the code yourself. Those MVC frameworks require you to write so much extra code, and they're usually complicated. And the end result is exactly the same.

>> No.63440486

>>63440436
literally just google X thing you need when it comes.
For the most part all you need are commit, push and pull

>> No.63440493

Why do people make new shitlangs?

>> No.63440508

>>63440493
Because C++ was too hard for them.
I.e. their brainlets.

>> No.63440520

>>63440493
what's considered a shitlang?
But I actually welcome every PHD student to make as many langs as they want.
You can learn something from them all whether good or bad. And one is bound to do something neat that others can steal.

>> No.63440542

>>63440520
The risk is that they escape and become popular among shitdevs who then persuade companies that everyone should use them. Python has set us back decades, and that's just one language.

>> No.63440573
File: 56 KB, 1276x720, 1510961375443.jpg [View same] [iqdb] [saucenao] [google] [report]
63440573

Good evening, /g/

>> No.63440582

>>63440542
Just out of curiosity, why has python set us back? What does it do so badly?

>> No.63440596

GNU nano 2.9.0 released

https://www.nano-editor.org/news.php

>> No.63440616

>>63440486
Not him, but git is some special case to google.
If you are not careful, or did not use some exclude-operator ( - ) in the google search
then most of the time you'll ends up to github related page.

>> No.63440636

>>63440542
You forget that most of the newlangs fail miserably . Unless you have corporate backing like Google or Mozilla, most garner little to no traction for atleast a decade. Haskell took ages to get adoption despite being pretty new and radical. The software world is largely conservative which is why fucking COBOL is still in production.

>> No.63440639

>>63440582
Dynamic typing
Cripplingly limited lambdas
Bad scoping
Inherently slow performance, the only way to make things fast is to call into a C library
GIL means no parallel threads
Limited metaprogramming facilities, which are essential if you don't have a powerful static type system capable of deriving boilerplate for you
Poor tool support stemming from dynamic types
The stupid version split

>> No.63440648

>>63440436
https://git-scm.com/book/en/v2
If you have time to read books.

>> No.63440665

>>63436461
does anybody know a way to circumvent shared libraries linked with -Bsymbolic? when linked with that flag, they resolve global names with the addresses already inside the file, preventing LD_PRELOAD tricks from working on them

>> No.63440681
File: 110 KB, 620x520, 1505676490734.jpg [View same] [iqdb] [saucenao] [google] [report]
63440681

>>63440573
evening

>> No.63440694

>>63440573
>>63440681
or morning i guess

>> No.63440703

There are no male posters in /dpt/.

>> No.63440721

>>63440703
I'm here, so you're wrong.

>> No.63440729

Do you guys recommend making a web crawler with python?

>> No.63440733

>>63440721
Then you are not male. You may have been male prior to posting, but at the moment you clicked Post you stopped being male.

>> No.63440746
File: 43 KB, 680x534, aww-pic-9-10-680x534.jpg [View same] [iqdb] [saucenao] [google] [report]
63440746

>>63440729
Can pythons crawl?

>> No.63440759

>>63440746
No they walk with their tiny legs.

>> No.63440767

>>63436503
>article
>magazines
>literally for retard consumers
>uses js for retards/easymode js

Are things adding up now?

>> No.63440788

are people here employed as programmers or hobbyists?

>> No.63440814

>>63437149
8 : <source>:8:12: error: cannot initialize return object of type 'stack *' (aka 'cons **') with an rvalue of type 'void *'
return calloc(1, sizeof(void *));
^~~~~~~~~~~~~~~~~~~~~~~~~
14 : <source>:14:18: error: cannot initialize a variable of type 'struct cons *' with an rvalue of type 'void *'
struct cons *c = malloc(sizeof(*c));

www.godbolt.org

>> No.63440832

>>63440788
yes

>> No.63440855

Employed Rust programmer here.

>> No.63440865

What it the better way to make a table in C++:
>Make a struct with multiple vectors where each vector correspondence to the data, and some logic within the struct to keep the data in all vectors aligned
or
>Make a struct with all data, and then make a vector for the struct

example of the first methode: (assume the data is an int and a string)
struct table{
std::vector<int> id;
std::vector<std::string> value;
void modify(size_t loc, int a, std::string b) { //example of the logic
id.at(loc) = a;
value.at(loc) = b;
}
};

example of the second methode:
struct Foo{
int id;
std::string value;
};
int main()
{
std::vector<Foo> foo;
//do stuff
return 0;
}


In the second methode, the alignment is easier, but the first methode locate all of the logic, and required calculation to the data in it's own struct, and allow it to be treated as a blackbox.

>> No.63440870

>>63440814
Change the command line to something like
-x c -std=c99

>> No.63440886

I have a file of text. Is there some small utility to generate a markov chain from it and use it? 1 token per line, the lines are in order.

Also, here's a small script to parse out chords from ukulele tabs:
cat *.html | grep '></span>[^<]*' --only-matching | grep '[^>]*$' --only-matching

And to parse out links to all full chords from a results page:
grep 'span class="tabtype chrd">chr</span><span class="tabnote">[^<]*</span><span class="tabpart_1"></span> <a href="[^"]*"' --only-matching |grep '../uke-songs/the-beatles/[^"]*' --only-matching | sed 's/^../https:\/\/www.ukulele-tabs.com/g'

>> No.63440900

>>63440788

uh huh

>> No.63440903

>>63440865
Well that's the old AoS vs SoA deal. It depends on your use case. If each field is not going to be treated simultaneously in a computation then you will benefit from using the first method (for example you have several unrelated components of different kinds sorted in arrays). On the other hand if you are going to do computations on all fields (e.g. a list of mathematical vectors) then go for the second.

>> No.63440951

>>63440788
Hobbyist.

My job is currently Tech Support. But I did do a web development contract once before. It wasn't a day-to-day contract. It was a one-time lump sum in exchange for a ecommerce website. I did produce the website, and made 5 grand. I didn't do the best job, but it was a good learning experience.

I'm currently working towards getting another development-oriented contract. Hopefully application development this time. Not sure if I want to do webdev again.

>> No.63441008

>>63440886
If you want to generate text it can be more fun to work in reverse and build the probability of changing to any given state for each element that you feed in. Since a markov chain is stateless this is pretty simple.

Say I want to generate an arbitrary length string of markov text from a given text. Choose a random word from the text, then search through and find every word that comes after that word and choose with a weighted dice roll based on the frequencies of the subsequent words you find. Feed the word chosen by the outcome of your dice roll back in and repeat until you have the length of output you want.

>> No.63441046

>>63440903
>If each field is not going to be treated simultaneously in a computation then you will benefit from using the first method
>if you are going to do computations on all fields then go for the second

In my case, I need to table to act as a rainbow table.
I want to use it to store the checksum from a few file, and its filename. But at a certain time, the program should be able to scan the checksum and return the corresponding filename.

If I use the first methode, then the whole table will be a blackbox, and everything going to be very simple,
also I can implement multithreading,
but if I use the second methode, it's going to be easier to sort and probably will result in faster scanning.
Which one seems better option, anon?

>> No.63441048

>>63441008
I know how to build a markov chain, I'm just wondering whether there's some quick perl script that already exists so I won't have to implement it.

>> No.63441076

>>63441048

reinvent the wheel, anon

>> No.63441132

selling million dollar idea

>> No.63441168
File: 349 KB, 581x499, 1490238756909.png [View same] [iqdb] [saucenao] [google] [report]
63441168

Wait a second.
Did Scott Meyers just say, "there is a website called BLACKED.com or whatever"?
https://www.youtube.com/watch?v=Lo6Q2vB9AAg at 34:04
LMAO

>> No.63441173

>>63441132
I'll buy it for $0.

>> No.63441179

>>63441168
What context?

>> No.63441189

>reading through templeos website
>suddenly start feeling how it all makes sense

>> No.63441206

>>63441179
C's popularity.
SM says that blacked.com lists open source projects and C is the most popular
Walter Bright argues that if BASIC dies C can die too.
Andrei says C didn't die because there had been no real alternative to C

>> No.63441212

>>63441189
HolyC is a shit language, fuck you and fuck terry.

>> No.63441233

>>63441212
He's right about a lot of stuff.
Mom taught preschool. She said the kids would color with crayons. Then, put
black crayon all over the top of the drawing. She speculated that the black
crayon felt powerful to them and was fun to use.

She did not like sending home ugly black-colored scribbles, so she started
collecting all the black crayons before having them do coloring.

You can see how Wolfenstein and Battlezone got turned into awful games with
story-lines no one enjoys. Game designers feel they must tell a story, once
they get high color and memory.

>> No.63441248

>>63441233
I-I actually enjoyed the modern wolfenstein games. Yeah the stories got retarded by fighting fraken-nazi monster is still fun.

>> No.63441275

>>63441168
Seek mental help.
https://www.blackducksoftware.com/top-open-source-languages

>> No.63441298

>>63441248
That's besides the point.

>> No.63441328
File: 292 KB, 2560x1400, koancode.png [View same] [iqdb] [saucenao] [google] [report]
63441328

>>63436461
Having a fun time learning ruby.

>> No.63441329

>>63441298
DOOM had a fucking story nobody ever read, nobody cares. Doesn't make it bad game, it was text then and now it's cutscenes and god-awful first-person unskipable walking simulation but the gameplay is still there.

>> No.63441377
File: 254 KB, 796x1664, Screenshot-2017-11-19 Top Open Source Languages Black Duck Software.png [View same] [iqdb] [saucenao] [google] [report]
63441377

>>63441275
Looks like Walter wasn't wrong after all.

>> No.63441386

>VSC finally has a vertical terminal
wew lads, it's on now.

>> No.63441390

>>63441329
You're still missing the point. When game designers were constrained by resources (doom, quake), they produced good games since they were mindful of were they put them. Now they can just smear black crayon all over and call it a day as long as it runs at 30 fps on some godawful console.

>> No.63441399

>>63441377
Walter is very intelligent, and my programming senpai.

>> No.63441422
File: 155 KB, 1250x1120, 1484841861137.png [View same] [iqdb] [saucenao] [google] [report]
63441422

>>63441275
>>63441377
>trusting some literally who company
RedMonk is the most reliable, as they use robust methods which are hard to fuck up. The closer to the line, the more accurate the prognosis is expected to be.

>> No.63441450
File: 74 KB, 1095x1281, 1499262685980.png [View same] [iqdb] [saucenao] [google] [report]
63441450

>>63441422
>robust methods which are hard to fuck up.
Like counting pull requests? I think we went through that, bro.

>> No.63441457

>>63441422
>Racket that high
doubt

>> No.63441463

>>63441390
So what are you saying that every program should be developed with 64k in mind? When your target isn't some faggots toaster you can get lazy with programming.

Load a library, who gives a fuck how fast it is. It's not a bottleneck.

Concentrate where you need to because there's a lot more shit in this program than there was in quake and you'll never learn it all.

Software shouldn't be something you optimize to perfection, you abstract it so that you can concentrate on something higher level than PCM.

>> No.63441465

>>63441422
No, that's an incorrect way of reading the graph.
above the line - languages people have to use but don't want to (dying languages)
below the line - languages people want to use but don't get any jobs in (functional languages)
around the line - languages that have a steady niche and are not going anywhere

>> No.63441472

>>63439220
I hate Swing in general, but I wish I could use GroupLayouts for everything. The amount of ways GUI libraries fail at simple, but dynamic rectilinear layouts baffles me.

>> No.63441480

>>63441465
>Haskell bang on the line
I think that disproves your theory.

>> No.63441500

>>63441480
Haskell's pretty popular nowadays and actually has a fair bit of use globally at actual companies.

>> No.63441517
File: 170 KB, 800x420, 1480061307352.jpg [View same] [iqdb] [saucenao] [google] [report]
63441517

>>63441450
>mfw javascript and python """""""developers"""""" will get btfo by the coming crash
>mfw the developers who will get btfo will be javascript and python """""""developers"""""", and won't produce anything useful out of rage (see: bitcoin)
have mixed feelings about this lads
>>63441463
No, that's not what I'm saying. I'm saying that when the game designers had limited resources, they made better games. How many games when resources were actually an issue were ground-breaking? A lot, especially during the golden era of the 90's and early 00's. How many games today will be fondly remembered and played in 10 years? In 20 years? Will Overwatch be? Hell no, it's already dying, look at the google search terms graph. Will pubg be? Will any game be as long-lived as, say, quake3 or cs1.6? No, since they simply aren't as good. They're shitting out absolute garbage nowadays.

So what I'm saying is that technology was a mistake. Wrong Ted, but you get the idea.

>> No.63441524

>>63441328
ruby koans is comfy as fuck

>> No.63441525
File: 68 KB, 782x434, Screen Shot 2017-11-18 at 8.52.35 PM.png [View same] [iqdb] [saucenao] [google] [report]
63441525

Trying to re-learn the OOP aspects of Sepples, specifically how to make good interfaces for the rest of my code.

I have a small question: Why does the assignment operator return a reference to the object you're returning and what does the copy constructor return? Does it return a reference to the object you created?

>> No.63441535

>>63441517
>the coming crash
?

>> No.63441546

>>63441517
No ones getting btfo. Python will just get slowly replaced by proper langs. And JS backend stuff will get rewritten in pure functional stuff so no body needs to worry about RTEs. It will still have a prominent front-end role though, unfortunately.

>> No.63441550

>>63441450
>by opened pull requests
that's gay. it should count only used pull requests.
this is counting shitty patches that get rejected which inflates simpler languages that likely have less experienced and professional devs
>>63441465
more like
>above
hassle to use with weird gotchas you've gotta look up
>below
intuitive, simple, or at least small enough you can know all its quirks

D, assembly, and scheme end up where I expect them to using that description

>> No.63441558

>>63441480
Haskell - used in companies for muh reliability, people also like it (equilibrium)
c#, R, Matlab, VB - used in companies/academia but people dislike it (programmer's advantage)
Ruby, Go, Rust - people like it more than their employers do (employer's advantage)

>> No.63441609
File: 56 KB, 698x432, 1485672729327.png [View same] [iqdb] [saucenao] [google] [report]
63441609

>>63441535
There is a crash coming. The housing bubbles in several European countries and all around the world are popping. The low interest rates cannot continue on forever. The "bull trap" was in 2015. It's like the US 2008 crisis, but this time it's global. We're at "return to normal" right now, look at a graph of your country's stock market (including dividends) and you'll see how it matches up. Especially for European countries.
>>63441546
When companies need to fire people, who do you think goes first? Our vegan "code artisan" friends aren't exactly in the best position.

>> No.63441614

>changed spring boot's logging behavior
>all logs are now grouped by request instead of having a long spaghetti-stream, even across threads

Those are deep system changes and yet barely any actual code was needed

OOP is magic and superior to all other paradigms, fight me bitches

>> No.63441629

>>63441609
Absolutely >>>/biz/, fag

>> No.63441636

>>63441550
So PHP has no gotchas, R and Matlab are hard to use, TeX is dead simple, XML is extremely hard? What?

>> No.63441651

>>63441609
>who do you think goes first?
People that are the least popular.
The day software becomes a meritocracy is the day the whole world does.

>> No.63441652

>>63441629
/biz/ are too busy with their cryptocurrencies. Does it bother the vegan code artisan that the ballast will get dumped in tougher times?

>> No.63441657

>>63441614
So naive. You actually think there are OTHER paradigms? You spend too much time on /g/.

>> No.63441677

>>63441535
the world's a-changin'
the fate of empires is an excellent essay. go read it
it predicts that large, globally powerful, long lived empires don't last longer than ~250 years (from outset to having declined to as strong as other countries)
if it's right, america's due, it hits 250 years old in 2026

granted the essay counts the roman republic, the roman empire, and the byzantine empire three separate great empires, which is debatable. although, even if you count them as the same entity, tings did still shake up pretty hard around the 230-280 year mark

>> No.63441680

>>63441651
And who is the most popular? The diversity hires fresh out of university who haven't learned jack shit thanks to its dumbing down or the "Cniles" who've been with the company for 20 years?

>> No.63441681

>>63441614
>OOP is magic and superior to all other paradigms, fight me bitches
OOP has set us back by two decades. Serious FP existed in the 80s and it's only now being rediscovered by industry.

>> No.63441707

>>63441680
Whoever knows how to kiss ass and be a yes man without being an obvious yes man. And can maintain atleast a level of mediocrity so they still seem useful.

>> No.63441715

>>63441677
It's entirely possible that the US could avoid that though, as there is a counter-reaction to the degeneracy right now. But there will still be a market crash now, which is however a good thing in the long run, as it's a catalyst for the counter-reaction (see also : 2008 and how pissed off people were, rage which was channeled into great inventions, 2000/dotcom crash and the exact same thing there but with webshit)

The pendulum is swinging.

>> No.63441732
File: 258 KB, 1280x1005, 1496033288070.jpg [View same] [iqdb] [saucenao] [google] [report]
63441732

>>63441707
Are we implying our pink-haired friends are any good at this?

>> No.63441733

>>63441636
>R and Matlab are hard to use, TeX is dead simple, XML is extremely hard
for the people usingt them, probably

matlab and r are used mostly by math, statistic, and science majors who don't know shit about programming
tex isn't used by anyone that hasn't already been using it forever (outside of people forced to use it)
xml probably gets a lot of people trying to stumble their way through without actually understanding what they're doing

that + most matlab, r, and xml that gets written probably isn't committed anywhere

>> No.63441735

>>63441707
Your world view is twisted. Nobody with a slight bit of self respect likes a kiss ass.

>> No.63441756
File: 91 KB, 593x578, 1507166656245.jpg [View same] [iqdb] [saucenao] [google] [report]
63441756

>tfw no modern imperative language, where the only control flow constructs are static goto and pointer goto

>> No.63441758
File: 28 KB, 470x418, 20374223.jpg [View same] [iqdb] [saucenao] [google] [report]
63441758

>>63441732
Yes

>> No.63441764

>>63441732
The pink menace are a mixed bag. Some can read their environment and realize they need to take it slow. And others, yes, have no self-awareness and often have no real skills on top of that.
>>63441735
Note where I said, being one, without making the person realize you are one.

>> No.63441766

>>63441756
Write your shitpost lang yourself you lazy cunt.

>> No.63441773

>>63441681
FP existed in the 30s

>> No.63441774

>>63441609

People have been saying a crash is coming for 10 years straight now.

>> No.63441786
File: 72 KB, 864x670, Screenshot from 2017-11-19 15-12-46.png [View same] [iqdb] [saucenao] [google] [report]
63441786

>>63441550
>this is counting shitty patches that get rejected which inflates simpler languages that likely have less experienced and professional devs
Push

>> No.63441789

>f(o) is superior to o.f()

The entire OOP vs FP """debate""" is literally religion

>> No.63441792

>>63441715
>as there is a counter-reaction to the degeneracy right now. But there will still be a market crash now, which is however a good thing in the long run, as it's a catalyst for the counter-reaction
you only succeed in pointing out what internal strife is building in america
all empires fall due to problems within, not without.
best case scenario, america walks away VERY different than as it is now, a roman republic -> roman empire style change

>> No.63441799

>>63441789
It matters not if you have UFCS

>> No.63441800

>>63441789
o.f is easier to read at a glance.

>> No.63441809

>>63441789
person.print(name)

OOP makes the perfect sense

>> No.63441814

>>63441789
f o

>> No.63441815

>>63441786
note how it looks significantly better

>> No.63441826

>>63441815
>1. JS at 22%
>7. C 4%
"good"
A desperate man catches at the straws.

>> No.63441829

>>63441789
>>f(o) is superior to o.f()
But that doesn't account for runtime polymorphism.
The point of o.f() is that o decides what f() means. Otherwise, f() has to be updated every time a new implementation comes around.

>> No.63441843

>>63441826
better that than the other chart

i only said this was better, not that it was for the best

>> No.63441864

>>63436696
The issue is with the last two lines.
this.add(menuColumn.add(burger));
this.add(menuColumn.add(fries));


should be

menuColumn.add(burger);
menuColumn.add(fries);
this.add(menuColumn);


add() returns it's argument, so in those last two lines, you are adding `burger` and `fries` to `this`, instead of adding `menuColumn`

>> No.63441899

>>63441864
this.add(menuColumn.add(burger).add(fries);

>> No.63441904

>>63441829
don't functional languages resolve this by handling data very weakly typed/ untyped, so that it's rare that a function needs to be re-written for a different type?
if they were bad at this, we'd have strongly typed functional languages by now

>inb4 typed racket
no one uses that, it's just there to sate the autism of people who hate untyped langs as a principle

>> No.63441933

>>63441899
this looks gross
also you forgot a )
also nice dubs

>> No.63441947
File: 153 KB, 645x968, 1510485478283.jpg [View same] [iqdb] [saucenao] [google] [report]
63441947

>he can't relate very connective of linear logic to programming

>> No.63441952

>>63441904
Usually in Haskell that kind of polymorphism is achieved using typeclasses. E.g. write functions that accept types with a Foldable instance, instead of functions that accept lists explicitly.

>> No.63441953

>>63441756
>modern imperative language
>where the only control flow constructs are static goto and pointer goto
???
but then it wouldn't be modern, now would it

>> No.63441961
File: 9 KB, 215x215, 88a.png [View same] [iqdb] [saucenao] [google] [report]
63441961

>>63436793
>he fell for it
at least you're "normal"

good goy

>> No.63441962

>>63441953
I'm guessing he also wants it to have a good type system.

>> No.63441989

>>63436793
>a 9k a year learning institute
u a euro?

>> No.63441990

Is it possible to average two numbers in C?

>> No.63442003

>>63441990
why wouldn't it be?

>> No.63442012

>>63441989
no, probably a brit

>> No.63442016

I think I just found a viable, far more functional alternative to Rust's mutation and borrowing.

>> No.63442017

Why in the hell is Perl so fucking slow to get a list of files with a given extension compared to fucking PYTHON??

This takes over a minute when python can do it in 10 seconds to find ~3000 video files in subdirectories.

use strict;
use warnings;
use File::Find;

my $DIR = "";
my $find_files_extension = qr"";
my @video_files = [];

my $file_types = shift;

if ($file_types eq "-v"){
$DIR = "D:/4chan_Downloader/X";
$find_files_extension = qr"\.(mp4|m4v|mkv|flv|mpg|3gp|avi|wmv)$";
}

if ($file_types eq "-w"){
$DIR = "D:/4chan_Downloader/gif";
$find_files_extension = qr"\.(webm)$";
}

sub find_files {
my $F = $File::Find::name;

if ($F =~ $find_files_extension ) {
push @video_files, "$F\n";
}

find({ wanted => \&find_files, no_chdir=>1}, $DIR);

>> No.63442020

>>63442003
post solution please

>> No.63442030

>>63442020
how do you expect to program if you can problem solve
im not gonna spoonfeed you, not for something this simple

>> No.63442051

Dependent types are interesting.
data Val : Type where
V_int : Int -> Val
V_tru : Val
V_fls : Val

data Exp : Type where
E_cst : Val -> Exp -- constant
E_add : Exp -> Exp -> Exp -- e1 + e2
E_les : Exp -> Exp -> Exp -- e1 < e2
E_if : Exp -> Exp -> Exp -> Exp -- if e0 then e1 else e2

data Typ : Type where
T_int : Typ
T_bool : Typ

{- declarative eval rules --------------------------------------------------}

infixr 10 ~~>
data (~~>) : Exp -> Val -> Type where
Ev_cst : (E_cst v ~~> v)
Ev_add : (e1 ~~> V_int n) -> (e2 ~~> V_int m) -> (E_add e1 e2 ~~> V_int (n + m))
Ev_les : (e1 ~~> V_int n) -> (e2 ~~> V_int m) -> (E_les e1 e2 ~~> cmp n m)
Ev_iftru : (e0 ~~> V_tru) -> (e1 ~~> v1) -> (E_if e0 e1 e2 ~~> v1)
Ev_iffls : (e0 ~~> V_fls) -> (e2 ~~> v2) -> (E_if e0 e1 e2 ~~> v2)

{- declarative typing rules ------------------------------------------------}

infixr 10 ~:
data (~:) : Exp -> Typ -> Type where
TC_cst : (typeof v = t) -> (E_cst v ~: t)
TC_add : (e1 ~: T_int) -> (e2 ~: T_int) -> (E_add e1 e2 ~: T_int)
TC_les : (e1 ~: T_int) -> (e2 ~: T_int) -> (E_les e1 e2 ~: T_bool)
TC_if : (e0 ~: T_bool) -> (e1 ~: t) -> (e2 ~: t) -> (E_if e0 e1 e2 ~: t)


>>63442016
Do elaborate

>> No.63442057

It's sunday and I'm looking for a challenging / problem solving requiring project. Here are my ideas;
- POSIX layer for sel4 kernel
- Erlang WebRTC signalling server
- Node spambot for an insecure forum I know

Give me some project ideas that I can do preferably in Erlang, C or JS.

>> No.63442060

>>63442017
Too much regex.

>> No.63442062

>>63442016
you gonna spill the beans bro, or just keep us in supense

>> No.63442072

>>63442051
Go to bed Edwin

>> No.63442075

>>63442030
>im not gonna spoonfeed you, not for something this simple
But no one in /g/ has been able to average two numbers in C to this date

>> No.63442083

>>63442075
what, why not?

>> No.63442089

>>63442051
>>63442062
I can't elaborate much yet as I'm still hashing it out excitedly. But I believe it elegantly supports dependent types and mutation and has beautiful mathematical properties. It's based on linear type theory.

>> No.63442100

>>63442083
>being this new

>> No.63442101

>>63442051
You the ^ pointer dev?

>> No.63442104

>>63442051
cont.
typeof : Val -> Typ
typeof (V_int _) = T_int
typeof V_tru = T_bool
typeof V_fls = T_bool

cmp : Int -> Int -> Val
cmp n m = if n < m then V_tru else V_fls

{- type soundness proof -----------------------------------------------------}

sound : (e : Exp) -> (e ~: t) -> (e ~~> v) -> (typeof v = t)
sound (E_cst _) (TC_cst prf) Ev_cst = prf
sound (E_add _ _) (TC_add _ _) (Ev_add _ _) = Refl
sound (E_les _ _) (TC_les _ _) (Ev_les {n} {m} _ _) with(n < m)
| True = Refl
| False = Refl
sound (E_if _ e1 _) (TC_if _ tc1 _) (Ev_iftru _ ev1) = sound e1 tc1 ev1
sound (E_if _ _ e2) (TC_if _ _ tc2) (Ev_iffls _ ev2) = sound e2 tc2 ev2

>> No.63442120

>>63442100
not very new at all desu, not when you consider the site's user-base has more than doubled within the past ~2 years
been around since '14
never heard this meme before

>> No.63442126

>>63442083
>why not?
/g/ just can't. Why don't you try, anon?

>> No.63442128

next: >>63442124

>> No.63442131

>>63442104
What are ~~> and ~:

>> No.63442134

>>63442104
I mean it Edwin, go to bed

>> No.63442140

>>63442089
After spending all summer studying linear types, I believe that Rust does everything very well, its just that such a constrained type system is always going to be a pain to use.
It would be much nicer if they weren't trying so hard to escape a GC. Linear types are more comfortable when you allow any immutable data to be an unrestricted type, which escapes the need for borrowing in a lot of cases.

>> No.63442144

>>63442120
>not very new at all desu
>been around since '14
fuck off back to wherever you came from.

>> No.63442162

>>63442144
why
and I'm not from anyother site. never was very interested in forums, social media, etc
before 4chan I was nowhere

>> No.63442171

>>63442131
(e ~: t) means e has type t
(e ~~> v) means e evaluates to value v

I also defined a some lengthy functions to actually perform typechecking or evaluation

infer : (e : Exp) -> Maybe (t : Typ ** (e ~: t))
eval : (e : Exp) -> (e ~: t) -> (v : Val ** (e ~~> v))


(note ** is dependent product)

This was an interesting exercise, but the language I made was far too simple. I'm trying to add variables and a context, but the substitution lemma is difficult for me to formulate in Idris, much less prove.

>>63442101
Haven't heard of it.

>> No.63442195

>>63442060

how 2 fix?

>> No.63442215

>>63442195
more regex

>> No.63443018

>>63442195
Maybe you could write a regex script to fix the excessive regex.

>> No.63443353

>>63442017
>perl
you've managed to find an even more detestable language than python

>> No.63443566

>>63442075

>two numbers
Last time the question was asked, it was average two ints. When you say "average two numbers", please qualify what you consider to be a number.

>> No.63443660
File: 325 KB, 640x426, jebNo!.png [View same] [iqdb] [saucenao] [google] [report]
63443660

>>63436696

> this.add(menuColumn.add(burger));
> this.add(menuColumn.add(fries));

My fucking eyes! What is this horrendous code format. Two things on one line that are separate ideas? HERESY! PURGE THE HERETIC!

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
reCAPTCHA
Action