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



Thread archived.
You cannot reply anymore.




File: 1539852316035.jpg (142 KB, 1000x787)
142 KB
142 KB JPG
Old thread: >>68412433

What are you working on, /g/?
>>
why you girls keep calling each other brainlets
>>
File: 1472860069099.png (191 KB, 600x979)
191 KB
191 KB PNG
Please don't post a new thread right after I post my question please. I kind of want to make something with vulkan but have no idea what. Is there any kind of libraries or tools that people need for it? GLFW already has support for it so I couldn't do something like that.
>>
>>68416837
>C isn't a functional programming language
>>
>>68416856
who are you quoting
>>
>>68416856
what is this cancer. just use rust
>>
>>68416856
now this is epic
>>
>>68416878
Nothing can be done about people who treat a job as a job
>>
>>68416855
Not that it's really something for _you_ to do, but I'm currently working on prepping my wayland compositor's internals so that Vulkan support is possible.
Someone else already did the work for Vulkan support, but they're going to need to refactor the shit out of it.
>>
>>68416837
Want to create a little program that lets me create a graph, drag nodes, and calculate shortest path and other basic graph algorithms through adjacent matrices, implementing all of them by myself. I will not deal with big ass graphs, so im not that worried about efficiency, but still. It will be called 'grafito', need a logo


What language should i use? i was thinking about Rust
>>
>>68416855
>Is there any kind of libraries or tools that people need for it?
No? Vulkan IS the library
>>
>>68416922
he doesn't mean a higher abstraction on top of vulkan
>>
>>68416856
>preprocessor hacks
Not part of the language. Might as well transform your codebase with sed or awk before compiling.
>>
File: 1425788295073.jpg (35 KB, 468x317)
35 KB
35 KB JPG
>>68416897
>>68416922
I guess I'll just keep making my dumb toy projects then. I just wanted to be useful for once.
>>
>>68416968
Utilities made by amateurs aren't useful
>>
>>68416917
This is impossible to do with a CLI program.
>>
>>68416917
why don't you just implement the algorithms in neo4j
>>
File: sad moth.png (166 KB, 334x657)
166 KB
166 KB PNG
>>68416980
>>
File: 1492832377473.png (769 KB, 1052x1342)
769 KB
769 KB PNG
>>68416953
hasklets cope
>>
>>68417021
if it's useful to you that's all that matters
>>
>>68417034
yeah, just program your own shit until you're actually good
>>
>>68417022
GHC also supports the C preprocessor
>>
File: 1447021850758.jpg (143 KB, 638x680)
143 KB
143 KB JPG
>>68417034
>>68417043
There's literally nothing I want to make or do. Why do you think I'm asking you guys? Give me something to do NOW.
>>
I feel like I'm wasting my time with HtDP and should have gone with SICP instead.
This is such a slog.
>>
>>68417061
Then why are you programming?
>>
>>68417021
he's wrong desu, make tools that help you do what you like to do. If there are others who do things you like to do, they will find those tools useful. I made a program that generates Make-formatted lists of source files to make it easier to update the makefiles for my projects, and now a couple guys at my work use it.
>>
>>68417061
program a gf
>>
>>68416856
very based
>>
>>68417074
I'M NOT THAT'S THE PROBLEM.
>>
>>68417061
Program me a yandere moth gf
>>
>>68417075
>guys at my work
then you aren't an amateur obviously
you don't know how much time people waste dealing with shit tools and libs written by enthusiastic amateurs who've never programmed anything real
>>
>>68417096
I'm 20 desu, I'm an intern. The tool I wrote was my first real attempt at using Nim.
>>
>>68416917
>drag nodes
you're going to have to write your own terminal emulator, first
>>
File: 1510479971093.jpg (344 KB, 615x1000)
344 KB
344 KB JPG
>>68416837
DPT please vary your images and characters!
>>
How do shaders work in big 3D projects (like games)?
I've never done anything with 3D and I am trying to learn opengl, it might be that I just don't know enough yet
but I don't understand how a game renders something from a mesh because all these intro to opengl tutorials
have you making individual vertex and fragment shaders for different sets of vertex data(for a triangle, for a square, etc).
would a game engine have one big shader program to interpret, lets say .nif meshes from bethesda games (containing the vertex data and mesh attributes?),
to usable vertices for the rendering pipeline? then for individual special cases like effects and stuff have different shaders for a different set of meshes (like spell effects)
sorry if its vague or a stupid question, but I couldn't think up the wording to question to just google search it.
>>
>>68417376
raster rendering engines are hacks built on top of hacks to approximate what something might look like if you raytraced it.

start with raytracing
it's slow but it's easy to understand. Everything derives from raytracing anyways.
https://www.youtube.com/watch?v=Q1cuuepVNoY
Khronos probably has raytracing extensions for vulkan by now.
>>
>>68417376
It's actually a good question, the way shaders are designed is not very modular so it's really an open problem. Most big game engines have some sort of shader preprocessor that allows you to include multiple source files together to build up shaders, and some people do a "megashader" which is just one single big shader that can be compiled with different settings to generate all the different programs you're going to need. Generally you have one shader that handles nearly all ordinary mesh data, and you have different shaders for other tasks like shadow, post-processing, rendering fonts or GUI , etc. Nobody ever has different shaders for different mesh shapes. All meshes are just fed in as generic vertex data
>>
>>68417186
>DPT
What?
>please vary your images and characters
I don't save very many tasteful images of cute anime grils so I run out of them often.
>>
>>68417409
retarded post
>>
File: 1375773299400.jpg (19 KB, 425x419)
19 KB
19 KB JPG
>>68417376
I've wondered how they do that too.
All I've really done is shitty 2D compositing with OpenGL.
>>
>>68417448
>I don't save very many tasteful images of cute anime grils so I run out of them often.
Well you should.
You should have lots and lots of them.
Otherwise you're just a dumb ironic weeb.
>>
>>68417451
retarded person
>>
>>68417409
thanks for the link, I would like to learn raytracing as well but I might as well understand raster rendering first since most everything is currently using that technique
even if raytracing is arguably better.

>>68417444
Ok that makes sense, a preprocessor or one hueg shader sounded like the only viable option for game engines. I understand why the tutorials start with single shaders for
simplicity but wasn't sure of the bigger picture. thanks for the help.
>>
>>68417540
realtime raycasting isn't going to be a thing unless we have a signficant increase in processing power so there's no point learning about that now, you're giving someone anti-advice because you think you're smarter than you are
>>
File: basicallyhaskell.png (136 KB, 948x650)
136 KB
136 KB PNG
I have done it
>>
>>68417562
literally nobody mentioned realtime raytracing
I said "raytracing is easier to understand"
>>
>>68417471
that is all I am doing currently as well, but I have a bad habit to get a question that is way outside my realm of knowledge and I can't focus on the easy(er) stuff
until I get a basic idea of how the more advanced stuff works.
>>
File: 1538855311664.jpg (148 KB, 1366x824)
148 KB
148 KB JPG
>shitpost too hard in the work slack channel
>boss tells me to stop

albums for this feel?
>>
>>68417576
that's irrelevant to the question of how shaders work in big projects
>>
>>68417585
Whichever one convinces you to jump off a bridge
>>
>>68417591
wow rude
>>
>>68417585
dumb help helper poster
>>
>>68417588
>my shaders operate on completely different structs and textures and bounded volume hierarchies
lmao sure pal
>>
>>68417593
Put a rope around your neck and tighten it as much as you possibly can
>>
>>68417601
what?
>>
This is a very simplified scenario to my actual situation but, which would be considered most efficient to a college professor?

Each day I want a message to pop up for 30 days, giving me a random fact.

Should I do,

print("motd1")
sleep 86400
print("motd2")
sleep 86400
and so on

or

array of motd
for key,v in ipairs(array) do
print("v")
sleep 86400
end
>>
>>68417607
if you don't know a goddamn thing about rendering then shut the fuck up
>>
>>68417611
What you're saying has nothing to do with the conversation topic
>>
>>68417609
the first one is more processor efficient the second one is more developer efficient
I would choose the second
>>
>>68417615
You completely misinterpreted his problem
His problem was that OpenGL tutorials are extremely opaque and take an excessively long time to get from triangle to scene
The ANSWER is to forget all of the triangle rendering Z-buffer bullshit and get to the CORE of the problem, which is to develop shader materials for larger applications.

What YOU'RE telling him to do is learn all these useless nitty gritty details that are only good for high performance applications.
What he WANTS to learn is how to build an application in the first place.

You've excellently put the cart before the horse because you're obsessed with muh realtime muh gaymes
>>
>>68417621
It seems to be static. There's no function that could be changing anything. It's just predefined strings that get printed, and only 30 of them. Try both and I highly doubt there would hardly be any difference at all.
>>
>>68417648
His question was "how to big projects handle shaders" you slobbering autist
>>
>>68417652
"how to big projects" for any goddamn domain could be answered by taking a class in basic fucking software engineering.
Gaymer faggots are too obsessed with sucking their idol's dicks that they don't see the forest for the trees.
In this case, your trees are all of these retarded proprietary formats and pipelines that matter to nobody but the people who developed them
>>
>>68417651
That's assuming optimizations which may or may not exist, that looks like lua which I don't think has an idea of static
>>
>>68417663
lmao what the hell are you talking about
he asked how games handled shader architecutre
>>
>>68417664
I'm going to install Lua and test it out then.
>>
>>68417669
"basic fucking software engineering"
how is this so hard to understand?
There's nothing magical about architecture.
You just compose smaller solutions to create larger solutions.
Is there even a real question?
You want me to change your diaper too?
>>
>>68417690
It's a practical question about a practical situation, shader architecture is pretty puzzling given it has constraints and quirks that don't exist in normal programming
what got your panties in a bunch
>>
>>68417376
>How do shaders work
here u go dude ignore the arguing dpt autists

https://en.wikipedia.org/wiki/OpenGL_Shading_Language
>>
>>68417569
someone who uses haskell, give me more things to recreate in C
>>
>>68417703
post source code first
>>
>>68417699
"""realtime""" programming is no different from normal programming except you're usually developing for a specific system with specific constraints in respect to latency and runtime.

When you're developing software in general you're supposed to enumerate ALL of the metrics that matter to you and develop to those standards. The architecture will arise naturally from the constraints.

Specifically in respect to """realtime""" systems the hardware constraints are often significantly more pronounced than other more abstract constraints.

This is of course assuming somebody actually knows what constraints are important to them and how to program to those constraints... but if you can't do that then you have bigger problems.
>>
>>68417734
what are you talking about
>>
>>68416837
Lisp is the most powerful programming language.
>>
File: 1491773227079.gif (63 KB, 800x815)
63 KB
63 KB GIF
>>68417738
whatever I'm done with you
>>
>>68417739
Linked lists are the most powerful data structure
>>
>>68417744
you're trying to help someone by suggesting something completely unrelated to the problem because you seem to have a mental illness
>>
>>68417716
see >>68417569

>>68417734
the easiest way to summarize it is that correctness for a real-time application is based not just on correct output for any given input, it's also contingent on the time at which the result is delivered.
true, perfect real-time is not universally possible because of the halting problem, but real-time software development focuses on creating software whose maximum running time is provable.
>>
>>68417680
Apparently sleep isn't a bash command even though I can run it in terminal. But I don't feel like messing with Lua.

Just printing "This is a test." 10 times took 0.002 seconds. Using a for loop to print "This is a test." took 0.002 seconds. Putting "This is a test." 10 times in an array and looping that took 0.45 seconds.

So >>68417664 you are correct my friend.
>>
>>68417757
you seem to so completely unfamiliar with the domain I don't know why you even bother to respond.
This is like trying to teach a paraplegic the similarities between walking and running.
>>
>>68417782
I 'understand' what you're talking about, it just has nothing to do with anything being discussed, making you sound like you're insane
>>
>>68417794
You're just an idiot. Architecture is architecture is architecture.
>>
>>68417814
There isn't one simple answer for every architecture question
Architecture is the most complex thing about software development
In the case of shaders, you usually don't want to break down your shader into smaller problems, you want to put it all together in one big shader with conditional compile flags
>>
File: 1532443928520.gif (75 KB, 397x345)
75 KB
75 KB GIF
>>68417569

https://www.youtube.com/watch?v=cs926AIL-ck
>>
File: 1540592337163.png (332 KB, 692x628)
332 KB
332 KB PNG
I don't understand the _name naming convention, what is the _ supposed to tell me?
>>
>>68417836
usually it means something is private
>>
File: 1500435864336.png (250 KB, 720x1110)
250 KB
250 KB PNG
>>68417740
SEETHING HASKLET
>>
>>68417836
https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles

>_single_leading_underscore: weak "internal use" indicator. E.g. from M import * does not import objects whose name starts with an underscore.
>>
>>68417836
it means there's an underscore in the name
>>
>>68417836
It depends. Some languages use it is "private".
Some languages use it as "unused".
>>
>>68417827
Designing an architecture for a system should be something that anyone should be capable of doing, even if that architecture is shitty.
At least if you have a shitty architecture people can make real suggestions and point out aspects that may have been ignored.
>>
Anyone familiar with pygame? How do i make a key press only call one event without using sleep or break?
>>
>>68417850
Thank you
>>
How does one who's brain has been fried with scripting and functional programming learn OOP? Objects, instances, extensions, etc. Makes my brain hurt trying to learn OOP languages and think I should take a step back and learn OOP programming first.
>>
is this the most /based/ official build guide?
https://www.youtube.com/watch?v=2gIqOOajdYQ&hd=1
>>
>>68416856
As soon as you want fast lazy evaluation, you'll be competing with the most robust graph reducing VM (i.e. GHC). Cute preprocessor tricks though.
>>
File: 1374580566292.jpg (9 KB, 344x209)
9 KB
9 KB JPG
>>68417951
>Typing shit into the terminal to "talk" to the audience
>Extremely obnoxious dubstep music
>Doing something extremely simple and specific
No, it's fucking shit.
Barely a step up for the thick-accented Indians typing shit on Windows notepad.
>>
>>68417903
use pygame.event.get(), pygame has event types like pygame.KEYDOWN, which has things like K_UP, K_DOWN, K_LEFT, K_RIGHT, etc.
>>
>>68417988
Thanks
>>
>>68417968
>implying all turing-complete languages are not effectively equivalent in capability
>implying I haven't already created an algorithm for doing reference counting on objects with circular references that can easily be converted into a graph traversing tool
now you're just encouraging me
>>
>>68417932
Okay, so let's say you want to make an object. Create a class named Rectangle. This is your object. The object can store data. For this example, your Rectangle object has a length and a width. So you create a variable length and width. Then you need a function to construct the Rectangle. So you create a function Rectangle with 2 integers. One for length and one for length.

Now in any other class where you want to create an object Rectangle, you create an instance of your Rectangle class. So it would be Rectangle myNewObject = new Rectangle(length, width).

Let's say you want to do something with the rectangle. Just go back to your Rectangle class and make a new function. You want to get the area of the rectangle for example. Create a function getArea that returns length multiplied by width. Now wherever you are using an instance of the Rectangle class and want to get the area of the Rectangle object you made, you can use myNewObject.getArea() to use that function from the object's class.
>>
>>68418076
you should've just posted a link to somebody who knows what they're talking about
>>
>>68418104
But everythings an object
>>
>>68416837
I am about ready to punch my fucking computer. Does anyone here have any experience with memory mapping with the windows API in c++? Specifically with the MapViewOfFile()?
>Trying to make a database for my program using memory mapping because the files can get over 50GB
>Created a class to handle the memory mapping
>system granulation is 64K
>using 128 byte entries for DB
>for example entry 510: ((510 * 128) == 65,280
>Mapping class maps the entire file, then allows for jumping around using MapViewOfFile
>maps fine until I get to 512 which is equal to the system granulation (65536)
>Handles all check out, everything looks right (I think) but it throws a segfault.

>Output from the program, lines up with the debugger but this is much easier to copy

>CONST_BUFFER_SIZE is 128 for the size of each entry.
>p_Position == This is the entry desired such as 510 but translated into bytes by multiplying by buffer size.
>MMap_Starting_Offset = ((p_Position / ((unsigned long long int) system_Granulation))) * (unsigned long long int) system_Granulation;
This must be a multiple of the system granulation (as far as I know)
>MMap_View_Size = CONST_BUFFER_SIZE + (p_Position - MMap_Starting_Offset);
>MMap_Current_Position is just the p_Position
>MMap_View == Handle to view
>MMap_Current_Position_Data == Handle offset into THE FUCKING PROBLEM

512
MMap_Starting_Offset->65536
MMap_View_Size->128
MMap_Current_Position->65536
create_Mapping_View :: LastError():0 MMap_View:0x160000 MMap_Current_Position_Data:0x170000

HOLY FUCK NVM FOUND THE ERROR TYPING THIS FUCK YEAH
>MMap_Current_Position_Data = ((char*) MMap_View + MMap_Current_Position);
should have been
>MMap_Current_Position_Data = ((char*) MMap_View + MMap_View_Current_Position);
Had this error for a month, overlooked something so fucking stupid jesus fuck.

For newbies who are stuck on a problem, presenting it online to get solved by gathering and explaining everything can may let you see errors you overlooked.
>>
>>68417932
It is just a way to help organize and reuse code. Imagine if you didn't have functions and had to retype all of the code everytime you wanted to use that function including variable declarations. That's how you look at non OOP after you learn it. I hated it at first and didn't see the point. Then I got into a massive project and rewrote the whole thing a year in using an OOP approach because it became a huge fucking mess. Never going back.
>>68418076
This man gets it.
>>
>>68418222
you should've just posted a link to somebody who knows what they're talking about
>>
So I'm playing around with a pretty simple project in R. Ive loaded an excel table as a data frame and I want a for loop that goes through each row and prints DELET THIS if the row contains nothing but NA values, whats the simplest way of doing this? and how can I delete the row as well?
>>
>>68418242
Emulator
>>
Anyone know if it's possible to host a nodejs REST API with MongoDB on a Synology NAS
>>
>>68416981
> Impossible
First, of all, bitch
>>
I keep seeing people say the mirai botnet is really good code but I'm too much of a brainlet to understand why.
>>
>>68418411
because it was made by a fucking weeb
that's literally it
>>
>>68418104
>>68418241
kys
>>
>>68416917
Try making a webpage where you can get the mouse coordinates on click within a section of the page. Then try to rasterize the coordinates into a defined grid. That's how I would start.
>>
>>68418411
>>68418433
Where was the source even posted first? What forum?
>>
( this->*f )(args...)

Why is this the syntax for calling member function pointers?
( *f )(this, args...)

Seems so much more natural. Am I weird for having thought about member functions like this? Just normal free functions with a this pointer passed in as first argument.
>>
>>68417975
It's a video recording of a tty recording. It makes a lot of sense to make that in a tty recording.

Of course you'd have an abbreviated tty recording too.
>>68417951
It's a real shame they didn't include just a second or two of silence at the start of the video so the git command syncs with the 'drop'.
>>
>>68418951
You shouldn't think of them like that.
Think about a virtual function for example. That's not a free function pointer, one needs to indirect through the object to find the implementation. Syntactically what you're doing is decoupled from what you're doing semantically.

g++ has an extension that lets you convert between free functions and member functions but thats not standardized c++
>>
>>68418983
>Think about a virtual function for example.
I'd rather not. I assumed they (virtual) didn't work with function pointers.
>Syntactically what you're doing is decoupled from what you're doing semantically.
Fair enough. I see the point in not making it normal.
>>
>>68418989
Pointers to virtual member functions can be used, yes.
>>
>>68413585
In periods I do for Uni, but it's usually limited to Mathematica so I wouldn't be able to use something like this. I could see it being useful for latex users though, at least for starting out.
>>
File: fuck.jpg (16 KB, 500x256)
16 KB
16 KB JPG
>>68416837
College is making me hate CS and programming
>Each class expects hours of work on projects outside of class
>Commute and hour
>I live off campus and work weekends 2pm-11pm so weekends are useless for getting work done
>just depressed and stressed all the time

I should've just gone into IT.
>>
just spent the last 3 hours hauling wood logs

https://www.youtube.com/watch?v=ETfiUYij5UE
>>
>>68419024
nah mate,what nobody tells you that college expects that you already mastered what they are "teaching".
>>
How do I get started making an AI waifu?
>>
>>68419066
AMD MI60 + pic related
>>
>>68419024
I hear you bruv. 55 hours a week work on top of full courseload. Every semester theres that one teacher who thinks all i have in the world is their class. ~8 hrs a week not counting studying. Thank god for quizlet
>>
>>68418242

This is what I came up with, log_inc is the matrix I'm working with:

for (i in 1:nrow(log_inc)){

nacount<-0

for(j in 1:ncol(log_inc)){

if(log_inc[i,j]=NA){

nacount<-nacount+1

}if(nacount=length(log_inc[i,])){

print(paste("Delete row #", i))

}
}
}
>>
File: nwahsbeware.png (472 KB, 720x715)
472 KB
472 KB PNG
>>68419116
>tfw quizlet won't write a cache simulator in C for me
>>
>>68419116
>>68419171
>tfw shitty university course
I had to go out of my way and even to different faculties to get to program in anything that wasn't java or python. I coasted through but lost all motivation to program.
>>
>>68419114
>AMD
Is it even worth it to try and port this? Probably not.
>>
>>68419199
MI60 is a datacenter card with 1 TB/s memory bandwidth.
Considering that Google,AWS and MS are already switching to it I would say they are becoming new standard.
>>
You can't rust spell without trust.
>>
>>68419275
This is your brain on Rust.
>>
https://github.com/hliberacki/cpp-member-accessor
> Header only, fully template based library which enables accessing private data members. Techniques used by this library to achieve its purpose are fully legal and allowed by the standard.
> accessing private data members
> fully legal and allowed by the standard
Thanks, Bjarne.
>>
>>68419024
>Each class expects hours of work on projects outside of class
... what did you expect?
>>
File: GLoTR.png (5 KB, 1239x54)
5 KB
5 KB PNG
>>68416837
I'm generating some texts with LSTM in python.

Learning base is made from first 6 chapters of Lord of The Rings ^^ a little over 200k characters

Picrel is generated with gen17 of model made by 12 hours of training (11849 cycles)
>>
>>68419384
I think Bjarne has just checked out by now and counting the days until sweet release.
>>
>>68419507
He's not done until concepts are in the standard.
>>
let's say i have an array that is 200x200. how do i set each point acccording to the array to a pixel with a color that roughly equates to every color on the spectrum?
>>
File: Untitled-36.png (29 KB, 199x197)
29 KB
29 KB PNG
>>68419607
this is my best attempt...absolute hsit
>>
I love pajama waifus <3
>>
>>68419531
Concepts are gay and unnecessary.
>>
>>68419384
I don't follow. Isn't that what 'friend' is supposed to do?
>>
>>68419654
A class declares its friends, you can't make friends with an class that is already defined and is not your friend.
>>
>>68419659
OK. So why are we testing code we don't control?
Or am I just out of touch with how people work in software.
>>
>>68419607
colors are three dimensional
you need a 256 x 256 x 256 array
>>
>>68419224
what do you do with all that memory bandwidth
>>
File: file.png (4 KB, 200x200)
4 KB
4 KB PNG
>>68419623
Here's mine. No idea about color theory but it looks okay.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CImg.h"
using namespace cimg_library;
int main(/*int argc, char* argv[]*/) {
int height = 200;
int width = 200;
float step = 255.f / (float)height;
// cimg
CImg<unsigned char> image(width, height, 1, 3);
image.fill(0);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
unsigned char red = ((float)i * step);
unsigned char blue = ((float)j * step);
unsigned char green = ((float)((i + j) / 2) * step);
unsigned char colour[] = { red, blue, 255-green };
image.draw_point(i, j, colour);
}
}
image.save("file.bmp");
return 0;
}
>>
>>68419674
You shouldn't, this is a stupid hack no sane language should allow.
>>
>>68419701
Once you fill up the VRAM of the GPU you need to move your data somewhere.
So you shift 32GB chinks of data via 4.0 PCI-E at 1TB/s.
People use it for machine learning and things like that.
>>
File: 80331335.jpg (49 KB, 397x378)
49 KB
49 KB JPG
Using regex in python I can find and replace, but it only replaces what it finds with a static string. I want to take whatever it finds and replace it with what it found but with the characters reversed?
>>
File: sdg.png (18 KB, 199x198)
18 KB
18 KB PNG
>>68419730
didn't work

for array(x,y):
drawPoint(x,y,rgb(x*255, y*255,((x+y)/2)*255))
>>
>>68419793
I think reversing isn't possible purely within simple regex functions. But I'm not a regex expert.
You could probably get a capture group out and reverse what you wanted manually. Maybe even in place.
>>
>>68419644
They're unnecessary, but could be handy if done right.
>>
File: Untitled-41.png (18 KB, 200x199)
18 KB
18 KB PNG
>>68419832
>>68419832
>>68419730
nevermind, figured it out. thanks
>>
>>68419793
override the replace method
>>
>>68419832
You're not multiplying by the step.
>>68419876
But I don't see why you don't just do a 3 nested loop. Neither of these are correct.
Where's black? Where's full white?
Many of the darker shades are missing completely. They're certainly nice to look at but they don't represent rgb at all.

This is easier to do in HSV and then convert to rgb.
>>
>>68419434
https://pastebin.com/QmQd7cZe

Whole page of text if someone is interested
>>
>>68419859
You can already do concept shit since C++98. The only difference is that the syntax becomes nicer.
template <MyConcept T>
is nothing more than
template <typename T, Constrain<MyConcept<T>> = {}>
in existing C++. Your constraints can even be dependent on multiple types if you do this.

Requires clauses are a more substantial improvement.
>>
File: sdgs.png (60 KB, 1015x764)
60 KB
60 KB PNG
>>68419887
i don't know shit about color. i was just thinking of having a separate space for black > white
im making a new photoshop
>>
How come there are so many gays and transsexual people among programmers? Is it something programming does to men or are they naturally attracted to programming?
>>
File: varg.jpg (52 KB, 480x292)
52 KB
52 KB JPG
Stop writing classes.
>>
>>68420006
color is 3d
if you're using a 2d box you need a 1d slider on the side to go with it, the slider usually being hue and the box being saturation/value
>>
>>68420063
The internet can turn you gay.
>>
File: 526301.jpg (21 KB, 460x460)
21 KB
21 KB JPG
>>68420068
Start using objects.
>>
Reminder that there is absolutely no reason to start a new project in C in 2018.
>>
File: 9k=.jpg (8 KB, 194x260)
8 KB
8 KB JPG
>>68420068
i only use structs.
the "class" keyword reminds me of sepples and makes me want to vomit.
>>68420090
start using dependent types
>>
File: 1425282282823.jpg (145 KB, 838x638)
145 KB
145 KB JPG
>>68420091
>doing things for a reason
Pathetic.
>>
>>68420063
programming gay LOL
>>
File: smug anime.png (336 KB, 720x540)
336 KB
336 KB PNG
>>68420102
>doing things
>>
>>68420091
Nah, you're stupid. I almost exclusively use C, and it's ridiculously prevalent in the area of programming I'm in.
>>
>>68420149
t. embedded "programmer"
>>
>>68420161
No, I'm actually a Wayland compositor developer. Like 99% of all lower level Linux stuff is in C.
>>
>>68420168
99% of literally anything important is in C. Most people program on so many abstractions they can't even see the ground. Not necessarily a merit of C though considering how old it is.
>>
>>68420168
> lower level Linux stuff is in C
This is basically 30yo technological dept.
>>
>>68420190
Not at all. Nobody except memers who haven't contributed to anything have any complaints about it.
People actually _know_ C. Just by writing new things in C, you're tapping into the large pool of experienced C developers that could contribute to your project.
>>
>>68420168
>pretending to be a real software developer when you're an open source contributor
>>
>>68420168
Why are you killing Linux?
>>
>>68420218
I'm an open source contributor and I'm also employed working on open source software.

>>68420223
Wayland is the best thing since sliced bread.
>>
>>68420161
t. brainlet who doesn't understand C
>>
>>68420314
C is for brainlets, though.
>>
Is there a way to use cin to read all strings separated by whitespace in a line in C++? I've tried looping while(cin >> str), cin.good() and cin.peek() != EOF, but it just loops infinitely until Ctrl+D.
>>
>>68420322
You only get EOF on ctrl+d, that's why.
Short answer is don't use cin
>>
>>68420314
> doesn't understand C
You see, Haskell-fags can go around saying everyone who doesn't like Haskell doesn't understand it, because Haskell actually could be hard to understand. But you can't just casually accuse someone who doesn't like C he doesn't understand it, because C is the most trivial and primitive programming language out there. Everyone understands it, some people just don't limit themselves with primitive things.
>>
>>68420321
Post proof you bjarnewashed retard
>>
>>68420340
So getline(cin, str) and then tokenise it is a better approach? I'll try it again, but I had no success when trying to do it before. I can't use any external libraries like boost and was looking for an method to get all strings at once, instead of iterating through it. Any leads?
>>
>>68420431
If you know how many strings there will be pass a number first. How are you giving the strings? If you're doing it from a file then just read the file, if it's you typing just ctrl+D.
>>
>>68418076
>OOP is just procedural programming with a funny dot syntax, bro
At last, I truly see.
>>
>>68420444
I'm typing them but I don't think having to rely on Ctrl+D will be accepted. Now say I have a minimum and maximum number of strings, can I use some method of tokenising them all at once?
>>
>>68420468
>>68420431
>>68420322
Sending an explicit Ctrl-D is by far the most consistent way. It's how basically all unix utilities work, as it works with inputs of any length, works with normal files, and works with literally any input.
>>
>>68420468
I really have no idea what you're trying to do, sounds like a uni project. If you have some freedom then the easiest solution would be to ask for a number and only expect that many strings. ctrl+D literally just send EOF so I don't know what else they could want. You just have it check if the user types 'QUIT' and then stop expecting strings.
>>
>>68417932
>How does one who's brain has been fried with scripting and functional programming learn OOP?
Objects are just glorified state monads.
>>
Rust is corrosion, which is bad
>>
>>68420475
>>68420481
The thing is I'm doing an filesystem and command interpreter. So I just want to read things like mkdir [path] dirname, ls [-R] [path], etc. And yes, it's a uni project.
>>
>>68420505
Your only other solution is to end on an empty string. So just press enter twice when you're done.
>>
>>68419051
This. A lot of my profs were explicit about it.
>"Don't come to class unless you've read through the chapter 8 times, done all the exercises, and know your shit backwards and forwards because I'm not here to explain it to you."
Oh sorry I though I paid $10,000 for this course to have it explained to me but its actually just to take tests and complete assignments.
>>
Reminder that all languages are valid
>>
>>68420567
>all languages are valid
Except for C++, Rust and Haskell, though.
>>
>>68420397
>complicated = better
The dumber you are, the more logical this sounds. I'll let you know the next time I'm writing a complicated program for the sake of it being complicated. Haskell is a horrible example, by the way, the ideas behind it are pretty straightforward. The "complexity" comes from a unique syntax and naming conventiones unique to the language. Those thungs combined, calling stuff different names and making it look different, makes haskell seem complex when in reality many of its features are identical to those found in other languages. I can understand how a brainlet might not be able to see through semantics.

C is sparse, but the reason for that isn't because it's dumb. The reason is that it has an extremely minimal runtime, making it one of the first languages to become usable on any given hardware platform- that's the reason it was created: ALGOL had too much runtime overhead with too little gain. FORTRAN had very little runtime overhead, but didn't provide enough benefits over assembly. C was one of the first languages to strike a good balance between overhead and abstraction, and that is the essence of good design in computer programming. C wasn't the first to strike that balance- see lisp. Complexity isn't equivalent to quality, and the number of things you can do with a language doesn't scale with keyword count.
>>
File: the_bell_curve.png (32 KB, 638x365)
32 KB
32 KB PNG
>>68420567
Stop pushing your narrative, lefty, I'm not a bigot, I'm a language realist, there are objective differences between programming languages, the studies show it!
>>
>>68420524
So is there no simple way to simulate how an interpreter like bash works in C++? having to press Ctrl+D or enter twice after every command sounds kinda dumb, although it's the only things I can achieve right now.
>>
>>68420587
TRASHKELL BTFO!!!
>>
File: images.jpg (5 KB, 225x225)
5 KB
5 KB JPG
>>68420587
>Stop pushing your narrative, lefty
>I'm a language realist
>>
>>68420587
>there are objective differences between programming languages
>posts graph where all the error bars overlap showing no objective differences between programing languages
>>
>>68420626
>when socjus tards fail to recognize each other's weak bait
>>
File: 1348764844816.png (2 KB, 244x226)
2 KB
2 KB PNG
>>68420640
>>
>>68420649
>when socjus tards can't keep track of who's posting what
>>
Programming languages is a social construct.
>>
>>68420591
If you're working with a file then check EOF if not then I think bash makes you put \ at the end of the line to tell it that it continues. You could always just play around with bash and see what it does.
>>
Threadly reminder that higher education, capitalism and white programming languages are inherently racist, as clearly proven by the lack of black programmers.
>/g/ will defend this
>inb4 racial differences in IQ and other pseudoscience
>>
>>68420696
Check out Go, it was specifically designed with black people in mind.
>>
>>68420696
How do you explain the prevalence of Asian programmers tho?
>>
File: waxS1XS.jpg (25 KB, 480x480)
25 KB
25 KB JPG
>classmate leaves Slack open when going to the toilet
>spam "Kill all Niggers" in chat
>>
File: a.png (8 KB, 318x101)
8 KB
8 KB PNG
>>68420677
I mean imitating the behavior here. Each line I write will be read entirely, the first is the command and all other subsequently the parameters. For now I'm working only typing the commands, but later on I'll have to read from files or script it.
>>
guys need to finish big project by tuesday.
Recommend me some music to keep me awake and coding.
>>
>>68420574
>c++
Time humbles us all
>Rust
You can't spell trust without rust
>Haskell
Got me there
>>
>>68420742
pantera
>>
>>68420733
Anon those are all single line commands, they just don't print anything. To imitate that just read until a newline feed,
>>
>>68420756
I'm sorry, I think I'm not being clear enough here, so let me say this. I don't want any complex interpreter, I just want it to behave exactly like this >68420733. Read a command and it's parameters. I'll have two parameters max for each command.
The problem is, I don't know how to do this in any other way than ctrl+d or enter twice. I tried tokenising the string from getline(cin, str) but I can't make it work for what I have, and a loop with cin >> str, cin.good() does not work either.
>>
>>68420785
Have you tried getch and naively breaking at any whitespace?
>>
>>68420574
Funny, I'm a huge C proponent, but I think Rust is a brilliant language. Mock it all you want, but unsafe{}'s ability to contain potentially failure-causing behavior to clear and contained regions is really powerful in comparison to exceptions, where an error is allowed to propagate to any arbitrary location in code. The borrow checker is effectively forcing the user to consider the reader-writer problem. Its enums are fantastic, too. Rust is rough around the edges, but it has some really good ideas.
>>
>>68420785
Getline works. Just make a function to break the line up by whitespace.
>>
>>68420742
>music to keep me awake
>>
>>68420901
>i'm a huge [Rust alternative fan], and Rust isn't perfect, but let me just regurgitate the entire Rust marketing strategy manual and tell you why you should use Rust
Every time. Steve really needs to up his game.
>>
File: IMG_20181101_191241_1.jpg (2.06 MB, 3120x4160)
2.06 MB
2.06 MB JPG
>>68416981
>>68417169

i never said i wanted CLI
>>
>>68416953
>Not part of the language.
Yes it is.
>>
>>68420941
You either haven't used it or haven't written more than a few dozen lines of it. Anyone who has actually used the language can attest that everything I said was true.

It isn't a perfect language, like I said. Its syntax is very ugly in some places where the ugliness could have been prevented by just sticking to C-like conventions, and its toolchain is very inflexible. However, there are points of brilliance that shouldn't be dismissed by "hurr rust bad" comments.
>>
>>68420887
This might do it, but at the same time it looks like a really ugly workaround. If I can't tokenise it, I might resort to it.

>>68420906
I made this and it's now working for my needs.
string command, param, name, path;
cout << "> ";
cin >> command;

getline(cin, param);
stringstream ss(param);

string str[3];
int c = 0;
while(getline(ss, name, ' ')) {
if(name.compare("") != 0) {
str[c] = name;
c++;
}
}

Thanks for the help guys.
>>
>>68420941
> Steve really needs to up his game.
Why? It's working, /g/ is slowly becoming a Rust board.
>>
File: 1541603724542.png (313 KB, 400x400)
313 KB
313 KB PNG
anon from >>68409134

I did it lads!!! I passed yesterday's interview and now I have a final on site interview next week

I am so happy!
>>
File: rustacean-flat-happy.png (32 KB, 1200x800)
32 KB
32 KB PNG
>>68420941
>ORANGE CRAB BAD
>>
>>68421058
Good job, anon.
>>
>>68421058
I'm happy for you solely for the fact you didn't post shitty anime pictures on these posts
>>
File: Trap Smug.png (188 KB, 3084x2568)
188 KB
188 KB PNG
>>68421106
>>
y'all got more of those anime tiddies you were posting yesterday
>>
>>68421285
Just >>>/e/ or >>>/h/ or >>>/d/ in increasing order of sexual frustration
>>
File: 1537985908896.png (1.76 MB, 1075x1518)
1.76 MB
1.76 MB PNG
>>68421285
(you)
>>
>>68421308
No can do, I'm at work
>>68421319
thank
>>
>>68421042
>>68421049
>>68421065
>steve exposes his true face
>>
In Python, you have a list and you want to see if some object in the list is before or after another object.
Is the only way to get the indices of both objects (separately at that) and compare?
>>
>>68421403
Just iterate over the list and see which object you find first.
>>
>>68421454
That's pretty smart.
So
next(i for i in [1,2,3,4,5] if i in [3,5]
>>
>what are hashmaps
The ABSOLUTE state of OOP retardation.
http://www.csis.pace.edu/~bergin/patterns/ppoop.html
>>
>>68421607
>ppoop
>pee poop
wtf i hate OOP now
>>
>>68421607
>using a hash map for small set sizes
pajeet detected
go cargo cult somewhere else
>>
>>68420149
Doesn't take away from the fact that starting a new project in C in 2018 is an absolutely braindead idea.
>>
>>68421637
Meanwhile, a small hashmap is more readable and more flexible than your retarded class hierarchy.
Using data instead of code to model behavior is infinitely more flexible and maintainable.
>>
>>68421758
Objects are implemented as hashmaps in most dynamically typed languages, butthead.
In the rest they're closures--identical to structs but with vtables.

Enjoy rewriting the entire earth though because of your uneducated autism.
>>
>>68421758
>implying there's a difference
[laughs in lisp]
>>
>>68421783
Oh, so you completely missed the point? I see. Funny of you to call me a pajeet. You are part of the problem.
https://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb
>>
>>68421637
>>68421758
You're actually both extremely fucking stupid. The presented POO solution already uses a hashmap. The problem there is with how it populates this hashmap.
>>
>>68421816
You have no point.
You're just insanely rambling about how much you like this hammer and that people who use screwdrivers are retards.
>>
What's with all the C hate? If I want to get an internship, what other languages should I try to learn? Java, C++, Python, more?
>>
>>68421880
Haskell
>>
>>68421880
C++ is the easiest incremental step up.
>>
>>68421848
The point is that dumb pajeets such as yourself always feel the need to overcomplicate everything. But that's ok, inheritance hierarchies have fucked your mind so beyond salvation that you can't conceive anything else.
>>
>>68421913
>C++ is the easiest incremental step up.
down*
>>
>>68421826
The POO solution scatters data around, embedding it in the code itself. You clearly are so braindead you can't even understand his complaint.
I whipped up a quick solution in Python to illustrate the difference:
UNIX_MSG = 'This is a UNIX box and therefore good.'
WINDOWS_MSG = 'This is a Windows box and therefore bad.'
GENTOO_MSG = 'Install Gentoo'
DEFAULT_MSG = 'This is not a box.'

os_box_map = {
'SunOS': UNIX_MSG,
'Linux': UNIX_MSG,
'Windows NT': WINDOWS_MSG,
'Windows 95': WINDOWS_MSG,
'Gentoo': GENTOO_MSG
}

def print_os_msg(osname):
msg = os_box_map[osname] if osname in os_box_map else DEFAULT_MSG
print(msg)

Better than any stupid hierarchy and a million classes. Just work on fucking data, separating the code. Adding cases is trivial, and in fact, if you parse it from a file, you don't even have to modify the code at all. This is the important distinction between the different roles of data and code, like Rob Pike's post linked here: >>68421816, something POOjeets fail to see.
>>
>>68421945
>failing to make any coherent point
Try again, please.
>>
>>68421915
what motivates people to be this butthurt about shit that doesn't matter?
>>
File: horselaughter.gif (547 KB, 256x196)
547 KB
547 KB GIF
>>68416856
>JUST
>>
>>68421880
Because C is pretty much never the best tool.
If performance is not important and you can have a rich runtime, use a high level language suited for the task.
In 99% of cases where C is a good choice, though, C++ is a better choice. Yes, even on embedded: template specializations and namespaces shit on macros and PRE_FIXES every day.
The one and only reason C may be a better choice is a simpler ABI. But C++ has made notable progress towards a well-implemented de facto standard ABI too, and on fact this point is usually overblown by Cniles since they know it's the only tiny advantage C has.
Learning C still has a point: you can work and maintain existing projects written in C. But starting a new project in C now is beyond retarded.
>>
>>68421955
The point is that you're retarded and can't come up with simple, straightforward solutions. Sorry if that was too much for your little brain.
>>
>>68421454
>>68421486
That is not pretty smart. What if the list has 1,000 integers? You're still going to iterate the entire thing? This seems extremely inefficient.

You must know what two objects you're looking for right? Just index. There's no reason for iterating when Python itself has a built in function to return the index of a value simply titled index.
>>
File: 1364743155696.jpg (34 KB, 500x475)
34 KB
34 KB JPG
>>68416856
Reminds me of this gem from progrider https://gist.github.com/FrozenVoid/87e6ad6212ac9ce496e0
>>
>>68421929
Reminder that C is just this millennium's COBOL and will die of neglect in the coming years.
>>
File: 1540687265435.jpg (17 KB, 250x250)
17 KB
17 KB JPG
>>68422018
>But starting a new project in C now is beyond retarded.
oh its the same anon
>>
>>68422074
This. Also
>muh close to da hardwarehh
C is not even a low level language: https://queue.acm.org/detail.cfm?id=3212479
>>
>>68422042
Alright. Let me spell it all out for you, you inbred imbecile: the linked-to POO solution is absolutely retarded, but so is your objection to it. It "scatters data"? Yes, you mongrel. That's exactly the point of it. It tries to be "extensible", instead of pre-defining the mapping and then having to modify the code every time you want to add a system. Whether or not it's a sensible requirement for this toy example is besides the point, because such is the nature of a toy example. It goes about it in an extremely obtuse way that's easy to pick apart, but you're too much of a stupid monkey to even figure out what it was trying to do.
>>
>>68422062
>what if the list has 1000 integers
it doesn't and it never will
I know my domain
which is why I asked.
>>
>>68422100
C isn't even a good portable assembly. If you need to be close to the hardware, you should be writing actual assembly so you don't get constantly raped by operation that are perfectly well-defined on the CPU being optimized away as undefined behavior by the compiler.
>>
>>68422102
>instead of pre-defining the mapping and then having to modify the code every time you want to add a system.

>>68421945
>Adding cases is trivial, and in fact, if you parse it from a file, you don't even have to modify the code at all.

You can't read.
And adding functionality to a POO solution using dumb hierarchies still requires you to eventually add it *somewhere*, certainly no less than adding an entry to a table, unless you avoid the issue by parsing it from a file or a database (the way any serious project would do for lots of cases).
But that's fine, keep rambling. You have such a warped and distorted view on programming it's amusing to watch.
>>
>>68422134
UB was a mistake. I still can't believe having literally undefined stuff in the specifications of a programming language was ever taken seriously.
>>
>>68422134
t. Idiot
>>
My homemade language has an I/O monad primitive now, along with a little interpreter to facilitate its use. The "world" token that is implicitly passed is just a pointer to the interpreter's state.
>>
>>68422198
>still requires you to eventually add it *somewhere*
Yes, you inbred imbecile, but as I literally just explained to you, the point of the example is specifically to avoid doing what you did... how is that still not clear to you?
>>
>>68422214
You're ignorant of the issue. Defined behavior for every platform would have at least one of two consequences:
1. Massive performance penalties
2. Ruling out platforms which aren't specified for, including future platforms
>>
>>68422256
No it wasn't.
The so called "hacker solution" they showed was nothing like using a table, and in response, they proposed something even more retarded.
The fact that you're unable to distinguish looking up a data structire, separated from the code, from an if-else chain leads me to believe you're the inbred retard here.
>>
>>68422269
>Sort of what I was expecting
>teaches the basics of programming and writing algorithms in Python
>move on to Java to learn about building practical applications and building a structure using multiple classes and interfaces
>move on to C/C++ to learn about more advanced techniques, direct memory management, etc.
>possibly an assembly language semester at the end

>What I got instead
>HEY GUYS WHO WANTS TO MAKE A GAME IN JAVASCRIPT?? COME ON NOW LETS PAIR UP IN GROUPS OF 4

Fuck public universities.
>>
File: spj.jpg (31 KB, 224x223)
31 KB
31 KB JPG
>>68422234
based and redpilled
>>
>>68422300
>No it wasn't.
Yes, it was.

>The so called "hacker solution" they showed was nothing like using a table
It is exactly like using a table. The funny thing is that your monkey brain is actually grasping this fact, because I didn't even have to tell you which solution yours is isomorphic to, but you won't admit it because you're desperate to save face on an anonymous Tahitian gum chewing board.

>they proposed something even more retarded.
Agreed. It's just that you're unable to coherently criticize it, even though it's such a low-hanging fruit. Imbecile.
>>
>>68422269
Programming language semantics have nothing to do with a particular machine.
The platform should implement "how" defined behavior happens.
"Undefined behavior" means that a certain construct in a programming language does not even specify "what" happens. That's the problem.
Platforms that "aren't specified for" will simply implement defined constructs on a different way, but ultimately yielding the same result.
>>
File: you_0.png (646 KB, 1200x1000)
646 KB
646 KB PNG
>>68422332
>Yes, it was.
No, it literally wasn't. Repeating it won't make it true.
>It is exactly like using a table.
No it's not. The function itself need not change even with a million new cases if you use an external table. Plus, with an appropriate hash function, it has O(1) complexity versus O(n) using if-else, where n is the number of cases.
If you can't see the difference, you're either a newbie or an absolute shit tier programmer.

>It's just that you're unable to coherently criticize it
It's overcomplicated, hard to read, and doesn't provide any practical benefit. It's no easier to "extend" than the hashmap solution. I don't know how else to say it.

Please keep rambling, you're amusing me.
>>
>>68422421
>i literally cannot read, so i don't know what the author's point actually was
That kinda invalidates everything you say.

>The function itself need not change even with a million new cases if you use an external table
Irrelevant. The table represents a static mapping from OS name to insult, just like a function with a bunch of if's does.

>with an appropriate hash function, it has O(1) complexity
Irrelevant. That wasn't the root of the author's problem with the "hacker solution". He was complaining about the code structure, and your solution has the same "problems" in that regard.

>It's overcomplicated, hard to read, and doesn't provide any practical benefit
I don't disagree with this. It's just worthlessly vague and lacks substantiation. Your only actual attempt to actually substantiate your opinion so far ("m-m-muh data is scattered") is fucking embarrassing.
>>
>>68422349
Respectfully, what semantics would you suggest for dereferencing a garbage pointer that would extend to all systems and not inhibit performance?
>>
is unordered_map<string, any> the best option for a generic 'pod type' for going into the parameter of a virtual function?
>>
>>68416837
her head is nowhere near WIIIIDDDDE enough
>>
>>68422492
>Irrelevant. The table represents a static mapping from OS name to insult, just like a function with a bunch of if's does.
But that's not at all. Using a separate table, you have full separation between code and data, with the bonus of being able to generate the table in a different way (e.g. parsing from a file), as I already said. This way, you can add cases without even modifying the code at all, unlike any retarded POO polymorphism solution.
It is "static" in this small example, but just like you would add classes over claases to add cases, you would add entries anyway.
>Irrelevant. That wasn't the root of the author's problem with the "hacker solution". He was complaining about the code structure, and your solution has the same "problems" in that regard.
Better complexity is merely an added benefit, it wasn't the point. And no, using external data doesn't suffer from the same problems as hard coding. If you unironically still believe this, please show me how your amazing mind would solve this problem.
I already know you won't, anyway.
>It's just worthlessly vague and lacks substantiation. Your only actual attempt to actually substantiate your opinion so far ("m-m-muh data is scattered")
Scattering data around is a fundamental design flaw and harms maintainability. Feel free to be embarrassed by it if you like, but be aware that it's a perfectly valid criticism, whether you like it or not. Also less code == less potential fuckups.

Of course, please continue, you're cracking me up.
>>
>>68422530
Return some default value, like all 0s according to the dereferenced type. Not sure how this would "impact performance“.
>>
>>68416917
processing will let you easily drag nodes, the rest can be done with anything, and given processing is essentially javascript it should be easy enough to do
>>
>>68416856
Magnificent.
>>
>>68422629
>Using a separate table, you have full separation between code and data
Irrelevant. It's not necessarily an advantage.

>being able to generate the table in a different way (e.g. parsing from a file)
You can do the exact same thing with his approach.

>Better complexity is merely an added benefit, it wasn't the point.
You're lying blatantly now. It was explicitly one of your points.

>using external data doesn't suffer from the same problems as hard coding
You're lying blatantly again. You did use hard-coding.

>Scattering data around is a fundamental design flaw and harms maintainability
Using negative adjectives and making unsubstantiated assertions is not an argument.

I've given you enough chances to demonstrate that you're not actually an inbred mongrel. You evidently cannot do so. Moving on. :)
>>
Gonna have to go back to ruby.
Elixir is super fun, and fast.. But there's just so much to learn and it's time consuming to get into all the memes.

Sucks that it's not more popular so I could justify the time investment.
|> :(

Also all languages should have docs like elixir does. That shit is just perfect.
>>
>>68422709
How do you expect the implementation to decide whether the pointer is invalid so it can do this?
>>
>>68422709
So basically you would implement a garbage collector to track what addresses are valid and branch on every dereference.

Are you actually retarded or what?
>>
File: chris_straw.png (346 KB, 600x664)
346 KB
346 KB PNG
>>68422738
>Irrelevant. It's not necessarily an advantage.
It certainly is in this case, and I've already told you why, yet you keep ignoring it.
>You can do the exact same thing with his approach.
Technically yes. By parsing, generating a fuckton of classes and using reflection (which isn't even used in the final proposed solution). Way more complicated, for no practical benefit.
Or you can just use external data and be done with it.
>You're lying blatantly now. It was explicitly one of your points.
It was a *bonus*, as I said, not the central point. You're blatantly nitpicking and arguing in bad faith at this point.
>You're lying blatantly again. You did use hard-coding.
Take the function somewhere else, pass it another external table, possibly automatically generated, and it will still work. None of the solutions proposed in the article can do that.
The "hard coding" I used was to illusttate the example, and it's still a better solution. It doesn't require a table to be hard coded in principle.
>Using negative adjectives and making unsubstantiated assertions is not an argument.
No, unless you motivate it, which I did.
>I've given you enough chances to demonstrate that you're not actually an inbred mongrel. You evidently cannot do so. Moving on. :)
I gave you a chance to prove me wrong and post your solution, yet you didn't post a single line of code. The only conclusion is that you can't program and come here just to pick fights to feel better about your lack of skills.
>>
>>68422738
>If I just say "irrelevant" or ur wrong" instead of making a counterargument I'll look smart!

Wrong.
>>
>>68422859
what are u guys arguing about

pls sum it up in a few sentences, I don't want to read the whole thread thanks
>>
>>68422872
pls respond
>>
(Java) Is it more practical to extend a class or create an instance of it if I want to create a class that stores common methods I'll be using over multiple class files. ?
>>
File: 1453653416676.jpg (73 KB, 500x500)
73 KB
73 KB JPG
>>68422978
>expression problem
>>
>>68422978
Prefer composition over inheritance.
I would create a separate class with the common methods and use an object belonging to it in every class needing it.
Inheritance creates too much coupling.
>>
>>68422978
what?
>>
>>68422978
It depends :^)
>>
>>68423014
So instead of public class ass extends commonmethods I'd do commonmethods a = new commonmethods(); and a.method();?

I'm completely new and don't want to disappoint my professor for lack of paying attention. I've been more focused on my personal projects and have no interest in Java but I need to pass it.
>>
>>68422854
Boy, you are such a tard... Let's look at the author's complaints:
>if we need to add new operating systems, we need to extend the if structure
>if the functionality of each OS needs to be extended, what we are likely to see is that the if statement will most likely be replicated elsewhere in the program each time we need to make the distinction between operating systems.
>this solution still does ad-hoc polymorphism in the if statement

So he doesn't like it when:
- the mapping from OS name to insult isn't externally extensible
- the mapping is single-purpose
- you use home-rolled polymorphism

Whether these concerns are valid or not depends on the situation, but clearly, your solution fails on all counts.
>>
>>68422859
>implying i haven't explained why his points are irrelevant and/or wrong
Here's a condensed and retard-friendly explanation:
>>68423091
>>
>>68423064
Are the methods pure functions or do they all rely on large swaths of your various classes' internal states?
>>
>>68423109
They are functions that would use variable parameters different in each class.
>>
File: 1402705587748.png (718 KB, 1600x1067)
718 KB
718 KB PNG
>>68423091
>So he doesn't like it when:
>the mapping from OS name to insult isn't externally extensible
>the mapping is single-purpose
>you use home-rolled polymorphism

Using an external table solves point 1 and 2. You can just use an additional data structure if you need additional behavior. Easy peasy.
Point 3 isn't even a flaw, it is only in the eyes of OOP zealots. "Ad hoc polymorphism" means literally nothing and it's a dishonest term: dynamic dispatch was used long before OOP.

I'm still waiting for your solution, btw. You should clearly be able to do it if you're so loud-mouthed, right?
>>
New thread
>>68423217
>>68423217
>>68423217
>>68423217
>>
>>68423205
>Using an external table solves point 1 and 2
What do you mean by an "external table"? Reading it from a file?

>You can just use an additional data structure if you need additional behavior.
Point 2 is an objection to exactly this. I am now convinced that your IQ is below 70 and you cannot read.
>>
>>68423219
Trash OP pic, no tiddies
>>
File: top_nep.png (401 KB, 500x708)
401 KB
401 KB PNG
>>68423256
>What do you mean by an "external table"? Reading it from a file?
Anything that is clearly separated from the actual code. So an external file woukd do the job just as well, of needed.
>Point 2 is an objection to exactly this.
The thing is, the way it gets solved kn the article is way worse. It creates tight coupling between functionalities and therefore harms flexibility. What of at some point you need only ONE of those "additional functionalities"?
The most straightforward way is to just use a separate function and data structure if significant additional behavior needs to be added, then invoke the necessary ones from outside when needed.

You're one of the most entertaining people I've ever seen on /dpt/. So loud and spergy, yet unable to shit out code of his own.
It must be easy to provide a better solution if mine is so shit, right?
>>
>>68423471
>Anything that is clearly separated from the actual code. So an external file woukd do the job just as well, of needed.
Vague, non-specific drivel. The only actual solution you posted fails to address point #1 (as well as all the other points).

>it gets solved kn the article is way worse
I never said the article solves it properly. I've been saying it's shit from the start. My problem is mainly with your low IQ and repeated failure to understand the objections in the article, which resulted in you posting the kind of solution to which the garbage in the article is a reaction. You can try to argue that the objections in the article and somehow inherently invalid under all circumstances, but simply ignoring them and posting a solution that falls squarely under its criticisms is just moronic.

>It must be easy to provide a better solution if mine is so shit, right?
It's trivial: you just provide an interface to register/lookup objects implementing some OS interface. When someone writes a module for some specific OS/class of OSes, they just register an object that provides all the required functionality.
>>
File: 1520649164170.gif (898 KB, 487x560)
898 KB
898 KB GIF
>>68423669
>It's trivial: you just provide an interface to register/lookup objects implementing some OS interface. When someone writes a module for some specific OS/class of OSes, they just register an object that provides all the required functionality.
See, that's the exact response I was waiting for. You didn't even understand the simple problem that entire article was trying to solve, (doing something according to some value) and now you're proposing some kind of "solution" that has nothing to do with it (registering new objects at runtime), which still doesn't address the original problem. You are retarded. Your brain was fried from OOP overengineering to the point you can't even understand the problem at hand.
Not to mention that a simple table can be extended at runtime too.
Of course you didn't post actual code, since you yourself don't know what you're talking about.
>My problem is mainly with your low IQ and repeated failure to understand the objections in the article, which resulted in you posting the kind of solution to which the garbage in the article is a reaction.
Looking up data is an entirely different thing, certainly not what the original solution was doing, it's not my fault you can't see the difference.
You sound like the typical guy whose CV is full of buzzwords like "UX designer" or "cloud engineer" yet can't FizzBuzz.
>>
>>68423809
>i didn't even understand the simple problem that entire article was trying to solve
I know, but I've already explained it to you, complete with quotes and retard-friendly paraphrasing. Why do you still not understand it?
>>
>>68417444
The term is "uber shader" btw.
>>
>>68423826
At this point, it's clear you're either trolling or literally retarded. From the article:
>The problem to be solved is to output a value judgement about operating systems
Tell me again how your "solution" supposedly solves this apart from "registering an object providing the required functionality", which has nothing to do with the problem at hand.
And this time, code or bust.
>>
>>68423967
>The problem to be solved is to output a value judgement about operating systems
>this is his genuine and unironic conclusion after reading the article
>this is his genuine and unironic conclusion after reading quotes from the article explaining what the ACTUAL problem is
>this is his genuine and unironic conclusion after a retard-friendly explanation of the quotes
You see, folks, that's why inbreeding is bad.
>>
>>68423967
>>68424019
I mean, I don't know if you've noticed when I explicitly pointed it out to you, but he moves the goalpost away from the original problem statement IMMEDIATELY. Anyway, I'm done. Just don't reproduce.
>>
>>68424019
Then please, enlighten me about the "actual problem" and provide a solution.
>inb4 i already did
You didn't.

Also, why are you so obsessed with inbreeding?
>>
anyone use https://crystal-lang.org/ ?

is it a meme or does it have potential?
>>
>>68424088
>You didn't.
I did, though. Here: >>68423091
That's his actual problem.
>>
>>68424126
Memes have a potential to change the world, anon.
>>
File: 1515630965244.png (87 KB, 300x300)
87 KB
87 KB PNG
>>68424183
Weren't you done? :^)
Yes, those are considerations about additional, desirable properties ABOUT a solution. You know, *secondary* characteristics. But the original problem, that is
>The problem to be solved is to output a value judgement about operating systems
Is ultimately what needs to be solved. No matter how "elegant“ or "reusable" a solution is: if it doesn't solve the original problem, it's objectively wrong.
What you proposed (without a single line of code) doesn't address the original problem at all.
So, are you gonna deliver a better solution that actually *solves the problem* AND provides those additional, desirable, secondary properties? Or are you once again gonna project about inbreeding?
Your choice.
You WILL reply once again, and yet once again without a trace of code.
>>
>>68424337
>those are considerations about additional, desirable properties ABOUT a solution. You know, *secondary* characteristics
>secondary
They are the point of the entire article, and the entire discussion.

>Weren't you done? :^)
I am. You can keep churning out paragraphs of shit, but don't expect more than one-liners and insults in response.
>>
>>68424389
>They are the point of the entire article, and the entire discussion.
Yes. And ultimately, a solution solving the original problem should eventually be found, after wanking over ita supposed "flexibility" and such.

>I am. You can keep churning out paragraphs of shit, but don't expect more than one-liners and insults in response.
Fine, I'll take it as an admittance of defeat.
You can't program.
>>
>>68424525
>And ultimately, a solution solving the original problem should eventually be found
He gives it away, though:
        String osName = System.getProperty("os.name") ;
if (osName.equals("SunOS") || osName.equals("Linux"))
{
System.out.println("This is a UNIX box and therefore good.") ;
}
else if (osName.equals("Windows NT") || osName.equals("Windows 95"))
{
System.out.println("This is a Windows box and therefore bad.") ;
}
else
{
System.out.println("This is not a box.") ;
}

According to your logic, that's where it should end, but hilariously enough, you will reject it based on your own "secondary" criteria, ignoring the ones the article is about. Fucktard.
>>
File: You_1541627884466.gif (415 KB, 480x238)
415 KB
415 KB GIF
>>68424597
>According to your logic, that's where it should end
No, I'm explicitly criticizing how shit the solutions posted on the article are.
The solution I posted is significantly better, since, by having more separation between data and code, extending behavior becomes much easier. You don't need to write "additional ifs", which is the reason this original solution gets criticized.
>but hilariously enough, you will reject it based on your own "secondary" criteria, ignoring the ones the article is about. Fucktard.
Yes, since the one I posted achieves the same flexibility of the last ones with significantly less complexity. It's also quite dishonest of you to complain about me rejecting solutions based on "secondary criteria" when you insisted about them being the central focus.
That was quite a long one-liner, though, did I strike a nerve?
Certainly not the one that makes you code a better solution than mine and post it. Oh, but what am I saying, you can't program anyway.
>>
>>68424671
>The solution I posted is significantly better
Not according to the criticisms in the article, which may or may not be valid, depending on circumstances.

>the one I posted achieves the same flexibility of the last ones
False.
>>
File: 1511986340918.png (668 KB, 1080x1080)
668 KB
668 KB PNG
>>68424692
>Not according to the criticisms in the article, which may or may not be valid, depending on circumstances.
The criticisms ultimately lie on having to change the code to add more cases and therefore more functionality. Looking up the answer on a data structure doesn't need changing the function code itself at all even of you add a million entries, and it can also deal with automatically generated data.
The solution proposed at the end has none of these advantages, and you still need a fucking class for each.
You can still redeem yourself by posting a better solution, something you are incapable of.
>False
>waaaaa no u
>>
>>68424806
>The criticisms ultimately lie on having to change the code to add more cases and therefore more functionality.
False.

>Looking up the answer on a data structure doesn't need changing the function code itself
Irrelevant. Your code doesn't allow to extend the mapping externally, or to add new functionality, thus falling under the criticism of the article.
>>
>>68424806
Anyway, given that you're both a Pythonista a frogposter, I basically win by default. See ya.
>>
>>68424844
>false
>irrelevant
Gee, update your vocabulary.

>Your code doesn't allow to extend the mapping externally, or to add new functionality, thus falling under the criticism of the article.
Add additional similar two-line functions if needed, and call them accordingly. Should you also need to, say, return an integer ID, you can again add it to the table, by using structs to ise a single one, or use a separate table. It's THAT simple. No need for bloated crap like hierarchies.
>>68424858
I'm not even fond of Python, but that was the quickest way to whip up a solution in an actual programming language that actually worked. Something you still haven't proven able to.





Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

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.