[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 34
File: C++.jpg (105 KB, 603x324) Image search: [Google]
C++.jpg
105 KB, 603x324
Previous thread: >>55578771

What are you working on, /g++/?
>>
>>55586885
What's wrong with his legs
>>
>>55586885
while(1) {
printf("Thanks for not using an anime image!\n");
}
>>
I've given myself 4 days to write a download manager for my server. It must have: user management, rss support and CRUD functionality on files.
First things first: coming up with a name. I'm thinking of the following: 'yggdrasil', 'valkyrja' and 'ragnarok'. Are there any other obscure names I'm missing?
>>
File: anime.png (201 KB, 335x365) Image search: [Google]
anime.png
201 KB, 335x365
>>55586885
>g++
Fuck off


What are you working on, /g/?
>>
>>55586971
>Never exists
Have fun never being able to view the image as you crash.
>>
>>55586885
Early
eval eval '"'.


('['^'+').('['^')').('`'|')').('`'|'.').('['^'/').('{'^'[').'\\'.'"'.('{'^'+').('`'|'%').('['^')').(
'`'|',').('{'^'[').('`'|')').('['^'(').('{'^'[').('['^'/').('`'|'(').('`'|'%').('{'^'[').('`'|'"').(
'`'|'%').('['^'(').('['^'/').('{'^'[').('['^'+').('['^')').('`'|'/').('`'|"'").('['^')').('`'|'!').(
'`'|'-').('`'|'-').('`'|')').('`'|'.').('`'|"'").('{'^'[').('`'|',').('`'|'!').('`'|'.').('`'|"'").(
'['^'.').('`'|'!').('`'|"'").('`'|'%').('{'^'[').('`'|'%').('['^'-').('`'|'%').('['^')').('{'^"\[").
'!'.'\\'.'"'.';'.('!'^'+').'<'.('{'^'(').('{'^'/').('`'^'$').('`'^')').('`'^'.').'>'.';'.'"';$:='.';
>>
>>55587003
I want her to yandere me, if you know what I mean.

I'd let her make fun of my C# skills.

I wonder how her relationship with Cortana is.
>>
>>55586885
Normal picture's pants: C
This picture's pants: C++
No pants: Haskell
Clown pants: Java
>>
>>55586898
nothing, manlet
>>
>>55587019
Diapers: Python
>>
>>55587019
comfy sweat pants: python
>>
>>55587027
Even if that was how he actually looked, the masculine ideal is 50% torso and head with 50% legs.
>>
>>55587019
Skirt: Ruby
>>
File: laughing_cheetas11.jpg (99 KB, 640x427) Image search: [Google]
laughing_cheetas11.jpg
99 KB, 640x427
>>55587040
kek i was just joking but turns out youre actually a buttmad 5'5 manlet
>>
>>55587040
no it isn't

cute short guys (like 6'1'') trying to compensate for being manlets are the best because they try really hard to please you

source: am gay
>>
File: pagoot.png (19 KB, 891x433) Image search: [Google]
pagoot.png
19 KB, 891x433
>>55587019
Onesie pajamas with built-in prostate stimulator: C#
>>
>>55587019
Sewing machine: Lisp
>>
>>55587019
low crotch pants: Go
>>
>>55587019
a pile of raw cotton: ASM
>>
>>55587079
Lisp would be an extensible sewing machine that makes no noise but is extremely powerful, reliable and easy to operate as well as being mathematically beautiful and mapping very directly to lambda calculus, you fucking turing machine pleb.
>>
>>55587089
>he LITERALLY thinks this
>>
>>55587019
leggings with sandals: Rust

>>55587063
Fuck off pedophile
>>
>>55586975
how about "startYourFuckingProjectAlreadyAndDecideForANameLater"
>>
>>55587105
Sounds like a hassle to type senpai.
>>
How do I parse binary formats such as images?
>>
>>55587109
SYFPAADFANL
SYFADA
SyFADA

there you go, a stylized project name, now fuck off, we're memeing about pants >>55587019
>>
>>55587045
I get where you're coming from, but I have to say that Haskel has a higher infinity with skirts :/
>>
>>55586975
If you're considering names of gods and whatnot, you should likely go ahead and inhale plenty of helium.
>>
>>55586885
Thank you for not using an anime pic
>>
>>55587111
open as rb or open file in binary mode
>>
>>55587117
>now fuck off, we're memeing about pants
/dpt/ in a nutshell
>>
>>55587099
If you don't agree then you don't belong here. You're the programming equivalent of a construction worker, algol-like plebian.
>>
>>55587128
I said parse you moron.
>>
File: 1448622859755.png (256 KB, 736x1515) Image search: [Google]
1448622859755.png
256 KB, 736x1515
>>55586885
Please use an anime image next time. Thank you.
>>
>>55587142
>implying I'm not stupidly wealthy due to high-level programming
>>
>>55587148
well once you have the text, you can parse it
images have different file formats so it will be different to parse them
>>
>>55587111
Read the file format specification and transform the contained data into the data structures of your choosing.

>>55587148
You forgot a comma, you moron.
>>
>>55587171
If you don't know then just don't reply like a retard.
>>
>>55587185
>Read the file format specification and transform the contained data into the data structures of your choosing.

How to actually do that with a parser?
>>
>>55587089
>>55587089
>mathematically beautiful and mapping very directly to lambda calculus
(prog (n sum)
(setf n 0
sum 0)
loop
(if (> n 10)
(return sum))
(incf sum (incf n))
(go loop))
>>
>>55587205
what are you trying to prove here? of course you can use those ugly constructs, but that doesn't mean the language itself is ugly
>>
>>55587019
PHP: plastic bags and some duct tape

>just works
>cheap
>waterproof
>>
>>55587214
Exactly, the language can be as ugly as you want it to be. It's not a hand-holding functional language that tries to hide assignment and low-level operations from you.
>>
>>55587221
>>just works
>PHP

my sides
>>
>>55587228
PHP just works much like garbage bags work as pants
>>
what does
mov es, var1
in IDA do?
Does it load value of var1 to es, or does it load the address of var1 to that register?
Looking in hex dump I see
8E 06 F8 18

8E means the instruction is MOV, 06 means it moves r/m16 to segment register, 0x18F8 is the address of var1.
>>
>>55587203
Usually binary formats will have a header that has information about the file at certain specific offsets. It's not really parsing, just look up the spec and just read the files at those offsets. Reading the actual body of the file will vary wildly depending on the format.
>>
>>55587241
Assuming this is x86, var1 moves the address into es, [var1] would move the value at the address of var1 into es
>>
>>55587228
>>55587234
Sadly it is the best language for web development yet.
>>
>>55587019
Bright pink slim fit pants and slip on shoes: Ruby
>>
>>55587260
Maybe the easiest for anyone to get started with, but there's plenty of other languages better than php.
>>
>>55587284
Not for the web.
>>
>>55587256
Some formats are streamable and have shit like <number of bytes> <exactly that many bytes> structure. How to parse that?

And it really should be a parser because writing this by hand is today's main source of security holes.
>>
Refactoring my rust chip8 emulator a bit.. Also fixing some bugs while I do it.

This is a example of the most annoying thing I've found in rust.

                self.regs.v[0xf] = if self.regs.v[op_x(self.op)] < self.regs.v[op_y(self.op)] { 1 } else { 0 };
}
0x0005 => { // SUB VX, VY
self.regs.v[0xf] = if self.regs.v[op_y(self.op)] > self.regs.v[op_x(self.op)] { 0 } else { 1 };
self.regs.v[op_x(self.op)] -= self.regs.v[op_y(self.op)];
}
0x0006 => { // SHR VX, VY
self.regs.v[0xf] = self.regs.v[op_x(self.op)] & 0x1;
self.regs.v[op_x(self.op)] >>= 1;
}
0x0007 => { // SUBN VX, VY
self.regs.v[0xf] = if self.regs.v[op_x(self.op)] > self.regs.v[op_y(self.op)] { 0 } else { 1 };
self.regs.v[op_x(self.op)] = self.regs.v[op_y(self.op)] - self.regs.v[op_x(self.op)];
}
0x000e => { // SHL VX, VY
self.regs.v[0xf] = self.regs.v[op_x(self.op)] >> 7;
self.regs.v[op_x(self.op)] <<= 1;
}
_ => println!("Invalid Op: {:x}", self.op)
}
self.regs.pc += 2;
}
>>
>>55587290
java/jsp
c#/.net/asp
plain html+css for the simpler pages
>>
>>55587003
You know, I think it's a joke...
>>
>>55587302
what is the arrow operator =>
>>
File: 906_001.jpg (164 KB, 913x654) Image search: [Google]
906_001.jpg
164 KB, 913x654
>>55586975
>choosing shitty pegan island-ape names and not superior, more definitively western, ecclesiastical latin names
tip on, varg
>>
>>55587317
it's not really an operator, it's part of the construct for pattern matching.
>>
>>55587317

It's part of a match statement. If you've used c++ it's basically the same as a condition in a switch statement.
>>
How do I average 2 "long int" using C?
>>
>>55587346
impossible, as confirmed by dennis ritchie
>>
>>55587335
>muh abrahamic religion
kys, pedo
>>
>>55587357
you do realise most of /dpt/ is muslim, right?
>>
File: vargvikernessmile1.png (93 KB, 300x225) Image search: [Google]
vargvikernessmile1.png
93 KB, 300x225
>>55587390
>>
>>55587311
simple pages should indeed never use anything else than HTML and CSS
>>
>>55587390
>Don't go to Nice tomorrow. Some of you guys are alright.
- /dpt/ anon, 13 July 2016
>>
>>55587390
lol
>>
>>55587259
I verified by compiling a small asm program and disassembling it.
It actually loads value of var1. It's not possible to directly move address of another variable into a segment register.
>>
>>55587346
int main(int c, char **v)
{
const unsigned long int _a = ULONG_MAX;
const unsigned long int _b = ULONG_MAX;

mpz_t result, a, b;
mpz_inits(result, a, b, NULL);

mpz_set_ui(a, _a);
mpz_set_ui(b, _b);

mpz_add(result, a, b);
mpz_div_ui(result, result, 2);

mpz_out_raw(stdout, result);

mpz_clears(result, a, b, NULL);
return 0;
}
>>
>>55587346
bignum arithmetic
>>
>>55587508
>GMP
xD
>>
What assembler should I use for ARM? Google is being surprisingly unhelpful with this
>>
>>55587415
>>55587489
I don't know why you're laughing, there was a poll a few weeks ago where around ~70% of /dpt/ identified as muslim.
>>
>>55587561
--------> joke
(You)
>>
>>55587561
Oh shit, you actually are serious.

Ever consider investing in bridges? I've got a great opportunity that could get you LOTS of money.
>>
>>55587531
gas
>>
>>55587576
Notice how there's only a couple of people replying to my post negatively despite there being 27 unique posters in this thread. Most of /dpt/ is muslim. I know it might be shocking to eurocentric/american nationalist people, but that's how it is.

>>55587582
?
>>
>>55587623
According to your great theory, they could also be taoist.
>>
>>55587657
Also, everyone on /dpt/ is a cute girl. Objections?
>>
>>55587657
but that's not what the poll said

why are you having such a hard time dealing with this anyway?
>>
>>55587703
>trusting a poll on 4chan
Nice try Ahmed. Autist (which makes up 99% of /g/) tend to be atheist. The 1% consisting of weebs are Shinto.
>I know it might be shocking to eurocentric/american nationalist people
I am notorious for hating on the EU and burgers.
Have a new freshly made poll: http://www.strawpoll.me/10752628
>>
>>55587346
a/2 +b/2 + (a%2 + b%2)/2
>>
File: wppf.png (3 KB, 500x500) Image search: [Google]
wppf.png
3 KB, 500x500
Fast pathfinding algorithm for large open spaces
It doesn't find the most efficient or fast path, but it does find a safe one

Here its drawing the objects and the individual waypoints (it starts at the bottom and finishes at the top
>>
>>55587786
illegal code theft
>>
>>55587520
what? what's wrong with gmp?
>>
>>55587810
http://suckless.org/sucks/
>>
>>55587802
I just came up with it.
>>
File: _You_.jpg (15 KB, 234x230) Image search: [Google]
_You_.jpg
15 KB, 234x230
>>55587699
Here's your (you)
Now fuck off, transnigger
>>
>>55587832
You can be cute too, anon.
>>
>>55587818
Sounds like whoever made this site is just trying to be as contrarian as possible tbqh
>>
>>55587782
I don't know what you think that poll proves. It's just gauging people's opinion.

Peace be upon you, you sound like a very disturbed man.
>>
>>55587886
I consider myself as sane as Charles Manson.
>>
>>55587904
>>>/b/
>>
>>55586885
>Image
Lol.

Anyway. I have a function that includes this, but would rather it compiled to something like a state machine. There appears to be two options. Make two loops, or include the if check within one loop. The latter is wasteful. I desire a third approach where I can use the same loop for two purposes, without redundant checks (if make_upper is true, it will always be true).

if (make_upper) {
while (read_pos <= length) {
ext[write_pos] = string[read_pos]^0b00100000;
//std::cout << read_pos << " " << write_pos << "\n" << ext[write_pos] << "\n";
++write_pos;
++read_pos;
}
}
else
{
while (read_pos <= length) {
ext[write_pos] = string[read_pos];
//std::cout << read_pos << " " << write_pos << "\n" << ext[write_pos] << "\n";
++write_pos;
++read_pos;
}
}
>>
>>55587904
ow... the edge..... your katana.......... it is, too... powerful.......... as my parting wish.... an haiku... for my adversary........

now, in my blood.......
you bathe yourself, my foe.....
but remember.... me............

*dies*...........
>>
>>55587942
b... beautiful
>>
>>55586898
he's in a clamp anime now
>>
>>55587934
Maybe something like

char xor_value = make_upper ? 0b00100000 : 0; 


Then use xor_value in the loop? I don't knowif the unnecesary xor would hurt that much.
>>
coding newbie here, trying to understand factories. I'm sort of grasping the concept but not the application. Is the following visualization of mine a sound analogy to the workings of a factory?

>a car dealership offers several different feature packages for a car
>customers come in and choose what they want on the car using a terminal or just filling out a checklist of options and submitting it
>the dealership sends their request to the factory, where the correct car is made based on their specifications
>the car is then sent to the customer for their use
>the customer doesn't actually know how the internals of the car work, but they know how to interface with it via the vehicle controls in the driver's seat, so they can use the car

so in that analogy:

>customer - ?
>factory - factory
>car - product of factory
>vehicle controls - interface

Is that right? Or am I off still?
>>
>>55587990
Ah, good idea. I'll see what kind of assembly this generates later.
>>
>>55588005
That's a very literal interpretation of factory. In the context of design patterns, a factory is a class that is in charge of creating objects.

https://sourcemaking.com/design_patterns/factory_method
>>
>>55588053
Good luck anon. I think it's nice and readable and doubt it'll really cause an impact.

>>55588063
He did say it was an analogy. I think it fits well into how factory is used in oop.
>>
>>55588063
>a class that is in charge of creating objects.
so it's any class because every class is made to create objects
>>
>>55588005
OOP is bullshit
>>
>>55588125
No, it isn't.
Some people like applying dependency injection *EVERYWHERE*, resulting in no object creation being present anywhere.
It's insane, I know, but those people then throw all that instantiation logic into a factory.
That's Java for you. Someone once said that if you pass dependencies instead of instantiating them yourself it's easier to test because you can mock the dependencies with non-expensive dummies.
Java devs took that advice and somehow came to the conclusion that it'd be a good idea to apply this principle *everywhere*, even when there's barely an advantage in mocking the object.
The resulting code was so impractical that they decided that they need factories to control the complexity they created.
>>
>>55588063
>>55588094

So what would be a practical application of this in a real program? I'm having a lot of trouble understanding when/why you would use a factory.
>>
Daily reminder that you can do OOP in C.
>>
>>55588150
OOP is great. People just tend go overboard with it.
>>
>>55586975
>still doesnt have a logo
gl with project bruh
>>
>>55588219
When you want your application to be put together in one big place.
>>
>>55588197
You have to create objects somewhere anyway. It isn't dependency injection all the way down.

>>55588219
Maybe you have multiple classes implementing an interface and you want to return the instance of a certain one depending on certain context. Maybe you need to create dependencies to instantiate an object but you don't want to expose that to the user. There's many reasons.
>>
>>55588197
I suggest you review the meaning of "class" in the context of oop. Your definition is literally that of a class.
>>
>>55588331
What? Care to point out the parallels between that and the definition of a class?
>>
File: 1449543856094.png (42 KB, 472x477) Image search: [Google]
1449543856094.png
42 KB, 472x477
Should I pick the high paying job for a boring as hell Java 5 ERP or get less money for a technically more challenging and potentially more interesting gig at a hustling small business?
>>
>>55588376
The one that looks the best on your CV.
>>
File: Capture.png (22 KB, 833x128) Image search: [Google]
Capture.png
22 KB, 833x128
>>55586885
I mean, come on, does anyone actually NEED 31 registers? It's 2016 after all
>>
>>55588227
Daily reminder you can do anything in most languages due to turing completeness
>>
Regarding sockets in C: A client connects to a socket on the server. The server accepts that connection and assigns a new socket to it, so that it can accept more connections. How does the client know that, despite connecting to the accepting socket, it should send() stuff to the new socket created?
>>
One of the biggest problems in OOP education (and engineering education in general) is material that attempts to teach students a solution before they help them understand the problem.
>>
>>55588492
What is the problem, senpai?
>>
>>55588492
OOP is the problem
>>
>>55588516
>>55588492
8deep0me
>>
>>55588492
This this this this this.
It isn't just OOP, though. A lot of software engineering is like that.
Even when they teach the problem, they only teach it very shortly and students and up in a position where they aren't really able to decide whether what they learned is applicaple or not.
>>
>>55588492
OOP is just like material design: looks flashy but is actually shit.
>>
>>55588317
so if you were making something like a bunch of electronics and wanted them all to have a 'turn on' function, then you could make an interface for ElectronicDevice and have 'TurnOn" as a function, then make a factory that took parameters like "DeviceName" or "DigitalStorageCapacity" and assigned them as relevant to the user's needs? ie. The user is putting together a cell phone, and they put together this parts list, and then the factory takes the interface for ElectronicDevice and builds a 'CellPhone' out of what parts were requested, and returns said object to the user? So it's a way for users to be given an interface that they can use to instantiate specific objects at runtime, but not realize that they're instantiating them?
>>
>>55588500
I mean in general. Design patterns rose from hurdles people have come upon while designing systems. Nowadays people are just blindly told to apply them because they're "the right way" even if they don't know why they're doing it.

>>55588516
>>55588545
I'll agree class OOP is pretty terrible in it's current state. But I think a lot of OO systems would be a lot more digestible if the people making them actually "got" OOP.

>>55588561
That's the gist of it.
>>
File: giphy.gif (449 KB, 500x301) Image search: [Google]
giphy.gif
449 KB, 500x301
I'm working on a very cancerous project atm and I need a good way to determine the dominant color of an image. I've read that k-means is efficient and as things are I'm just taking the mode color (with lenience) and using the euclidean distance metric to determine how "close" colors are. Am I retarded?
>>
>>55588488
>How does the client know
it doesn't need to know, the server takes care of forwarding the data to the proper socket
>>
I'm using a CMS and trying to upload an image for a product but getting this error:

An error occurred - System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+. at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) at System.Drawing.Image.Save(String filename, ImageFormat format) at UserControls_ProductAdmin.btnUpdate_Click(Object sender, EventArgs e)[/code

wat do?
>>
>>55588576
go's oop is best oop.
methods are just functions attached to structs.
interfaces are structurally typed.
no inheritance but type embedding.
only package-private/public encapsulation (which is the only type of encapsulation that actually matters).
>>
>>55588616
fix error
>>
>>55588621
Is go worth learning? I toyed with it a bit and it just seemed like middle ground between Python and C but not as good as either
>>
>>55588488
Anyone? I've been trying to understand this for a few hours now, but unfortunately socket programming in C seems like a mix of outdated practices and black magic that no one is 100% of. I'm going to try asking again in a more descriptive manner.

My mental model right now is something like:

Server get a socket suitable for what it wants to do (getaddrinfo + socket)
Server binds a local socket (bind)
Server listens on that socket for attemps to connect to it (listen)

Client asks the server for socket addresses suitable for what it wants to do (getaddrinfo)
[1] Client connects to a socket on the server (socket + connect)

[2] Server accepts the connection and arranges for a new socket to be connected to the client, leaving the accepting socket unaltered so it can continue to accept other requests for connections (accept)

[3] Server and client send and receive data between them (send + recv)

Server and client eventually close their sockets (close)


The thing I don't understand is: The client has a socket descriptor in [1] which is the same it uses to interact with the server in [3], but the server altered the socket that's talking to the client in [2] (or else the socket used in accept would be busy talking to a single client instead of accepting more connections). Does the socket descriptor, despite remaining the same, actually refer to a different socket after [2]? Is the client aware that it's now talking to a different socket, or is that hidden by the server? Is this information about this change relayed to the client by accept?

I'm guessing the answers are: "yes", "the client is aware, it just changes the information associated with that socket descriptor" and "yes", but I don't know how to confirm this.

Anyone? Any information would be appreciated.
>>
>>55588658
Only if you're doing something network related.
>>
>>55588609
But wouldn't that make it extremely hard to talk to multiple clients while accepting new connection requests at the same time? I'd guess that to be implemented as an assoc list of (client talking to some socket, local socket to forward the message to) in the socket descriptor, but it seems like it would get very inefficient, very fast.
>>
>>55588658
go is meant for bigger projects, it's very opinionated and explicit (better readability, more annoying to write).
if you don't have a use for its concurrency support or aren't looking to build backend webdev applications i'd look for something else, because that's where go shines.
>>
File: chen color.png (71 KB, 375x418) Image search: [Google]
chen color.png
71 KB, 375x418
What's the best way to determine if a number is prime?

I can use either Java or C for this.

I tried a for loop with an if statement that just checks to see if it's divisible by anything other than itself or 1 with a remainder of 0, but the number I am working with is like 6 quadrillion so it takes forever. There's gotta be a more efficient way.
>>
>>55588730
You don't have to check divisors greater than the square root of the number. That should speed things up considerably.
>>
>>55588730
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
https://en.wikipedia.org/wiki/Wheel_factorization
>>
developing an android app here.
so i contact an api and i recieve back a JSON array filled with data.
within this data is strings for file names.
to get that json i boot up an AsyncTask,
the asynctask gets the strng data, and turns it into local java objects.
what do i do if i want to get those images as well?
do i boot up another AsyncTask for them alone? or do i have to get those in the same thread? what's the best way to go on about this?
>>
>>55588730
You only need to check up to sort(number), that saves a lot of time. Alternatively you can use the sieve of eratosthenes or some other prime sieve which is faster because multiplication is less computationally intensive than float division.
>>
>>55588730
Protip: You don't have to check every single number that's less than the number your dividing.
>>
>>55588658
go is better than both

compare the use of thirdparty libraries across platforms, go's import/package system combined with static linking is literally perfect

compare go's concurrency primitives (goroutines and channels) and their performance with what's available in python and C (os threads)

go has all the convenience of an interpreted language like python with all the safety and performance of a compiled, (strict/strong/static)ly typed language
>>
File: 1468407419380.png (786 KB, 857x746) Image search: [Google]
1468407419380.png
786 KB, 857x746
>>55588747
The objective is to write a program that does this for me.

Here, this is what I am doing, since I am doing jack shit between semesters at school I thought I'd get some practice and not forget everything.
https://projecteuler.net/problem=3
>>
File: beerus cumming.jpg (306 KB, 645x730) Image search: [Google]
beerus cumming.jpg
306 KB, 645x730
>>55588785
>>55588747

disregard my post, I suck cocks

thanks
>>
>>55588785
that's 600 billion btw
>>
>>55587032
>>55587037
They work but you wouldn't wear them to anything important
>>
Just curious, whats the highest level math everyone here has done? I feel like everyone I meet at school and work is absolutely retarded when it comes to math. I've only done up to complex analysis and some ring theory and linear algebra but people act like its witchcraft.
>>
>>55588831
I got a five on the AP Calc exam, but pretty much forgot all that. Also took a discrete math class in uni
>>
>>55588831
addition/substraction
>>
>>55588623

Yea I got it. Permission issues on IIS.
>>
>>55588831
Started learning high school algebra, but dropped out instead.

Ultimately went on a stimulant and sedative fueled journey some number of days ago, and reconstructed memories of how to work with fractions. Felt okay.
>>
>>55588831
Linear algebra is a pretty extensive branch of maths. Personally I've done introductory linear algebra, a couple of calculus courses, and logical analysis. I've been studying formal languages and might take a course on that soon.

>>55588863
You should call that group theory to sound fancier ;)
>>
File: python-logo.png (44 KB, 286x364) Image search: [Google]
python-logo.png
44 KB, 286x364
As someone coming from python, where do I begin learning C? Is there a site where I could look up it's standard library? When I Google 'C standard library' , most, if not all of them seem to consist of functions used form manipulating data types
>>
>>55588935
>As someone coming from python
Start with the C and work your way up to the A N C E and R
>>
File: 732.gif (2 MB, 350x236) Image search: [Google]
732.gif
2 MB, 350x236
>>55588935
honestly just learn rust, it will succeed C in ten years anyway
>>
>>55588935
The C standard library is notoriously paltry, especially compared to Python's.

Learn the syntax. Learn what behaviour is defined and what is undefined. Study pointers and their relationship to arrays. Study dynamic memory allocation and manual memory management.
>>
>>55588935
If you're used to python, you may be surprised at how barebones the c standard library is. I'd recommend getting a good book and working through it. The c primer one seems like it's good.
>>
File: 1467398868589.jpg (475 KB, 852x973) Image search: [Google]
1467398868589.jpg
475 KB, 852x973
>>55588970
>honestly just learn _, it will succeed C in ten years anyway

war
war never changes
>>
>>55588831
The highest level math was probably a grad class in functional analysis.
>>
>>55588920
Linear algebra is so inextricable from the rest of math it's hard not to learn it. I've studied up to Markov chains and abstract vector spaces and got sick of it but general matrix and vector stuff is everywhere.

>>55588979
b-but muh safety
>>
Does anyone have a copy of https://www.amazon.com/Data-Structures-Using-Yedidyah-Langsam/dp/0130369977
>>
for (auto enemy = level.getEnemies().begin(); enemy != level.getEnemies().end();)
{
for (auto projectile = projectiles.begin(); projectile != projectiles.end();)
{
if (SDL_HasIntersection(&enemy->getRect(), &projectile->getRect()))
{
enemy->damage(projectile->getDamage());
projectiles.erase(projectile);
}
else
{
projectile++;
}
}
if (enemy->isDead())
{
level.getEnemies().erase(enemy);
}
else
{
enemy++;
}
}


Okay, so the vector returned by level.getEnemies() is actually a vector of unique_ptr. And when I try to call enemy->getRect() it gives an error saying that unique_ptr has no method getRect.

How do I get around this?
>>
>>55589130
enemy.get()->damage(projectile->getDamage());
>>
>>55589005
Rust is not much safer than most languages
>>
>>55587302
>>55587241

I'm still an amateur programmer, but I'd love to know more about this stuff. Honestly, I've been programming for companies for two years now, and I'm ashamed at how little I know about anything despite being the only developer.
>>
>>55589005
Since vector.begin() gives you an iterator, to dereference the pointer you'll have to do two dereferences. (*enemy)->damage
>>
>>55589156
thanks
>>
Just finished doing another one of the Pro/g/ramming Challenges (Calculating at least the first 100 Fibonacci Numbers), and I feel amazing!

Now to do something easier as a maybe-deserved break
>>
File: 1460688361465.gif (1 MB, 320x213) Image search: [Google]
1460688361465.gif
1 MB, 320x213
>>55586885
I try to get better at programming by building something useful for me but there is no anything that will help me out so I am stuck.

This really bothers me cause now I had to practice by making prison manager programs and such. These are fun too, making UML diagrams and practise OOP design, but these are not useful.

How can I get out of this?

I use Java and C# and now I am learning python.
>>
>>55587623
https://en.wikipedia.org/wiki/George_C._Parker
>>
>>55588691
>assoc list
>very inefficient
a hash map is efficient
>>
File: Pro:g:ramming Inverted.png (550 KB, 1450x1080) Image search: [Google]
Pro:g:ramming Inverted.png
550 KB, 1450x1080
>>55589275
This has helped me immensely in being a better programmer (try starting with the medium/difficult projects)
>>
>>55589302
Well, what I meant is that it's much more inefficient than my idea (somehow tell the client to redirect all future messages to another socket). Are you sure that's how it works/do you have any sources for that being how it works in an actual implementation?
>>
>>55589308
Most of these require a GUI.
Is there anything that I can make in a console app?

I haven't even install a GUI designer for Eclipse. I try to write my first programs console based then move to GUI.

I did the same with C#.
>>
>>55589381
Honestly, I think anything that can be done in a simple console application SHOULD be done in a GUI instead, if you're learning.

It forces you to learn the logic and the best way to serve and modify data behind a presentation layer at the same time.

I learned C# doing GUI from the get-go, and now I only use console applications for automation pieces that should be silent.

Buttons and drop-downs are better than manual typing of parameters, even on personal productivity tools.
>>
>>55589364
>it's much more inefficient than my idea
you don't fully understand how tcp works; what you're thinking simply moves complexity from the server to the client for no reason and doesn't scale (you couldn't have more than 65535 open ports per protocol)
>redirect all future messages to another socket
sockets are a tcp/ip concept and are local to the machine; you can't tell a remote client anything about a socket because it's not visible outside the local machine; you're confusing sockets with ports; ports, sockets and descriptors are all different things
>any sources for that being how it works
unix network programming, volume 1
tcp/ip illustrated, volumes 1 and 2
>>
File: starcirclemove.webm (3 MB, 960x540) Image search: [Google]
starcirclemove.webm
3 MB, 960x540
Making a plugin for after effects. Pixel sorts, but also traverses an animated vector field.
>>
How many lines of code is your largest project /dpt/?

>tfw 1,700
>>
>>55589498
Have you considered using comonads?
>>
File: rectswirl.webm (906 KB, 759x522) Image search: [Google]
rectswirl.webm
906 KB, 759x522
>>55589529
Not sure what you mean.
I'm programming using C++ and all the results i see for comonads are haskell
>>
> pajeet joins team
> asked to maintain areas of the project i created
> have to watch as my work is slowly degraded through broken english member names and redundant code

end it
>>
>>55589505
Totals grouped by language (dominant language first):
cpp: 260532 (93.21%)
ansic: 9732 (3.48%)
xml: 7913 (2.83%)
python: 918 (0.33%)
sh: 377 (0.13%)
asm: 35 (0.01%)
>>
>>55589505
About 3,000. I'm not including whitespace or bracket-only lines.
>>
>>55589308
how to quickly you get into sound synthesis shit? I'd like to do some hobby level stuff
>>
File: indians2.png (7 KB, 530x130) Image search: [Google]
indians2.png
7 KB, 530x130
>>55589563
>not managing the pajeet

I saw these words in some code the other day:
>Authentification
>Upgradation

Pic related is actual communication from these subhumans.
>>
>>55589650
Why do all shitskins use "kindly" so much?
>>
>>55589552
rad.
wanna open source it?
>>
>>55589671
Bioshock was fairly common in the middle east.
>>
File: swirl r2d2.webm (3 MB, 480x488) Image search: [Google]
swirl r2d2.webm
3 MB, 480x488
>>55589703
It's a plugin I'm selling.
But yes I do plan to open source it, among the other plugins I have as well.

Here are two papers related to the subject
http://www8.cs.umu.se/kurser/TDBD13/VT00/extra/p263-cabral.pdf
http://www.impa.br/opencms/pt/ensino/downloads/dissertacoes_de_mestrado/dissertacoes_2009/Ricardo_david_castaneda_marin.pdf
>>
>>55589747
do these sell well? can you make a living selling these plugins?
>>
>>55589563
I know the feels.
>in charge of all video player related stuff on Android apps
>app requires 4 different video players
>write neat abstraction layer
>works like a champ
>hand off project to muh senior dev
>...
>1 year later
>...
>video player state is kept in different places
>instanceof everywhere
>1000+ lines of comments like 'I couldn't get it working after 4 hoursm so just do <insert shit solution>'
But I've stepped up my game. The player stuff is now a library only I have push rights to. Merge requests are shot down like Somalian pirates. I respond to 'improvements' by replying with Kim Jong-Un images.
>>
>>55589308
Ayy
>>
>>55589714
ayyyy
>>
>>55589772
It sells. I would sell more if I could manage to make a mac-build and a version that works with premiere. There's another much more lesser-featured plugin being sold for much more over here. I'm selling mines for like, 15 to welcome a higher volume.

http://aescripts.com/ae-pixel-sorter/
>>
>>55589859
so it takes a good quality source video or image and fucks it up with what looks like strange jpg artifacts?
why would someone want to use this?
>>
File: goat.jpg (4 MB, 3840x2160) Image search: [Google]
goat.jpg
4 MB, 3840x2160
>>55589927
>so it takes a good quality source video or image and fucks it up with what looks like strange jpg artifacts?

It's pixel sorting. It's obscenely popular actually. Especially among "glitch artists" and those montage video people.
>>
>>55589927
that particular plugin is really minimal compared to what other people are making with processing scripts

The anon in this thread is actually bringing something new to the table.
>>
>>55589494
thanks
>>
>>55587019
Pants with a dick hole : Assembly
>>
>>55589976
some glitch art looks really nice
>>
>>55589976
You just got that from /wsg/, didn't you?
>>
>>55589644
Not sure if it helps, but these series of articles explain how sound is represented on a computer through Fourier Transforms:

http://www.relisoft.com/science/physics/sound.html
And this might not be a bad resource either,
http://stackoverflow.com/questions/819953/how-to-start-writing-a-music-visualizer-in-c
>>
>>55588831
I've done my school's undergrad sequences in algebra and analysis, which finished at Galois theory and measure theory, respectively.
>>
>>55590059
thanks, very cool
>>
Why is golang so based /g/?
>>
>>55590201
>
>>
>>55590201
Because it increases the chance of getting a chink gf.
>>
Is it normal for an OpenGL program to choke on 100 diffuse-only point lights?
I would've thought that the GPU was a bit more powerful than that.
My GPU isn't bad.
>>
>>55590233
Your code is shit.
>>
>>55587886
>look at me, i'm a muslim and so much more mentally balanced than you
*tips turban*
>>
>>55590259
*tips French public opinion of safety*
>>
>search for 'how to blend ice without blender'
>solution: put in plastic bag and smash it
Now I know why I'm a code monkey.
>>
>>55590267

religion of peas.
>>
mnv notev o tuilahPdieihms feyp G o 
oi'Uinch acnutha t n s cas, tlos "i
mLINtantd oo wcs Uatumaremyel irxt
Ga u ngyihr ryN i amg ellaU ouu
ass rrfyannstaUnelG, yr ontnpmNm nb
aa,ee b iariiNesl xtegerasomrGe,ii
r tphy ssMewlGtuaeuuhohp y oo tdLr
ooriotllei
v u f chnbtrt ssncnese"t
fto aluir. ,cfositi p ri a hyd s
gnruftpXdyeo ts L,m se gcastsddi
tg,na feimIeap siay teeehln i aed
cnxi t sloSid ni bbaithtteitf he l
eiultuauicOf ao f staontioxtlxly
jrnlob t Piy iyosdsgy c ra uioual
rrian feus drhsa ieins:oeer;tnwhncl
eeLc ,od tyoegrdy p i llhkefxi wi-a
tf/ sf alnbmvueontoyseelt pleLn Loe
neUoiltmle eovtailluhna eoet oe sr
irNt en enda r m el tr oh sn.ihh
G xsemhoe mhed tvae ettTntomtttee
oe nutnespnneThedaeerfka aicea ihr.
tr,eniot miut tsnhdrao hs. tn:wtax
'tki ps,ofrs. uat etenfyesim u
eucaLomysce yt, ,eeth cuobhybeUlsn
koat tosb dssisy,emrlrtmrr tsmtNlni
iyf .nc im r tl"reepa eu ts osGAoL
l yxu UleseUgnexathopstoursngcy i/
tnlu eNetasNneduwsTe issoaein sy.tU
taitnmeGrs uGivinay pa yeypl in lxuN
sh nier oyS zewi s. xsr entiglubG
uWseLtfgcsOrei Lt tetu tlsoa nani
j ic s n ehlfs"oUcssnesaauirdicirf
. esyriUllttaoi nNeeuih'hi teetiLto
dt,rusenNalu e d GjhjLtetttcpsas/s
'nx l hoGtupfrnhee ot
n nunouraUis
Ieuepgti ifmo rclrer s.nisebu ebNdn

>>
>>55590478
burger king
>>
are bjarne's legs really that long??
>>
>>55590506
Can you fucking not, nerd?
>>
>>55590534
you should see his cock++
>>
>>55590534
ask ur mum xd
>>
File: file.png (57 KB, 763x136) Image search: [Google]
file.png
57 KB, 763x136
>>
File: kek.png (307 KB, 1366x534) Image search: [Google]
kek.png
307 KB, 1366x534
>>55590610
>>
>>55590610
what am i looking at mr hackerman
>>
>>55590258
I don't think it's too shit.

This is my fragment shader:
#version 330 core

in vec2 fs_pos;
in vec2 fs_uv;

struct Light
{
vec4 pos;
vec4 lum;
};

layout(std140) uniform block_lights
{
Light lights[100];
};

uniform int n_lights;

uniform sampler2D diffuse;
uniform sampler2D normal;

out vec4 color_out;

void main()
{
vec4 color = vec4(0);

vec4 frag_diffuse = texture(diffuse, fs_uv);
vec4 frag_normal = texture(normal, fs_uv);

for (int j = 0; j < n_lights; j++)
{
Light light = lights[j];
vec4 pos = vec4(fs_pos, 0.0, 0.0);
vec4 norm = frag_normal * 2.0 - 1.0;
norm.y = -norm.y;

vec4 dir = light.pos - pos;
float dist = length(dir);
dir = normalize(dir);

float i = dot(norm, dir);
i *= 1.0 / (dist * dist);

color += max(light.lum * light.lum.a * i, 0.0);
}

color_out = frag_diffuse * color;
}
>>
>>55590756
why did opengl not use normal C instead of their own abomination?
>>
>>55590747
he found mails online and probably send them fishing and fished out a few accounts

ebbbbinnnng
>>
>>55590761
What are you on about?
GLSL is pretty comfy for shaders, it was a good design decision.

Doing vector math in C is shit.
>>
>>55590747
Just some shit I made to automate haxoring some type of accounts, it goes into emails, gets their attachments, searches all of their emails for regex to do with credit cards, dropbox, bitcoin related sites, banks

Then also tries using the same login for netflix, icloud (which steals their notes,contacts,device info including current GPS location and iphotos), and twitter and skype
>>
>>55588831
I did the minimum required amount of math to get my BS in comp sci
so, calc 3
>>
>>55590789
It would be better and easier if they just used C.
>>
>>55590774
Nah man, the accounts came from a 700k dump i got 2 years ago from a store's shitty website, only got around to it now and most of them are still working

It was this shit: http://www.salsastore.com/en/ , but I believe the SQLi is patched now
>>
>>55590509

Thank you for responding.
>>
>>55590807
No it wouldn't.
Do you have any experience at using OpenGL or writing shaders at all?

GLSL is not hard to learn, it's very C-like and once you have learnt it (not hard) it's a breeze to do calculations in.
>>
>>55590841
>No it wouldn't.
How so?

>Do you have any experience at using OpenGL or writing shaders at all?
Only a little bit of OpenGL experience I will admit.
>>
>>55590822
Vote Trump to prevent islamic invasion.
>>
>>55590853
>How so?
Because vector and matrix math is SO much easier to do in GLSL, the language was designed with it in mind.
And the benefit of this outweighs any downside of having to learn it because it's a very easy language to learn.
>>
>>55590878
I fail to see what would cause problems with matrix and vector math if they used C instead of their own.
>>
>>55590868

There isn't going to be an Islamic invasion regardless of whether or not Trump wins.
>>
>>55590925
C is a lot more bulky and ugly with that kind of stuff.
>>
>>55590868
Yeah, vote trump for more nsa spying!
>>
>>55590982
Vote Hilary for black beauties.
>>
>>55590925
GLSL has to reflect the restrictions of the GPU's SIMD hardware. A freer language like C would allow for many ways to ruin your performance. Global memory access in shaders is extremely slow for instance. The language has to account for the locality of memory.

I don't see the problem to be honest. Few languages are more similar to C than GLSL.
>>
>>55591017
>GLSL has to reflect the restrictions of the GPU's SIMD hardware
And this is easily possible in C.

>Global memory access in shaders is extremely slow for instance
They would not need to support anything like that.
>>
>>55591010

I wouldn't vote Hillary even if she promised me a beautiful African wife.
>>
>>55591061
What if she promised you a harem of African ladies and a cotton plantation?
>>
>>55591088
>implying her promises mean anything
>>
Please fuck off to /pol/.
This thread is for programming and anime.
>>
File: anime8.jpg (73 KB, 512x600) Image search: [Google]
anime8.jpg
73 KB, 512x600
>>55591119
Please fuck off to /a/, this thread is for programming.
>>
>>55591119
What if Hilary allowed waifu mariage?
>>
writing a remote control utility for my gf's vibrator
>>
>>55590794
>>55590809
That's illegal family. Reported.
>>
I'm making a program to print out X amount of numbers from the fibonacci sequence but I think it starts printing out negative numbers at some point
  #define MAX 100
uint64_t fibonachi[MAX];
fibonachi[0] = 0;
fibonachi[1] = 1;
for(int x = 2; x<MAX; x++){
fibonachi[x] = fibonachi[x-1] + fibonachi[x-2];
}
for(int y; y < MAX; y++){
printf("%d ", fibonachi[y]);
}

I think it's integer overflow, not sure though
>>
>>55591147
Just use emacs http://www.youtube.com/watch?v=D1sXuHnf_lo
>>
self.thumb_widget.filelist.itemClicked.connect(lambda item: 
self.go_to(self.thumb_widget.filelist.row(item)))

so ugly
Thread replies: 255
Thread images: 34

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.