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

/dpt/ - Daily Programming Thread

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

Thread replies: 314
Thread images: 26

File: ARM_Logo_Corporate_Blue.png (16KB, 200x150px) Image search: [Google]
ARM_Logo_Corporate_Blue.png
16KB, 200x150px
Previous Thread: >>57401138


What are you working on, /g/?
>>
First for MENES
>>
second for haskell
>>
>OOP
>>
>>57404855
whats wrong with it
>>
File: PAJEET.jpg (61KB, 652x619px) Image search: [Google]
PAJEET.jpg
61KB, 652x619px
>>57404855
>U said somethin white boy
>>
>>57404824
What do you guys think which one should we do?


Me and a few friend of mine thinks about creating an indie game. (I got a bunch of programming experience.)

We are thinking of either making a 2D side-scroller or a simple 3D game (I mean with simple graphics) something like the original Doom in terms of capabilities; simple shapes and models maybe sprites. Maybe with added lightmapping or shadow maps.

What do you guys think?

The problem is that overall doing 3D is an order of magnitude harder to do than 2D imho.
>>
>>57404855
There is nothing wrong with OOP if its used properly.
The small overhead that may come from using objects is marginal on literally everything that is used today and your code is actually structured in somewhat reasonable way.
>>
>>57404937
I made a 3d engine once, and it wasn't _TOO_ hard(minus physics and shit like that).
>>
>>57404750
Thanks for the pointers, I joined the IRC. I'll be lurking there
>>
>>57404951
code duplication.
mutability
just the existance of patterns makes it blatant that language lacks something (with patterns you are basically pretending you are a more capable compiler --> like unrolling loops by hand back in K&R C).
>>
>>57404978
no problem, just make an interesting language to hack on :)
>>
File: 1454557155248.jpg (46KB, 470x626px) Image search: [Google]
1454557155248.jpg
46KB, 470x626px
>>57404855
>mfw I realize that /g/ is that hipster that everyone hates
lmao
>>
>>57404952
Yeah, I have a strong estimate about doing the Doom tier stuff, we could probably integrate Bullet for physics. https://urho3d.github.io/ seems to be coming together well despite the smallish base.

Making a whole engine would be a learning experience, otherwise there is shit like Unity3D or Urho3D I linked above.

However assets are still a problem: modeling, plus lot of textures and we want it to look nice where 2D wins. Plus it's harder to integrate shit like physics and maybe networking compared to 2D (more complexity -> more bugs).

On the other hand it would be cooler.
>>
Hi, what are good way to calculate prime numbers? I have very little programming and math experience (pic related, about high school gradute level in both) so I would appreciate advice on how to write code with user readability and simplicity/efficiency in mind.
Thanks
>>
Whats the point of this-> x

if it does the same thing as just writing x?
>>
>>57405034
primes = filterPrime [2..] 
where filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x `mod` p /= 0]
>>
>>57405029
just use some open source graphics. When game is finished you can always hire somebody to design replacements.

>>57405034
most efficient method for small primes (<100000) is sieve of eratosthenes. It's quite simple and readable too (elementary school level maths).
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
>>
File: 1470593852264.png (9KB, 518x141px) Image search: [Google]
1470593852264.png
9KB, 518x141px
I want to make pic related (will obviously look much better when it's done). You can select boards and search for words, it will then return all of the threads that it found.

But I think traffic could be an issue. I would have to use the 4chan API to load the entire JSON file for every board which would probably be slow if multiple users use it. It's also against the API rules to make more than one request per second. Is this project a bad idea?
>>
>>57405060
import Data.List (nubBy)
primes = nubBy (\x n -> n `mod` x /= 0) [2..]
>>
>>57405034
bro instead of asking how to calculate prime numbers may i suggest doing 6.001 or the easier 6.00 (+ .01 and .02)?

You'll learn how to think and not just apply whats already been written
>>
what's a good tutorial on how to make backends for websites? I'm more interested in concepts, but I don't mind reading a book/tutorial made for a given language.
I want to understand what I have to implement, not just which functions from a framework to call and what order.
>>
>>57405034
bool is_prime(int n){
if (n <= 1)
return false;
else if (n <= 3)
return true;
else if (n % 2 == 0 || n % 3 == 0)
return false;
int i = 5;
while (i*i <= n){
if (n % i == 0 || n % (i + 2) == 0)
return false;
i = i + 6;
}
return true;
}

Try that.
>>
>>57405110
You won't learn programming just with sicp. He should learn a bit more of language, work on some smallish projects, get in some deadends (learn not to do it again) and read theory just from time to time.

Also he should read a lot of source code, for example gnu implementations of unix commands are great (grep, find, cp, ...)
>>
>>57404995
>code duplication.
One major point of OOP is to prevent this, which is why you have inheritance and methods
>mutability
You have both immutable and mutable objects in OOP for a lot of things, e.g. string and StringBuilder, so i dont see your point.
>just the existance of patterns makes it blatant that language lacks something
Patterns are just suggestions for a abstract solution to a problem.
Haskell and such dont have a standard solution built in either but instead of the non OOP community not everybody was smelling his own farts everybody, some people came up with abstract solution for common problems.
>>
>>57404937
>The problem is that overall doing 3D is an order of magnitude harder to do than 2D imho.
3D in itself isn't particularly hard. In fact doing a 2D game in a 3D pipeline is actually easier than doing old school 2D because think of all the things you get for 'free' if you do everything in 3D: Easy sorting of sprites/tiles (depth buffer), all pseudo 3D effects like layering, parallax, z-scaling, etc are just regular transforms, no tricks or hacks needed.
>>
>>57405105
nigga, those are the powers of 2
>>
welp, i just managed render an mp3 file using windows media foundation.
it was more complicated than it probably needs to be, but i'm not feeling the same sense of accomplishment as when i managed to play a wave file using wasapi
>>
>>57405156
OOP is more bloated than other paradigms
Patterns aren't abstracted over, that's the point.
You do it again and again. In Haskell you abstract over it because you can.
In OOP you can't.


>>57405182
Whoops, I meant == rather than /=
But that's fucking interesting
>>
>>57405156
In lisp you don't use a pattern, in lisp you write a macro that replaces manual usage of this pattern.
In haskell you don't use a pattern, in haskell you write a monad.

By experience functional programs have a lot less duplication than oop. Especially if you know how to use higher order functions and macros.
>>
>>57405154
6.01 is python and doesnt use sicp. Mit hasnt used it in ages (wasnt even available for me).

But either way the point of sicp isnt to learn how to program as such but more how to "think" with any language.
>>
>>57405166
Well, you're saying something, I saw games doing that.
Looks nice if I consider our side-scroller idea. We could even put some 3D stuff in there, and we can get away with never doing the other side of things, like a 3D platform if we want to.
>>
>>57405208
Exactly, and theory should be interwoven with practice.

Huh, i thought web version of 6.01 still uses sicp.
>>
>>57405203
>>57405204
Not when you e.g. have to create the same thing, that has a shitload of lines of codes, several times with small changes which occurs way more often than only needing one small function.

The 10 line FizzBuzz program you write in Lisp or Haskell isnt actually representative for real programming.
>>
in java, how do i import a java file that's in the same directory as what i'm compiling? i know it normally wants it to be in the form of
>import packagename.filename;
i'm using the terminal because i don't feel like using an IDE right now
>>
Learning machine learning and stuff.

Trying to find a game that provide a good challenge but still doable with normal neural networks and ok computers..
>>
>>57405262
what book
>>
>>57405250
Who the fuck needs 10 lines for fucking fizzbuzz?

IRL you just refactor often, design a program like a library or language (layered bottom up design) and insist on modularity.
>>
>>57405250
OOP is great if you have a team of code monkeys (you limit the damage they can do, but you also limit the greatness that they can do -> like driving with safety wheels).

If you have a small capable team oop just wastes your time.
>>
>>57405224
I didnt do the web version so idk, we did like a chapter from sicp (think it was 5?) but over all we werent actually told to get a text book.

The one i used was

https://mitpress.mit.edu/books/introduction-computation-and-programming-using-python

but most of the stuff was just hand outs.

The web version probs uses sicp since its free digitally and is still a good resource book
>>
>>57405300
t. never worked

>you limit the damage they can do
If this were the case everybody would choose functional because you cant fuck anything up with side effects
>>
>>57405285
not him but my first fizz buzz which allowed the user to define a start and end point was 14 lines
>>
>>57405325
>If this were the case everybody would choose functional because you cant fuck anything up with side effects
Kek. You don't even know what you're talking about.
>>
File: image:89796.png (185KB, 628x656px) Image search: [Google]
image:89796.png
185KB, 628x656px
I know the syntax and basic design for c and others but how the heck I get used to working with massive complicated libraries.

All I've made is some toys, the next step in what I want to make all requires using xlib and stuff

send help
>>
>>57405060
>>57405105
i'm not sure what this is exactly, i don't understand the syntax
>>57405064
i think >>57405144 is using the Sieve of Eratosthenes but i'm not 100% sure about the while loop part right now, will try to mess around with it in a bit, really interesting for me to read though, thanks
>>57405110
i was curious how hard it would be to write a program for prime numbers based on what i knew, is 6.001 an online course? if so i'll look into it

thanks guys
>>
Which should I use while going through cracking the coding interview and also in coding interviews? Java vs Haskell
http://www.strawpoll.me/11583113

started coding in java again for the first time in about a year recently after doing a lot of programming in the cinnameg masterrace language for my programming languages class. and i found out i really don't like java
>>
>>57405262
After taking the Coursera course, a course at my Uni, and studying on my own I can honestly say Machine Learning, in general, is incredibly dull.
>>
>>57405379
>found out i really don't like java
i like you
you can stay in my general
>>
>>57405096
pls reply
>>
>>57405364
study code that uses them.

>>57405375
there is online version of 6.001.

First two versions of primes use haskell programming language. They basically define infinite list of natural numbers bigger than 2 (possible due to haskells lazy (delayed until needed) evaluation and remove all numbers that aren't primes. Efficiency isn't very good, since they are basically trying to divide a number by all known primes (all numbers can be broken down into primes. if a number can be only broken into itself, it's a prime). Please collect me if I am wrong, my haskell is a little rusty.
>>
>>57405275
no book, random ressource online and stuff

it's not to get a job, but as a project

>>57405386
What do you mean by dull exactly?
That's not how I'd describe alphago and stuff.. Obviously deepmind is the best in this sector but they're doing really cool stuff.
>>
File: 1470103566559.jpg (173KB, 1280x720px) Image search: [Google]
1470103566559.jpg
173KB, 1280x720px
Friendly reminder that all you anti-OOP procedural fags are secretly using OOP in your programs without even realizing it.
>>
>>57405360
One post further above was even criticizing the mutuability of OOP.
Hell, no side effects is even the most common defense of functional programming warriors
>>
>>57405423
Are you one of those fucking idiots who thinks structs are OOP?
>>
>>57405429
it's bait
>>
>>57405419
just feels like copying with no understanding
>>
>>57405375
theres onlinne 6.001 but the lecture videos are from the 80s. Imo just do .01, its way chiller and better suited to onlnie learning (stress doesnt work well with it)
>>
>>57405423
I don't think a single oop-basher in this thread was from procedural background. functional != procedural, we functionals don't like mutation, side effects, order of evaluation, ...
>>
ARM64 assembly makes my peepee grow hard
>>
>>57405429
struct foo
{
int x;
}

void foo_dosomething(struct foo *f)
{
f->x++;
}

Many many C programmers do this, and it's pretty much OOP.
foo_dosomething is basically a method of foo without the syntax sugar.
>>
>>57405425
Side effects are "allowed" in certain conditions. For example in monads (however, but monads aren't some hack that hides side effect, but they are mathematical concepts that make side effects "pure" through world passing (primitive version) or through some dark haskell magic).
>>
>>57405031
Thanks for the link bro, I'll read it

>optimization techniques

That's what's troubling me. It's said that 20% of the work gives one 80% of the performance returns. Pareto principle or something... So by this logic I should be able to get a fairly acceptable implementation performance-wise by using some well-understood optimization techniques; the remaining 20% performance gain would require heavy wizardry.

I'm having tremendous trouble identifying precisely what these basic techniques are... I wanted them in my VM from day one... I'm not really looking to outperform C or LuaJIT or anything, but performance shouldn't be a concern in general.

I figure there must be some "optimal programs best practices" book out there that covers some general principles I can apply to any program but haven't found it yet. General stuff like "memoize function return values if you can".
>>
>>57405457
ofc you are going to have methods for working with your own types.

oop isn't just about grouping type definitions and methods together. It's about inheritance and imagining problem as a set of interacting actors.

I hate it when you javafags think type + method = object. Study some smalltalk, will you?
>>
>>57405457
>it's pretty much OOP
OOP fags really try to lay claim to absolutely everything.
You clearly don't understand the core of what OOP is. It's about a network of objects passing messages to each other, not just syntactic sugar for associating functions with data types.
>>
>>57405490
>and imagining problem as a set of interacting actors.
Which is what a lot of procedural programmers do.
>>
>>57405490
>>57405503
This.

Every OOP fags should get familiar with Smalltalk.
>>
>>57405510
>Which is what a lot of procedural programmers do.
No they don't.
Where are you pulling this shit from?
>>
>>57405525
Do you not organize your project into somewhat independent modules?
>>
>>57405535
OOP is about the fine-grained encapsulation of state, not massive modules. OOPfags always push for "single responsibility".
You can't call a program that has 5 or so modules that oversee massive parts of the system to be object oriented.
>>
>>57405457
>and it's pretty much OOP.
No.
>>
>>57405510
Since you have trouble understanding this shit:
Procedural programing = you are writing a recipe, specifying execution step by step
OOP = you are specifying interaction between entities
Functional = you are transforming input value into correct output value
Logical = you are specifying relationships between entities

>>57405535
modularity != oop, not in the least
naive moduling is just breaking a file into multiple files, while a little more advanced moduling is breaking namespaces. Not in any way connected with oop.
>>
File: interview.jpg (973KB, 4992x3328px) Image search: [Google]
interview.jpg
973KB, 4992x3328px
>You would like to use Haskell for your code? I'm afraid I'm unfamiliar with that language. Could you use a language such as Java or C++? Do you know any real languages?
>>
>>57405417
just curl the catalogue page lol
>>
>>57405583
Impossible since it requires JavaScript
>>
>>57405558
If you believe paul graham it's not even about encapsulation (arguably closures are more than good enough for that).

>>57405576
haskell is these days very aggresivelly marketed (it's presented as cool language that will fix all your problems due to absence of side effs, monads, ... arguably they are right), so they probably heard of it.
>>
>>57405576
haskell, lisp and any little meme language is great for 20 line util programs though!
>>
>>57405596
just curl the json api then
>>
>>57405603
especially since most of the utils only take input and produce output, there is no interaction with user, so it's easier to write functional programs.

for example grep could take a file (well a filename and then opens assocciated file, but still ... functional implementation is possible) and returns a list of lines.
>>
>>57405600
they need to be able to understand the code though
>>
>>57405603
that's not how you spell python
>>
>>57405625
Read my inital post. I was asking if the traffic would be too much of an issue.
>>
>>57405656
>what is caching

fetch the catalog every few seconds and use temporary storage for it then when a user searches use the temporary local storage you have like a database or whatever
>>
>>57405641
use a language that is as lispy as possible while having syntax. Dylan and ruby are nice.

Also I guess you will be able to demonstrate your ability to expain unknown concepts.

>>57405643
if python had anonymnous functions and usable macros and usable anything functional.... it would be pretty amazing. but then we would call it little faster ruby I guess
>>
>>57405676
Thanks, I'll try that
>>
what's wrong about this haskell code?
main = 
do putStrLn "What is your name?"
name <- getLine
putStrLn ("Hello " ++ name ++"!")


it's an example i found online and it doesn't compile
>>
>>57405875
it's haskell
>>
>>57405875
> it doesn't compile
In general, you should post error messages.

The reason it doesn't compile is that the indentation is wrong; the last two lines need an extra space, otherwise they'll close the block started by the "do" keyword. More generally, statements which are supposed to belong to the same block should have the same indentation.
>>
There was a little blood on my stool so i panicked and felt really anemic, it took me a while to compose myself.
//blog
>>
>>57406061
first time i had boner i though it was disease and i cried all day
>>
>>57406041
thanks, i didn't know whitespace mattered
>>
>>57406061
be gentler when you destroy your boipucci
>>
>>57406061
If it's very small amount of blood and fresh blood it's probably from your the near vicinity of your asshole. You damaged it somehow, probably nothing to worry about.

If it's a lot or it doesn't look like that new (for example. your shit is full black which can be caused by blood getting into your stomach and your stomach processing it) then visit a doctor asap.
>>
Why everytime I go on IRC either I get ignored or I get kicked?
>>
>>57406276
Probably because you're being a little bitch.
IRC is not 4chan.
>>
>>57406276
because you're not part of the circlejerk.
you gotta erp with someone, then with the OPs then with the channel admin.
>>
Placed 85th out of 3070 people at the NCL
Feels good man
>>
>>57406288
>IRC is not 4chan
I know. It might be impossible for me be social though

>>57406295
>
Is IRC always like that?
>>
>>57406314
>Is IRC always like that?
No, but it happens. When you leave a group of people together for long enough on the internet, they tend to circlejerk.
>>
I need help comparing the value of a node (which is the root of a bst) to an int, whats messing me up is having the node passed into a function via pointer, and having to deal with dereferencing it.

struct data * foo(struct Node *tree, int val){

if(tree->value == val){
printf("Node value = val");
}

I can print the value of the node by doing
printf("n->val: %d\n", *tree->val);

But if I add a pointer to the if statement comparing the node val to an int, i get an error.
}
>>
>>57406276
>ignored
Are you waiting more than 30 seconds for a reply? Most people in channels are just idling, a channel with 300 users in it can often only actually have < 10 active users at any given time.

>kicked
Probably being an insufferable faggot.
>>
hiro's mobile ads are terrible now, christ

>>57406302
first I've heard of this. any qts?

>>57406355
does tree->val not work? i don't understand what you're asking
>>
>>57406355

>i get an error
And we are supposed to play charades to find out what this error is?
>>
/dpt/ got an IRC channel? what channel/server?
>>
>>57406405
>getting kicked for greeting
Meh

When I do get replies, most of the time my opinion is just dismissed or ignored. I want to believe I ain't a faggot and it's something the along lines of >>57406335.

I'll stick to anonymous imageboards I guess.
>>
>>57406488
You're probably trying too hard. Most things don't get responded to, especially if you're new to an old channel that already has an established inner circlejerk.
>>
>>57406447
>>57406435

Sorry, I should have been more specific.
this is in c btw

I mainly want to know how to compare the value of a node from a bst to an int, in order to iterate through my bst in order to find a value.

struct data * foo(struct Node *tree, int val){

if(tree->val == val){
printf("tree val = val");
}

}

compiling this gives a warning: comparison between pointer and integer [enabled by default]

and running the program does not reach the print statement, if i compare that value to if it is say over 100, than i can reach the statement.

I think the problem is that Im not reaching to val in the node correctly, and am instead reaching its address
>>
>>57405875
>=[ENTER]
its either
function arg1 arg2 = blah

or

function arg1 arg2
= blah
>>
>>57406302
Ah yes, the Norwegian Cruise Line.
>>
>>57406488
IRC is basically like private trackers, bunch of people who never went anywhere in life and had no significance for anyone so they do power trips and attack people for disagreeing and questioning their internet image etc. don't mind em
>>
>>57406435
>>57406513
National Cyber League, essentially an InfoSec competition
It's all online, so I don't know about anyone qt's
>>
>>57406504

>this is in c btw
I think anyone could have gathered that.

>compiling this gives a warning: comparison between pointer and integer [enabled by default]
What is the definition of struct Node? Because it would seem that tree->val is a pointer type, based on your warning.
>>
>>57406537
Some channels are friendlier than others tbqh
>>
>>57406550
the nice ones are mostly passive aggressive, i.e people will trash you in pm's or make underhanded comments, it's all the same shit really
>>
>>57406548

struct Node {
BST_DATA_TYPE val;
struct Node *left;
struct Node *right;
};
>>
>>57406562
That's just not true at all, where the fuck have you seen any of that?
>>
>>57406566
Well you can deny if you want senpai, on all /g/ channels and some freenode ones
>>
>>57406545
ah, i searched for it and got the impression that it was in-person

>>57406565
>BST_DATA_TYPE
well, what's that
>>
>>57406565

You know, it would be helpful if we had the typedef for BST_DATA_TYPE as well.
>>
>>57406458
>>57406458
>>57406458
anyone? or, are you talking about the lang design one?
>>
>>57406589
>on all /g/ channels
Okay that might be right, because /g/ is particularly autistic.
But I'm on a fuckton of freenode channels and the only people that get trashed are blatant trolls or turbo autists, and even that doesn't happen often.
>>
>>57406607
>>57406602
the definition is at the top of the program

#Ifndef BST_DATA_TYPE
#define BST_DATA_TYPE struct data*
#endif
>>
static
inline
void
foo(float a, float b, float c, float d);


Or...

static inline void foo(
float a,
float b,
float c,
float d
);


Which one is better?
>>
>>57406627
have i been rused
>>
can you language do this
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

O(n) recursive fib
>>
>>57406638
static inline void foo(float a, float b, float c, float d);
>>
>>57406627
so the value val being passed in is an int, and im trying to compare it to the val in the node, which is BST_DATA_TYPE

Can I take out the value in the node and convert it to an int?
>>
>>57406657
No, my language encourages O(log n) fibonacci or better.
>>
>>57406625
i'd say more narcissistic try hard kids than autists but I guess you're right in a way, I miss making newbies rm -rf /* on channels lel
>>
>>57406671

That depends, what's the definition of struct data?
>>
>>57406672
>O(logn)
literally doable in any functional lang

can your languge make you feel special?
>>
>>57406659
But assuming the function as actually a longer definition?

>Also, wth is """CALLE"""
>>
>>57406706
CALLE?
>>
>>57406703
>can your languge make you feel special?
I don't need the language to make me feel special because I have some fucking self-esteem.

>>57406706
Street in Spanish, they're doing captchas for the spanish street view at the moment.
>>
>>57406718
oh, why spanish?
>>
>>57406696
struct data {
int number;
char *name;
};
>>
>>57406727
Because that's the set of photos they're processing at the moment. What the fuck do you want me to say.
>>
>>57406729
Please use
[ /code] when posting uncompiled machine language.
>>
>>57406729

if (tree->value->number == val) {
/* stuff */
}
>>
>>57404824
Is it possible to essentially make a typedef of a variable and warn when that variable is used with a non-typedef'd version in C++? I know I can make a struct, but I want to be able to use bitwise operators quickly, and making an entire struct just to emulate an integer seems insane.
>>
So I just bought The stanley Parable. What should I expect?
>>
>>57406764

Err... tree->val->number.
>>
>>57406759
 test
>>
>>57405029
Not him, but I also made a little 3D sandbox game. What I really wanted to do was to everything in software and compile it for some old console (SNES or NES) just for shits and giggles
>>
>>57406565

Anon, are you in CS261 at OSU?
>>
>>57406727
the botnet is indexing latin american streets
>>
>>57406766
Enum class?

Or if you want to go all the way you could actually make a struct, define all the operators, and create an implicit conversion constructor that static_asserts(false) to catch people not using the right type.
>>
>>57406781
this works, thank you, i see how I didn't fully understand what node led to.

>>57406793
yes what the fuck
>>
>>57406798
can't use the enum class

I might look into making the struct if there is no native option. The data is going to encode colors in 16-bits each (RGB), so I probably don't need more than 64-bits. Is there any speed loss with just defining an int inside the class and overloading binary operators?
>>
>>57406814

It helps to actually read type definitions before using them.
>>
Can I get a (you) please?
>>
â–²
â–² â–²
>>
@57406850
no
>>
>>5740685 0
>>
>>57406850
Here you go.
>>
>>57406891
Thanks. I was trying to test something. It didn't work.
>>
>>57406844
>I might look into making the struct if there is no native option. The data is going to encode colors in 16-bits each (RGB), so I probably don't need more than 64-bits. Is there any speed loss with just defining an int inside the class and overloading binary operators?
No, C++ is a zero-overhead language. You can build complicated layers of structs and classes with intricate static checking, and it all disappears at compilation.
>>
@57406882
I should write a userscript that turns @mentions into (You)s, but without the (You).
>>
→57406928
ok
>>
57406939<<
Well, would you use it?
>>
>57406943<
nope
>>
+57406939
You could also write a script to see if the number posted matches a users post, and count that as a (you)
>>
>>57406920

Uh, not all abstractions are cost-free.
>>
File: comfy.jpg (4MB, 4160x3088px) Image search: [Google]
comfy.jpg
4MB, 4160x3088px
>tfw prof was a haskellboo and his pet language he made us use had a functional subset very similar to haskell
>tfw comfy coding in haskell from the start
>>
=57406950
I don't get why nobody wants userscripts. If it were up to me I'd use them for everything.

=57406955
I guess, yeah.
>>
>>57406955
write a script that collects the number of (you)'s you get and stores it as a currency. Then you and other people can exchange you's
>>
>>57406958
Layers of classes and structs are, if all you do is wrap a datatype.
The methods will get inlined, and the classes don't require any extra space
>>
>>57406974
I would if I knew JS.
>>
·57406969
I do use some userscripts... but for specific stuff
honestly, I think userscripts are risky in terms of security
>>
#57407004
What do you mean by risky?
It's just some extra JS stored on your computer, unless you don't trust the author there's not much it can do.
>>
>>57406981

That's true, but it doesn't mean that C++ is strictly no-overhead.
>>
>>57406920
>zero-overhead language
BWAAAAAHAHAHAHAHAHA
>>
>>57407025
It's possible to use abstractions that have non-negligible overhead, yes.
>>
>>57407034
>It's possible
It's possible to have Lua or JS generate more optimal code than C because of their advanced JIT compilers. Guess they are zero-overhead.
>>
>>57407058
You're attacking a straw man.
>>
>>57407062
You are purporting a fallacy. Kys.
>>
Hi /dpt/, how are yo-

>>57407058
Oh shit. R.I.P /g/.

>Google is internet
>Google is Javascript
>Google is evil
>Nuke the Jews.
>>
>>57404824
>Orange pi PC
Glory to the king of cheap ARM-based boards! All hail!
>>
File: poo-in-loo.jpg (327KB, 2000x1000px) Image search: [Google]
poo-in-loo.jpg
327KB, 2000x1000px
Is it possible for me to get the actual character, such as an apostrophe rather then &apos;, when using gets in the requests module in python?
>>
>>57407142
What?
>>
>>57407298
it's a reposting bot
>>
>>57407189
What do you mean?

`response.text` gives a unicode representation.
>>
File: mslain10.png (324KB, 633x692px) Image search: [Google]
mslain10.png
324KB, 633x692px
tfw you realise your OO program is laid out piss poorly and could be done far more cleanly and efficiently with less bugs and beneficial side effects but your motivation just goes down
>>
>>57407800
OOP is a terrible way to design programs.
>>
>>57407808
I find it really difficult to correctly lay everything out. The function and even efficiency isn't always in question, just the core design principles behind encapsulation. The library I'm using is event based and runs a main loop, bound to C++ it's recommended you use an object as a "top level" and everything else is a member variable of that object. Every piece of major code I write just feels like it could be better on a theoretical level.
>>
>>57407706
It still returns apostrophes with "&apos;", newlines with &#013, etc. What I want to know is if there is a way I can make it actually show the symbol instead of the character code or whatever it is
>>
>>57404824
does anyone knows where can i learn how to put an overlay over googlemaps.
Im doing an app similiar to pokemon go and want to show a different map.
>>
>>57407808
If you can't design software for shit, using OOP will rub your nose in it. But not using OOP doesn't make you any less crap, it just makes it less obvious.
>>
File: akakov.webm (320KB, 726x523px) Image search: [Google]
akakov.webm
320KB, 726x523px
well, while I try to find out how to make the special characters appear, here is my markov chain which uses words from Akaribbs
>>
>>57407836
Software design is something that is learnt through practice. It takes 5-10 years of full-time programming before you're actually good at it.

There's some benefit to be had from books which teach it from a theoretical perspective, but not much.

Ultimately, there's tension. In any given situation, there are reasons to do X and reasons not to do X. Only intuition derived from experience will tell you which way to go.
>>
File: C++.png (263KB, 800x720px) Image search: [Google]
C++.png
263KB, 800x720px
>>57404824
>What are you working on, /g/?
God, I feel amazing! I just completed my first commercial software for a client!

>Was a Dedupe and Merge thing in Excel that clears up a bunch of extraneous stuff.
Just submitted it, and if it looks alright, gonna send my invoice within the next couple days!

God, this felt good, even if it wasn't huge!
>And no, I don't like VB, but it was a necessary evil
But, this feels amazing.
Watching it shoot through that database had me on the edge of my seat.
Merging almost half of a 15K record file.
Shoot, it felt good.

Next will be dat website, hopefully, and then... some other stuff if that goes well.
>>
>>57408062

That feeling when shit jest werks is amazing.
>>
>>57408062
Congrats, anon!
>>
>>57408098
Yeah! It was great, because there was so much room to fuck up, but it finally didn't!

>>57408127
Thanks!
>>
>>57407840
What kind of data are you fetching? Is it HTML?
>>
>>57408137
Yea. I am also parsing the data with bs4
>>
>>57408143
Looks like it cone be done with the bs4 library. See here: http://stackoverflow.com/a/28827374/5031828
>>
File: Interrupt pins in ATmega16.jpg (23KB, 545x358px) Image search: [Google]
Interrupt pins in ATmega16.jpg
23KB, 545x358px
>>57404824

> 5 million clks in to 10 microamp mode and chill and she gives you this look
>>
File: akakov2.webm (251KB, 727x526px) Image search: [Google]
akakov2.webm
251KB, 727x526px
>>57408166
Ahh that helped, the HTMLparser library is what fixed it.
>>
>>57406966
The most degenerate thing about this picture is the bright green cup. And I see those kids size underpants on your desk.
>>
File: AkariMaid.jpg (461KB, 808x1200px) Image search: [Google]
AkariMaid.jpg
461KB, 808x1200px
>>57408291
Click on Akarin?
>>
>>57408546
I wanna hug her
>>
File: KissFingers.gif (880KB, 500x281px) Image search: [Google]
KissFingers.gif
880KB, 500x281px
>>57408641
Akari best Yuru
>>
>getline loop throwing a failbit exception at EOF reading from an ifstream
shoot me
>>
>>57408751
>this is defined and intended behaviour
scratch that, blow my fucking head off
>>
Whenever you need a list in C, do you normally make list functions for each individual object, or do you just use a generic solution?
>>
>>57408846

kvec.h
>>
File: Down_syndrome.jpg (8KB, 255x281px) Image search: [Google]
Down_syndrome.jpg
8KB, 255x281px
>>57404824
Learning C++. Could someone tell me or refer me to something to explain why the condition in following code doesn't evaluate to false?

double first = 4;
double second = 3.99;

if(first-second<.01){
std::cout<<"Values are almost equal. <<endl;
}



:0 I'm am confuse
>>
why can't people comment and use reasonable variable names? It doesn't take that long to do and actually makes your code readable

just look at this mess

        #if 1
for (int z=zi-1; z<=zi+2; ++z)
{
float zo=z-zp;
float zo2=zo*zo;

for (int x=xi-1; x<=xi+2; ++x)
{
float xo=x-xp;

float w=1-(xo*xo+zo2)*0.25f;
if (w<=0) continue;
w*=0.1591549430918953f;

ERODE(x, z, w)
}
}
#else
ERODE(xi , zi , (1-xf)*(1-zf))
ERODE(xi+1, zi , xf *(1-zf))
ERODE(xi , zi+1, (1-xf)* zf )
ERODE(xi+1, zi+1, xf * zf )
#endif

dh-=ds;

#undef ERODE

s+=ds;
}

// move to the neighbour
v=sqrtf(v*v+Kg*dh);
w*=1-Kw;

xp=nxp; zp=nzp;
xi=nxi; zi=nzi;
xf=nxf; zf=nzf;

h=nh;
h00=nh00;
h10=nh10;
h01=nh01;
h11=nh11;
}
>>
>>57408880
Floating point rounding errors.
>>
>>57408880
cuz floating point lmao
>>
File: sussman shig.jpg (71KB, 500x375px) Image search: [Google]
sussman shig.jpg
71KB, 500x375px
>>57405603
>he hasn't written a 50kLOC AI program in LISP in the 80s
>>
>>57408892
naming is literally the hardest part of programming
>>
I'm working with file on C andI'm looking for a way toerasethecontentof the file quiqckly without opening and closing it again( fclose(fopen( "file.txt", "w"))) as it takestoo much time for the systm to do it multiple times.

I'm guessing just writing EOF as the first char in the file wouldn't work(or could be bad in the long run?) so is there a way to quickly erase a file?
>>
>>57408892

Was a mathematician responsible for this?
>>
File: 1476953575119.gif (2MB, 380x213px) Image search: [Google]
1476953575119.gif
2MB, 380x213px
>>57408894
>>57408896
Thanks, guys. I'm off to do some research!
>>
>>57404824
> what are you working on
I'm implementing the a* algorithm on the Wikipedia page for Hitler

So whenever I play that game I can quickly know what's the quickest way to get to Hitler
>>
>>57408934
some bulgarian guy

http://ranmantaru.com/blog/2011/10/08/water-erosion-on-heightmap-terrain/

it is a useful algorithm though
>>
>>57407034
Yes, like using CPU instructions with multiple clock cycles to compute an arithmetic expression instead of wiring up your own combinational circuit for it.
>>
File: oy vey brooklyn.png (493KB, 568x371px) Image search: [Google]
oy vey brooklyn.png
493KB, 568x371px
>>57408857
>kvec.h
>kvetc.h
>kvetch
>>
>>57408930
If you're fine using non-standard (but POSIX) functions, use truncate().
>>
>>57408949

Usually it's mathfags and scientists responsible for this kind of shit.
>>
>>57409043
Isn't truncate() working at the same speed as fopen()?
>>
>>57409050
I don't know. Why don't you benchmark it?
>>
>>57405041
no?
in c++ this->x is shorthand for (*this).x
>>
I'm a programming virgin. How would you recommend I go about learning Java?
>>
>>57409117
If you mean virgin in your ass, then go for it.
>>
>>57409117
you'd probably want a rope if you're gonna learn java
>>
>>57408880
>c++ baby
>doesn't know shit about FP stuff
fucking hell, go learn some useful shit like assembler if you really want to understand shit, not fucking c++
>>
pajeet and proud, making a living of only coding 2hs/week.

after that is anime and eating pizza and slacking thinking of killing myself
>>
>>57409140
pahjeets don't watch anime.
>>
>>57409144
then what am i, anon?
>>
>>57409151
pahjeet that wishes he was cool enough to watch anime.
>>
>>57409140

>slacking thinking of killing myself
You are able to afford electricity, a roof over your head, and takeout/delivery pizza on a regular basis on only 2 hours of work per week. Most people would call that "the life". Unless you have some sort of incurable disease, your life is not shitty enough to contemplate killing yourself.
>>
>>57409161
>your life is not shitty enough to contemplate killing yourself.

That's not how it works, Ruby, and you already know that.
>>
>>57409057
Yeah, I'll do that. Thanks!
>>
>>57406814
I was talking with a classmate and saw your post. Join us at osuchan.org.
>>
>>57405470
Monads aren't magic. They're just a way of statically ensuring that the side effects aren't observable, i.e. that your functions are pure. Linear types are another way (IO in Haskell can be seen as a state monad where the linear world is the state).
>>
>>57409166

99% of people who have contemplated suicide have only retarded reasons for doing so.

>I'm just naturally depressed
See a psychiatrist. They have drugs for that. It'll take a year of trial and error, but eventually you'll find some that will work for you.

>I've screwed up my life
You probably haven't. Cut off ties with people you've burned bridges, change towns, find work doing something simple -- even manual labor -- make new friends, build up skills to find better employment, etc... As long as you're not famous, you can always completely start over from scratch.

>Things aren't going my way
Suck it up. Find out what's wrong with you, fix it. Not getting women? Start grooming yourself better, make some friends and learn to behave like a normie. Eventually, you'll find a mate just from being social in the right situation. Parents hate you? Accept that some people are cunts, disown them, start a family of your own and raise your kids differently.

Really, most suicidal people I've met aren't in a position where they are incapable of making their life better. It's just that making their life better is hard, and they want to take the easy way out. And it's even harder for them because they haven't learned to shut off their emotions, so they're not guided by their rational mind, but by their emotional mind which keeps extolling to them the benefits of ending their lives, instead of actually focusing on how to get out of the problem they are currently facing.
>>
>>57409237
What I mean is that, given a monad interface alone, you have control over a resource that is even more restricted than if it were simply linear. So if linear types can make side effects non observable, so can monads. Monads aren't as good at that job in general, but it's also not their only purpose. Haskell just kinda hijacked them from being just an abstraction tool to being a purity tool as well.
>>
>>57409272
>99% of people who have contemplated suicide have only retarded reasons for doing so.

Yes, that's sort of the point. It's mostly impulsive.
>>
>>57409289
I don't know about impulsive
takes a long time to reach a decision like that

maybe you mean clouded by mental illness, it's pretty much never rational to want to kill yourself
>>
>>57409299
>he thinks living & doing things is rational
i miss being young and naive
>>
>>57409299
i honestly believe this thing happens.

https://en.wikipedia.org/wiki/Behavioral_sink
>>
>>57409312
To add.
https://en.wikipedia.org/wiki/John_B._Calhoun
>The conclusions drawn from this experiment were that when all available space is taken and all social roles filled, competition and the stresses experienced by the individuals will result in a total breakdown in complex social behaviors, ultimately resulting in the demise of the population.

This seems awfully accurate.
>>
>>57409289

The world is filled with dumbasses, and I sometimes feel it is my duty to shove my foot up their ass.

>>57409309

Happiness is better than contentedness and is worth experiencing temporary pain to achieve. I would say that n seconds of happiness are worth at least n+k seconds of pain, where n and k are positive real numbers.
>>
Can someone redpill me on anonymous functions? I thought functions were used to reduce code duplication? What's the point of a function you can't call anywhere else?
>>
>>57409350
To be a cross dresser
>>
>>57409299
Read some Camus please. Suicide is one of only two possible ways of revolting against society. The other is passive revolt, google it.
>>
>>57409360
im sure you have no need for that to be a crossdresser anon ;)
>>57409337
there's no reason to be happy so being happy is not better than being sad, I was expecting people to have a more objective and nihilistic outlook on life here
>>
>>57409350
Anonymous functions are useful as parameters to higher-order functions (functions which take functions as arguments). If the only use of a function is as an argument in a specific function call, there's no need to give it a name.
>>
>>57409350
They are to be used with higher order functions, that is functions that take function as input, produce function as output or both.

For example, let's say you want to append a space to the end of every string in list. Easiest way would be to pass anonymnous function to map:

 (define (append-space-to-strings lst)
; we pass anonymnous function to map
(map (lambda (str) (string-append str " ")) lst))

(append-space-to-strings '("Hello" "World" "!")) ; => '("Hello " "World " "! ")


Other example is writing functions, which generate new functions. For retarded example, if you are generating two parameter functions from:

 (define (generate-two-param operation)
(lambda (x y) (operation x y)))

(define add (generate-two-param +))

(add 2 3) ; => 5
>>
>>57409417
Sorry for horrible indentation and colorizing, 4chan messed it up.
>>
>>57409376
the myth of sisyphus is laughable as a deterrent to suicide
>>
>>57409458
Read stranger, his philosophy is more explicit in it.
Myth of sisyphus is basically about complying with system. Due to your socialization and ideology you think your life is normal and right, even if it's suffering, so you are "happy".
>>
>>57409458
>>57409464

Not a deterrent, more like an accelerator.
>>
>>57409417
racket or scheme
>>
>>57409380

>there's no reason to be happy
There are plenty of reasons. Long term happiness can be caused by finding a purpose in life that fulfills ones value system well, and short term happiness can be found from good food, fine wine, and making love to a woman or man with whom you enjoy the company of.

>I was expecting people to have a more objective and nihilistic outlook on life here
Mate, I consider myself a rational skeptic, and have no religion to influence my outlook on life. I nonetheless see no reason not to enjoy life for what it has to offer, however short it may be.

>>57409350

>What's the point of a function you can't call anywhere else?
With anonymous functions, the point is to be used as callback functions, and possibly closing over the environment they are in to manipulate certain variables.

But it is worth noting that there is nothing wrong with making a function that is only called once, if only to make it easier to separate your program out into logical components.
>>
>tfw just wanna be a good code-monkey and get paid
>>
>>57409480
> Long term happiness can be caused by finding a purpose in life that fulfills ones value system well, and short term happiness can be found from good food, fine wine, and making love to a woman or man with whom you enjoy the company of.
But those are not reasons...
>
Mate, I consider myself a rational skeptic, and have no religion to influence my outlook on life. I nonetheless see no reason not to enjoy life for what it has to offer, however short it may be.
I am not saying there's a reason to not live, but I am not saying there's a reason to live and be happy either. It's just amusing when edgy kids come here trash talking suicidal people not having the mental capacity to understand that life has no purpose and its not "intelligent" to stay alive.
Also ew roasties, boipucci is best pucci
>>
>>57409479
racket, but it's practically same shit anyway. Racket is basically just scheme with some nice additions and standard libs.
>>
File: 1466795089344.gif (2MB, 90x90px) Image search: [Google]
1466795089344.gif
2MB, 90x90px
>>57409492
>rational skeptic
>>
>>57409498
will racket make me happy?
>>
>>57409502
You don't need this old crap. Here is official new one:
C - K&R C
Lisp - Racket guide
Perl - man perl
>>
>>57409272
>It'll take a year of trial and error, but eventually you'll find some that will work for you.
Try 12 and counting.

>Really, most suicidal people I've met aren't in a position where they are incapable of making their life better. It's just that making their life better is hard, and they want to take the easy way out.
This is false. At least the "easy way out" thing. It's not a matter of not knowing how to make my life better, or not being willing to do it. It's just very hard to justify putting in a single ounce of effort into improving my life when I honestly believe it's completely worthless and I'm just waiting for everyone who loves me to die so I can finally off myself.

Basically you're trying to approach depression from the point of view of someone who doesn't have it. I'd like to explain what it looks like from my point of view but I don't know how to effectively explain it... Aside from maybe using dumb metaphores like
>sure life is a walk in the park but I'm wearing 100 lbs shoes and everyone else is barefoot
Or some cringy bullshit like that.
>>
>>57409509
It's comfy. Base racket is basically multiparadigm version of scheme. Then you have typed and lazy dialects. You even have pattern matching in base racket.

Libs are powerful, and there is quite some of them (compared to scheme dialects).

OOP is decent, it's fairly typical (doesn't have generic methods like common lisp), so easy to learn but not as powerful.

Macros are practically the same as in scheme.

So yeah, it will make you happy anon, it will. But it will also leave you dissatisfied with all mainstream languages.
>>
>>57409514
Thanks lad
>>
>>57409337
>Happiness is better than contentedness and is worth experiencing temporary pain to achieve.

Depession can be thought of as the inability to experience happiness.
>>
>>57409532
take this chat /out/, will you?

it seems /sci/ containment board is leaking.
>>
File: smug.jpg (95KB, 724x720px) Image search: [Google]
smug.jpg
95KB, 724x720px
>>57409507
>not noting it was a quote of him
>>
>>57409492

>But those are not reasons...
These are reasons why our internal reward circuits cause us to feel happy, and there isn't good enough reason for us to not feel happy for doing any of these things.

>life has no purpose
You have to give it purpose, stupid. You got tossed into a sandbox full of tons of interesting shit, and you chose to do nothing because you're completely uncreative.
>>
File: msm1.jpg (272KB, 953x1200px) Image search: [Google]
msm1.jpg
272KB, 953x1200px
It went 0 to r/getmotivated in here pretty quickly
>>
>>57409527
wait, it has lazyness & pattern matching??
I"ll try it, thanks pham.

also, how are ffis (particularly to c)
>>
>>57409559
here i noticed you, hope you feel better now
>>57409548
>all this name calling for questioning his mind
gee, and here I was hoping one can have a rational argument with you. have a tampon lol
>>
>>57409600
>here i noticed you, hope you feel better now
ah yes, the good old "no, you're trying to get (yous)!". A classic play when complaining about mental health on a technology/anime board.
>>
>>57404937
main issue is abstraction and debugging
>>
my motivation is never there

i need a hug anons
>>
Im trying to make an online tbs and im having some issues visualizing how networking would work when i have to update 100+ tiles information in a single request

I found some resources on it but mostly for rts, and they won't help me

Does anybody at least knows what a decent byte size for the packets would be? Is 1024 enough?

Should i fuck the request model and use sockets? I was hoping not having to do this because i wanted to also make a web-version of it using http and a "relay" to the actual server
>>
>>57409650
Also, dividing chat and game on different ports??
>>
>>57409650
>Does anybody at least knows what a decent byte size for the packets would be? Is 1024 enough?
Doesn't matter at all. You use TCP. HTTP requests are fine too. You send a request and the server responds with a big JSON blob. You're worrying about technicalities that have already been handled for you by lower layers.
>>
>>57409686
So there won't be clogging?
>>
is is weird that I like to put small, subtle references to my waifu in my code?
>>
i'm in love with lisp syntax
i love macros
why does nobody use lisps again???
>>
I updated my Python script for downloading torrent files.
#!/usr/bin/env python3

import os
import urllib.request
import xml.etree.ElementTree

CONFIG_FILENAME = os.path.join(os.sep, os.environ['HOME'], '.matcha')
TORRENTS_DIRNAME = os.path.join(os.sep, os.environ['HOME'], 'torrentz')
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
}

with open(CONFIG_FILENAME, 'r') as f:
for url in f:
req = urllib.request.Request(url, headers=HEADERS)
res = urllib.request.urlopen(req)
feed = res.read()
root = xml.etree.ElementTree.fromstring(feed)
for item in root.iter('item'):
title = item.find('title').text
title = title.replace(os.sep, '-')
filename = title + '.torrent'
abs_filename = os.path.join(os.sep, TORRENTS_DIRNAME, filename)
if os.path.isfile(abs_filename):
print('{} exists'.format(filename))
continue
print('{} new'.format(filename))
link = item.find('link').text
req = urllib.request.Request(link, headers=HEADERS)
res = urllib.request.urlopen(req)
torrent = res.read()
with open(abs_filename, 'wb') as f:
f.write(torrent)
>>
>>57404824
Writing graphics library from glsl up. It's ass
>>
>>57409704
Nah senpai, the server should literally only have to do
Send(MarshalJSON(<yourTileData>));

And the client should only have to do
<yourTileData> = Receive(UnmarshalJson(<serverResponse>));

Unless you are sending many megabytes at a time it'll work without a hitch. If you are sending many megabytes, it'll work just the same but there'll be a noticable delay, so you will have to add a loading screen or something. A million ints is probably 4 mb, which will take a second or two between decent modern connections.
>>
>>57409714
I just started learning Lisp right this minute! It looks cool!
>>
Any SQLite mapper that I can use in java so I dont have to open and close connections everytime?
I can write my own my I don't want to reinvent the wheel and make novice mistakes
>>
>>57409759

>urllib

use requests, anon
also you gave me an idea for a script
>>
>>57409791
If the data is real real big, he could use msgpack (binary json, faster and more compact)
>>
>>57409650
> Should i fuck the request model and use sockets?
What's the request rate? If it's more than once a second, it would be good to avoid requiring a full open-request-response-close cycle In theory, HTTP pipelining would solve the problem; in practice, most web browsers don't support it. So you'd be looking at server-sent events or websockets.
>>
>>57409831
How's it supposed to know when to close them? (Open question, there are many possible solutions so you need to narrow it down.)
>>
Currently writing a server / client app that uses tcp to send requests to the server and udp to send a constant feed of data to clients , which is working good so far.

If I get network problems for like 10 minutes after testing server / client applications am I right in believing I might somehow be flooding udp and tcp ports on my nic ?
>>
>>57409915
>flooding udp and tcp ports on my nic ?
ctrl+shift+esc, network tab, pretty easy to check.
>>
For a server which handles loads of users, is it better to use a multi-process or multi-threaded approach?
>>
>>57409587
C ones are quite good, I don't know about other languages.

Also racket has very good support for making languages. Since it uses language as library model, you can easily use lazy dialect with typed libraries (combining dialects is easy). So you have a lot paradigms (lazy, typed, logic, ...) that all act well together.

>>57409714
>>57409804

Don't forget that languages are just tools.
If I need strong type sytem and heavy abstractions I will use haskell.
If I need speed I will use C.
If I need GPU I will use futhark.
If I need to do something on bare metal, I will use forth.
If I need oop I will use smalltalk.
If I need a language that doesn't yet exists I will use lisps.
And if I need some duct tape to connect all this together, well I will use perl.
>>
>>57409932
If loads means 15, use either one of those.
If loads means 100s to 1000s, you'll need async/non-blocking sockets.
>>
File: ARM software blows.png (10KB, 502x94px) Image search: [Google]
ARM software blows.png
10KB, 502x94px
Why do experts say that ARM software fucking blows?
>>
>>57409950
what if I am not using sockets?
>>
>>57409942
you seem to use old langs like smalltalk
is that good for business?
aka, do they do their job well for you
>>
>>57409959
You are.
>>
>>57409969
n-no
>>
>>57409991
How do your users connect to your server?
>>
>>57409991
https://en.wikipedia.org/wiki/Network_socket

Are you serving 100s of users over a serial port?
>>
>>57409998
let us say I was

or maybe I2C

how would you delegate resources to multiple users?

Threads?
Async event handling?
>>
>>57409963
smalltalk is the language which defined oop (it wasn't the first, but it was the best of the first ones).

It still has the best oop (close second is common lisp's clos).

What you lose in libraries you gain in productivity.
>>
>>57410007
I know from experience that the overhead of doing thousands of thread context switches a second is unacceptable. If you actually were using a single serial port it probably wouldn't matter because the bottleneck wouldn't be the CPU anyway. But for the sake of argument, you'd have to implement your own async event handling of some sort, see: https://en.wikipedia.org/wiki/Asynchronous_I/O#Forms

Maybe Epoll would be appropriate? I'm not sure.
>>
>>57410060
thanks
>>
>>57410060
>>57410070

If you are free to chose a language use elixir or erlang it's great for async.
>>
File: wew2.png (2KB, 417x32px) Image search: [Google]
wew2.png
2KB, 417x32px
>>57409925
>>
>>57410099
Use a less shit OS or download a program to monitor NIC usage then. Do you want me to tie your shoes for you as well?
>>
>>57410060
>>57409998
So I found what I needed

thread pools
asynchronous handling over few threads
>>
New thread:
>>57410200
>>57410200
>>57410200
>>
>>57410138
Async =/= multithreading.
>>
>>57406920
You might have a point at higher optimization levels, but I'm not going to get past debugging flags for a while. I just want an improvement over a four-way std::tuple
Thread posts: 314
Thread images: 26


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

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


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