[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: 317
Thread images: 28

File: mokou_sicp.png (174KB, 392x462px) Image search: [Google]
mokou_sicp.png
174KB, 392x462px
What are you working on, /g/?

Old thread: >>59649213
>>
>>59656280
Lisp is the most powerful programming language.
>>
>>59656280
C++ prime
one third through
800 more pages to go haha...
>>
>>59656297
haha
>>
fourth 4 forth
>>
>>59656280
Reading through the technical doc for UML after watching about three hours worth of video tutorials, hoping it'll help me be able to plan something without having to refactor code because of an interaction I forgot every thirty minutes.

Yes, I'm aware it'll probably save me less time than I've used.
>>
File: 0sMJXWs.png (122KB, 364x385px) Image search: [Google]
0sMJXWs.png
122KB, 364x385px
pls respond to my question in old thread >>59656270
>>
>>59656347
start writing code
if good code: keep it, goto end
if bad code: scratch it, goto begin
>>
Trying to write a document sorting program.
But the document needs to be able to sort squished together information

First Name: BETHLast Name: Mitchel

this shit is annoying^ I'm not even sure how to sort crap like that.
>>
>>59656395
Regex
>>
>>59656395
Start at the beginning, search for next keyword "Last Name:" "First Name:", find nearest keyword, read until start of that and put it in a more useable structure?
>>
>>59656411
C# has a version of Ragex?
>>
>>59656411
but then he will have two problems
>>
>>59656422
System.Text.RegularExpressions
>>
>>59656417
Thats actually a great Idea.
there's like 16 attributes per person, but that will do. thanks.
>>
>>59656395
Post a few full lines of your text file and what you're trying to do.
>>
>>59656417
What if someone's first name is "Last Name:"?
>>
>>59656347
class diagrams bro
>>
>>59656280

I am writing something that is quite hard

I need to spend time building a comfortable debugging environment

gonna break out the ncurses and build a GUI
>>
say I need a point and vector2 struct.
would it make sense to define point first and make vector2 inherit from it? (with magnitude() functions etc)
or should I just make point an alias of vector2?
>>
>>59656520
Son of a bitch, when I copy pasted the first line there's line breaks.
In the txt file its all mushed together.

I can actually do this.

I'm just taking information like this

FacilityID: 12787
FacilityName: ACME Medical Center
Facility Location:
Patient: Kistra Halos
Gender: Female
DOB: 2/22/1923
PatientID: 475101
Procedure: MG MAMMOGRAM SCREENING BILAT
Number of Films: 1
Laterality: NA
Contrast: NA
Reason: BERGEN COUNTY CEED PROGRAM
ExamDate: 5/22/1998 12:19:00 PM
Radiologist: Kalaila Mayweather
Ordering Ph: Haera Mald
POS: O
ReportStatus: 1

===================END OF RESULT===================

FACILITYID: 12786
FacilityName: ACME Medical Center B
Facility Location:
Patient: Gav Brishen
Gender: Male
PatientID: 475100
Laterality: NA
Contrast: NA
Reason: Chest pain
EXAMDate: 3/22/1918 9:19:00 PM
Ordering Ph: Celes Kelbier
Radiologist: Fias Talatheen
DOB: 5/13/1982
Procedure:

and sorting it.
so that the user just types "file - filename.txt" and it all prints out neat and in order.
>>
>>59656526
This is one of those times where taking into account all possible options is just a waste of time.

I'd throw coffee at you if you were an intern here.

>>59656581
Alright, how about this:
Copy the first few lines to an actual text document and upload that somewhere so I can test with it. If you've got line breaks or other ascii characters fucking with it, it can actually help you parse it.
>>
>>59656581
>Son of a bitch, when I copy pasted the first line there's line breaks.
>In the txt file its all mushed together.
are you reading a file with unix-style newlines in notepad.exe?
>>
>>59656569
That actually sounds pretty good IMHO

If anyone else thinks its a bad idea, you should probably listen to them though
>>
>>59656569
Why would a vector inherit from point?
>>
>>59656569
A point and a vector are exactly the same thing. You only need the vector class.
>>
>>59656569
please quit thinking that way as soon as possible
>>
>>59656625
both have x/y coordinates. but a point represents a fixed point in 2d space so it doesn't really make sense for it to have functions like magnitude() and angle().

>>59656633
should I go with the alias then?
>>
>>59656663
It does if you consider point to be a vector fromvthe center of coordinates
>>
>>59656601
yes, they sent it to me in notepad.exe

>>59656600
I wan't to learn to do this, getting someone to parse it for me won't teach me much.
>>
>>59656663
No, you don't need a type for points at all. All your variables representing points should just be vectors.
>>
File: 1486599214765.jpg (43KB, 441x421px) Image search: [Google]
1486599214765.jpg
43KB, 441x421px
Does anyone here have the things to program chart handy? I want to completely ignore it for the Official /g/ Funposter cert.
>>
>>59656700
>>59656712
alright then, I'll go with just the vector type. thanks for the advice.
>>
>>59656726
https://better-dpt-roll.github.io/
>>
All languages should have a repl
>>
>>59656569
They should be two distinct types, not any hierarchy.
>>
>>59656777
they would be, but inheritance is just an easy way to clone functionality (overloaded operators etc) in this case.
>>
>>59656812
go poo in loo, pajeet
>>
>>59656777
If you think you don't need vector operations for a class representing points, you need to learn more linear algebra.
>>
>>59656830
surely that would depend on the intended usage, anon!
>>
>>59656770
Even HolyC has a REPL.
>>
>>59656280
Which name is better?
class CIAResource extends AgencyResource {//...

or
class CIAresource extends AgencyResource {//...
>>
>>59656941
Former is correct.
>>
>>59656770
You're mom should have a repl
>>
>>59656954
Wrong.

>>59656941
Both are wrong.

CiaResource
is the correct PascalCase form.
>>
>>59656941
>>59656981
Jest use an underscore.
Because not all acronyms will be as notable, and splitting them up is worse.
>but muh standards
no
>>
>>59656941
struct cia_resource : public agency_resource { };
>>
>>59656993
>Jest use an underscore
Pajeet detected.
>>
>>59656981
What the fuck is a cia? isn't that a fucking car brand?
>>
>>59657022
Underscores are literally an anti-pajeet practice, are you a baka?
>>
>>59655538
>A graphics window
> gui libraries
I'm having a bit of trouble finding good GUI libraries for OS X... There's a weird error that won't allow me to install wxWidgets on Sierra, so I'm choosing between this library called "JUCE" (not sure how good it is/how to use it and FLTK

Which one do you recommend I learn for the text editor project?
>>
>>59657031
Convert 35287063389459 from base 10 to base 36.
>>
>>59657040
>literally an anti-pajeet practice
Yeah, keep telling yourself that.
>>
I couldn't be more in over my head with this shit.
Why do I suck so much at this.
>>
>>59657067
>implying it's not
Yeah, keep implying that.
>>
>>59656981
But muh acronym!

>>59656993
I suspect this is best.
>>
I was stupid for thinking I could learn a new language in 2 days.
I'll just go to the job that has on the job training, until I'm at least pajeet level.
>>
>>59657145
Are you the C with classes guy?
>>
>>59656569
You can have an abstract superclass Pair or something like that, that has x/y coordinates and anything else that would be common to any object that's defined by two numeric values.

Then define the specific behavior of points and vectors into their respective, concrete subclasses.
>>
>>59657157
nope, I'm the guy that was applying for a job I'm not qualified for because I'm desperate for a non-minimum wage job.
>>
>>59657157
I think he might be the C# 6 levels of indentation guy.
>>
>>59657185
that's me buddy.
>>
>>59657185
and for the record someone else suggested the 6 levels of indentation. I was trying to do it in 1 line.
>>
>>59657195
Well, hopefully it was a learning experience. It can be pulled off mind you, but it'd take a bit of bullshit and effort.
>>
>>59657232
I now have to travel 2 hours out and back every day just to have a decent job. The bullshit and effort would be well worth it to have a job in my own city.
>>
File: 1485641870612.jpg (18KB, 500x479px) Image search: [Google]
1485641870612.jpg
18KB, 500x479px
>>59657145
So you didn't get the job? how did the interview went about?
>>
>>59657337
Didn't go to the interview yet.
Just looking at the pre-interview assignment.
I'd have syntax errors for days.
>>
>>59657318
>I now have to travel 2 hours out and back every day
cars were a mistake
>>
>>59657374
Poorfag. i don't have a car. i'll have to bus there and back.
Or i could cut it down to an hour if i uber. 40-60 bucks a day.
>>
File: 1489689364565.jpg (27KB, 667x659px) Image search: [Google]
1489689364565.jpg
27KB, 667x659px
>>59657362
>Syntax
Excuse me what? are you one of those SJW snowflakes that go about writting extensive blog entries about how fizzbuzz is some abstract kind of math?
>>
>>59657145
job training is for blue collar jobs
>>
>>59657362
post the assignment and we might help you with it. not like you have anything to lose, right? either we help you or you don't apply to begin with. just make sure you don't dox yourself.
>>
>>59657393
Motor vehicles were a mistake
>>
File: 1489240155417.jpg (111KB, 392x446px) Image search: [Google]
1489240155417.jpg
111KB, 392x446px
>>59657062
program base_10_36;

var
base36, endnumber : string;
base10 : int64;
remainder : integer;
begin
base36 := '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
base10 := StrToInt64(ParamStr(1));
endnumber := '';
while (base10 > 0) do
begin
remainder := (base10 mod 36) + 1;
base10 := base10 div 36;
endnumber := base36[remainder] + endnumber;
end;
writeln(endnumber);
end.
>>
>>59657423
pascal is such a comfy language.
>>
>>59657405
I think he means just fucking up the small stuff like

include (iostream)

int main()
{
std::cout>>"butts", std::endl
}
>>
>>59657405
no, I'm just sort of in over my head here. Graduated in 2014, last project was in 2015.
I'm a shitty programmer and trying to change it, but I can't change that in 2 days. especially working with a language I never touched before.
>>
File: program testpage.png (44KB, 753x771px) Image search: [Google]
program testpage.png
44KB, 753x771px
This is the assignment. Where should I upload the textfile?
>>
>>59657499
The 5 hour this is weird. they said I have 24 hours to submit the the paper says 5.
>>
>>59657499
filedropper

I will complete this assignment.
>>
>>59656830
There are no valid vector operations you can do on points.
Points and vectors are completetly different things.
>>
>>59657499
Read point 4
>>
>>59657559
You think he doesn't realize that?
>>
>>59657520
/medicalreports1211121111

Thank you. i will start studying c# like there's no tomorrow. hopefully I wont get fired in the first week.
>>
>>59657499
This program is 20 lines of code at best, if you can't do this shit, just drop out right now.
>>
>>59657583
I know, I'm sub Pajeet. i fucked up.
>>
>>59657583
I mean, considering it is so easy he won't have any issues catching up to this skill level. If this assignment actually was difficult this would've been a much worse idea.
>>
>>59657592
Do you not know any programming language?
I would write it in another language and then translate to C# or whatever they asked for, and then I'd scramble to learn the language before my start date.
>>
>>59657596
I'm doing
https://better-dpt-roll.github.io/
to be less of a shitter. How far down the list would you say is about equal to this skill level?
>>
Why does everyone condemn introducing people to programming with Python, when everyone was ok with introducing people to programming with Basic back in the 8-bit days?
>>
What would you lads recommend an "intermediate" programmer do to improve his skills?

Pretty much all I know is the fundamentals of C# from a couple years experience working on games with Unity. I've made things like basic AI with state machines, pathfinding, and a grid-based level editor, so I'm not a complete retard.

What are some things I could do to take my skills to the next level? Any specific reading materials? Should get familiar with C or C++?
>>
>>59657499
>I can't even get called in for internships
>This is the level they expect
I'm pretty upset
>>
>>59657613
I would refresh datastructures and algorithms as well if this assignment doesn't scream symbol table (e.g, hash table) to you already
>>
>>59657613
you need a basic understanding of file I/O, string manipulation and argument parsing.

You'd better hurry the fuck up.
>>
>>59657630
We have infinitely better alternatives now. And Python teds to have the same stockholm effect as Java so its best to avoid it.
>>
>>59657524
A point is just a vector without magnitude.
>>
>>59657635
roll https://better-dpt-roll.github.io/ until you get a project you like.
And make sure its slightly over your head
>>
>>59657612
I know python java and c++ pretty well.
I could probably do it in one of those, but also. I'm very out of practice.
I remember concepts and the like, but my knowledge of syntax is almost gone.

Along with that knowledge went all of my confidence in programming. I feel like I'm starting from scratch.

>>59657644
Noted.
https://www.youtube.com/watch?v=lisiwUZJXqQ&t=3633s
helps me understand concepts, but a 1 hour video is nothing compared to actual coding.
>>
how to prove that the diagonal language that defaults to 0 for its own encoding is not decidable?
>>
>>59657635

Build these in C++

LinkedList
BST
HashMap
>>
>>59657668
>i know [language]
>i can't write useful software in [language]
you don't know python java or c++

enjoy getting blacklisted
>>
>>59657691
Well I did say I'm out of practice. I'll rephrase
I know a bit of those languages. but I'm not an expert or very advanced in any of them. I might be able to pull this off in those languages but even that is a pretty big maybe. I forgot a lot of what I learned in college.
>>
File: AAAAAAAAAAAAAAAA.jpg (78KB, 970x771px) Image search: [Google]
AAAAAAAAAAAAAAAA.jpg
78KB, 970x771px
>>59657728
>literal retards like you can get interviews because DEGREE
>can't even get rejection letters because self-taught

FUCK EVERYTHING
>>
template <typename T>
struct vector2
{
T x, y;
constexpr vector2(const auto& _x, const auto& _y) noexcept : x(_x), y(_y) { }

template <typename U> constexpr vector2(const vector2<U>& c) noexcept : x(static_cast<T>(c.x)), y(static_cast<T>(c.x)) { }
template <typename U> constexpr vector2(vector2<U>&& m) noexcept : x(static_cast<T&&>(std::move(m.x))), y(static_cast<T&&>(std::move(m.y))) { }
template <typename U> constexpr vector2& operator=(const vector2<U>& c) noexcept { x = static_cast<T>(c.y); y = static_cast<T>(c.y); return *this; };
template <typename U> constexpr vector2& operator=(vector2<U>&& m) noexcept { x = static_cast<T&&>(std::move(m.x)); y = static_cast<T&&>(std::move(m.y)); return *this; }

template <typename U> constexpr auto& operator+=(const vector2<U>& rhs) { x += rhs.x; y += rhs.y; return *this; }
template <typename U> constexpr auto& operator-=(const vector2<U>& rhs) { x -= rhs.x; y -= rhs.y; return *this; }

constexpr auto& operator*=(const auto& rhs) { x *= rhs; y *= rhs; return *this; }
constexpr auto& operator/=(const auto& rhs) { x /= rhs; y /= rhs; return *this; }

template <typename U> friend constexpr auto operator*(const vector2& lhs, const vector2<U>& rhs) { return lhs.x * rhs.x + lhs.y * lhs.y; }

template <typename U> friend constexpr auto operator+(const vector2& lhs, const vector2<U>& rhs) { return vector2<decltype(std::declval<T>() + std::declval<U>())> { lhs.x, lhs.y } += rhs; }
template <typename U> friend constexpr auto operator-(const vector2& lhs, const vector2<U>& rhs) { return vector2<decltype(std::declval<T>() - std::declval<U>())> { lhs.x, lhs.y } -= rhs; }

friend constexpr auto& operator<<(std::ostream& out, const vector2& in) { return out << '(' << in.x << ", " << in.y << ')'; }
};

using vector2i = vector2<std::int32_t>;
using vector2f = vector2<float>;

am I forgetting anything?
(omitted up/down/left/right functions since comment too long.)
>>
File: 1365527574904.jpg (101KB, 600x464px) Image search: [Google]
1365527574904.jpg
101KB, 600x464px
>>59657825
>>
>>59657652
>just
A complex number is 'just' a real number with an extra bit, but it makes a world of difference in how you think about them.

Adding or scaling points doesn't make any sense, so point + point should be a compiler error just like "hello" leftshift "world" should be.
>>
>>59657889
No, a real number is just a complex number where the imaginary part is equal to zero.
>>
>>59656280

To what extent are most programming languages interpreted?

Are there any that read straight up ascii?

Do most of them perform some kind of bytecode conversion?
>>
>>59657923
Same thing.
>>
File: 1405996672385.gif (196KB, 500x284px) Image search: [Google]
1405996672385.gif
196KB, 500x284px
>>59657790
>>59657637
Even worse when retards like >>59657520 will do his work for him
>>
>>59656569
More generally you can use homogeneous coordinates and represent both points and vectors in 2D using 3 components. The extra component is zero for a 2D vector and otherwise the homogeneous coordinate (x, y, z) represents the point (x/z, y/z). This allows you to use matrices to transform points and vectors uniformly, but in a special way: transformations like translations will not have an effect on vectors.
>>
File: Edsger_Wybe_Dijkstra.jpg (846KB, 1200x1600px) Image search: [Google]
Edsger_Wybe_Dijkstra.jpg
846KB, 1200x1600px
>>59657630
>when everyone was ok with introducing people to programming with Basic back in the 8-bit days?
>It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
>>
>>59657995
That's absolutely stupid. I learned with Basic. ANd I'm a fucking good coder.
>>
File: anal beads.png (37KB, 767x535px) Image search: [Google]
anal beads.png
37KB, 767x535px
>>59657499
>>59657582
here's my quick hack

seems to work

>>59657956
:^)
>>
>>59658011
When did you learn BASIC?
>>
>>59658039
When I was seven. And at 17 I switch to caml-light.
>>
>>59657825
is there any reason this couldn't be replaced with a few macros?
>>
>>59658049
I mean years Anno Domini.
>>
>>59658011
lmao look a him he's a CODER
no wonder yuor such a shit
>>
>>59658031
Its alright, i'm employed

However be aware you're putting a huge burden on whoever is unlucky enough to hire this literal subpajeet
>>
>>59658050
Why would you replace templates with macros?
>>
>>59658085
That's the idea. I want to sink the competition.
>>
>>59658085
Most jobs have a probation period don't they. If anon underperforms it shouldn't be difficult to fire him.
>>
>>59657995
>>59658011
Look: http://programmingisterrible.com/post/40132515169/dijkstra-basic
>>
>>59658061
1990

>>59658083
>CODER
Nothing wrong with that term. Only idiots hide behind words.
>>
>>59658097
There's significant overhead in hiring someone and having them on staff for 3 months if you have to fire them at that point.

A company that constantly does this is throwing away money and damaging morale.
>>
>>59658111
That's what happens when colleges become job training and not even good job training at that.

Most CS grads don't even open their text editor outside of class, guess which ones are making the retard threads asking for help.
>>
>>59658107
Dijkstra was too young to understand that the problem wasn't basic, but the programmers themselves.
>>
>>59658131
Is it the ones that don't open their text editors outside of class?
>>
>>59656702
>in notepad.exe
You mean *.txt?
Anyway, since there are newlines, youe program can take them into account (even if you can't see them).
>>
>>59658110
> 1990
I think at the time when Dijkstra said that, BASIC was not so good.
And I know FORTRAN 77. It's clearly inferior to later Fortran versions.
>>
>>59658142
your*
>>
>>59658096
>Subpajeet asks for chump change because he is desperate to get hired
>Next time HR will use that wages bar by the time he get his ass fired
>HR will not have problem randomly hiring literal whos without skills because its so cheap
>Wages on the industry sink even lower
Congratulations, was sabotaging yourself part of your plan?
>>
>>59658085
>>59658096
>>59658097
>>59658111
Sorry I'm a subpajeet I'm trying to fix it. I was already ready to give up when anon offered to help.

>>59658131
I used to do extra programming all the time I loved it, then life happened and I fell off badly. now I'm just a shit.

>>59658031
I cannot thank you enough.
>>
>>59658050
I'd like to see your macro implementation then.
>>
>>59658188
>I was already ready to give up when anon offered to do the entire thing for me
ftfy
>>
>>59656342
>UML
Isn't that just enterprise stick figures?
>>
>>59656542
What are you writing? Why do you need ncurses?
>>
>>59657825
>constexpr vector2(const auto& _x, const auto& _y)

That's not yet possible, anon-kun.
>>
>>59658188
>I cannot thank you enough.
Thank me by becoming competent.

There's a few things you should know:
I've got
using static System.Console;
in my header.

.ChunkOn is defined as an extension method as:
public static IEnumerable<IList<T>> ChunkOn<T>(this IEnumerable<T> source, Func<T, bool> startChunk)
{
List<T> list = new List<T>();

foreach (var item in source)
{
if(startChunk(item) && list.Count > 0)
{
yield return list;
list = new List<T>();
}

list.Add(item);
}

if(list.Count > 0)
{
yield return list;
}
}


You also may need to add a
.ToList()
before any calls to
.ForEach()
.
>>
>>59658255
gcc doesn't complain though.
>>
>>59658286
It's an extension until we have concepts.
>>
>>59656342
>hoping it'll help me be able to plan something without having to refactor code because of an interaction I forgot every thirty minutes.
Literally just don't use OOP and you will never have this problem.
>>
>>59658257
So I do
>>59658031
for each attribute

>>59658257
and that is to define the chunk method you used.
I put it in the same class but different method right?
>>
>>59658326
i can't take people talking about good oop practices, design patterns and refactoring seriously now because of /g/
>>
>>59658340
Consider that nobody has ever presented any contradictory evidence to the anti-OOP claims.
>>
File: anal beads.png (82KB, 393x1763px) Image search: [Google]
anal beads.png
82KB, 393x1763px
>>59658330

I have converted the medical records to family-friendly JSON.

You should just hand them this and say it's going to cost them money to get the solution.

Tell them they're not going to take advantage of our prowess to get free dev time out of you in the guise of an interview.
>>
>>59658354

That's because OOP users are smart enough to not take the bait.
>>
>>59658361
...or they simply don't exist here.
>>
>>59658361
STFU filthy code monkey.
>>
>>59658395
You'd have to be retarded to honestly believe this.
>>
yesterday I had no time to thank the guy who answered my VBA question

thank you anon
>>
>>59658354
The anti-OOP fad is unsubstantiated nonsense. Good OOP doesn't have the problems they complain about.
>>
>>59658422
I'm not here 24/7 so I wouldn't know.
>>
@59658495
>s unsubstantiated nonsense
Alright pajeet, just ignore the immense amount of articles, talks, discussions, and languages that came out of anti-OOP.
>>
>>59658495
What's an example of good OOP though?
>>
File: anal beads.png (135KB, 1407x813px) Image search: [Google]
anal beads.png
135KB, 1407x813px
>>59658358
>>
>>59658541
>Total number of films 420
DUDE
>>
>>59658519
It's a matter of principles. Depend on abstractions, not concrete implementations. Use inheritance, not subtyping. Inheritance isn't evil but you have to use it correctly. Code reuse and polymorphism. Abstraction and data hiding. That's good OOP.
>>
File: 1361918884095.png (42KB, 344x517px) Image search: [Google]
1361918884095.png
42KB, 344x517px
>>59658571
Fuck off self
>>
>>59658584
>Code reuse and polymorphism.
>Abstraction
Is better with functional programming.

>data hiding
Is inferior to Ada-style invariants or dependent types.
>>
>>59658584
>Use inheritance, not subtyping
Theres no precision with inheritance.
Its just a clunky cluterfuck of new's
>>
>>59658584
thanks, i'll stick to data oriented design
>>
Trying to write a data structure (C++) to represent an undirected weighted graph so I can test some graph search algorithms.
>>
>>59658675
N nodes => (N-1)x(N-1) upper triangular matrix of weights
>>
>>59658712

I wrote an adjacency matrix class, I'm trying to see if it will be useful for testing some things on like TSP or djisktkstkstra's algorithm
>>
>>59658584
Use composition not inheritance
>>
>>59658712
sounds inefficient
>>
>>59658781
That's what you do conceptually, you don't actually allocate a whole 2D array and use half.
>>
>>59658584
>Code reuse and polymorphism. Abstraction and data hiding
These aren't exclusive to OOP.

>Inheritance isn't evil but you have to use it correctly
Nobody will ever agree on the correct way and stick to it. Interfaces get the job done without objects.

There's a reason modern programming languages like Go and Rust are ditching OOP.
>>
Can I program in Windows in C++/C# in more light environment than Visual Studio?
>>
>>59658879
Sure. Just write code in whatever and compile it through the console like you would in unix
>>
>>59658879
You don't need to use the VS IDE to use the compiler.
>>
>>59658879
Code Blocks or Vim and a shell.
>>
>>59658913
And yet I need to install multigigabyte VS?
>>
>>59658831
These languages are discovering that certain jobs just don't get done sensibly without inheritance, Rust will be adding it and even Go is reconsidering the choice not to have polymorphism.

>>59658623
Subjective judgements are meaningless here, OOP is objective.
>>
>>59658947
>These languages are discovering that certain jobs just don't get done sensibly without inheritance
Such as?

>Rust will be adding it
Source?

>Subjective
No.
>>
>>59658947
>Rust will be adding it and even Go is reconsidering the choice not to have polymorphism.

Source, senpai?
>>
>>59658963
Single inheritance for non-functional is fine. Anything more is bad design.
>>
>>59658879
for cpp try CLion
>>
>>59658984
That's not a job that can't be done sensibly without inheritance.
>>
>>59658984
There is nothing wrong with multiple inheritance as long as you don't confuse inheritance with subtyping. They are different.
>>
I'm not sure if this belongs here or in /sqt/,

I always read people say stuff like, "don't reinvent the wheel" and "the smartest programmers are those who don't waste time doing what's already been done". I see what they're talking about, but how am I supposed to find completely free-use api's and packages that have the functionality I need? Right now I'm in the planning stages of making a program for learning spanish, and I was creating my own way of distinguishing verb types, and someone here told me I was doing unnecessary work and I should just find something someone else has created.

How do I find such things?
>>
>>59659014
why not use composition for everything?
>>
>>59658947
>Go is reconsidering the choice not to have polymorphism
Source?
>>
>>59659015
reinventing the wheel is great for educational purposes though
>>
>>59659014
>as long as you don't confuse inheritance with subtyping
What language doesn't force subclasses to be subtypes?
>>
>>59659002
Sure, any inheritance can be re-designed out. Im just talking a middle ground.
>>59659014
MI is way too easily abused and prone to spaghetti. Its best to just avoid it all together.
>>
>>59659059
Are you the guy that said:
>These languages are discovering that certain jobs just don't get done sensibly without inheritance
?
>>
>>59659015
these are the same retards that tell 'don't roll your own crypto' and cry about 'not implemented here' syndrome. don't listen anon, write boilerplate when you need it. write tools from scratch when you could use a framework. be your own man
>>
I feel like I am too stupid to even be helped.
>>
>>59659015
That depends a lot on language. Ideally there is some global repository you can search. Also, reinventing the wheel is fine, if it leads to a sizable performance improvement.
>>
>>59659065
i am not.
>>
How's Boehm GC?
>>
>>59659075
You haven't asked any question to help for you.
>>
>>59659089
Alright. Funny how guy says there are examples that prove his point but then fucks off without providing any.
>>
>>59659053
OCaml and OCaml does object right.
>>
>>59659082
Which it almost never does.
>>
>>59659098
I'm the csharp guy

Someone did the work for me and I'm still lost. How did I get this bad? I wasn't always this shitty.
>>
>>59659098
That's because he knows he's too stupid to understand the answers.
I can sympathize.
>>
>>59659069
>retards that tell 'don't roll your own crypto'
either you went too far and accidentally picked a horrible example, or you are really this retarded
>>
>>59659113
99% of web development is hardly "almost never".
>>
>>59659130
any answer can get simplified down fan enough, defeatists deserve nothing but themselves
>>
>>59659120
>Someone did the work for me
>I'm still lost.
Well DUH!
>>
I need some advice with a space invaders game.
I'm trying to do a uniform grid collision detection, where I have a 2d array of lists of entities. Now, when I want to check collisions, I check every location in the 2d array to see if there are 2 entities in it, right?
Well, if there are, I'm supposed to check if the entities in the square collide.
However, this calls for up to 4 for loops, which seems so inefficient. Am I doing something wrong, am I missing something?

void Level::CheckCollisions(){
for(int x=0; x<10; x++){
for(int y=0; y<10; y++){
if(detectionGrid[x][y].size()>1){
for( int i=1;i<detectionGrid[x][y].size();i++){
for( int j=i;j<detectionGrid[x][y].size();j++){

}

}
}
}
}
}
[\code]
>>
Starting to work on a very pathetic text editor (I want to learn how to do GUI applications) in FLTK.

Quick question on compiling with XCode vs GCC
With XCode, I have the following code:
#include <iostream>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main(int argc, char **argv)
{
//blarg
}


With the following set as my "Header Search Paths":
/usr/local/include

My question is: How would I translate this to compiling from the command line?
So far, doing this:
gcc -I/usr/local/include/FL -lfltk test.cpp 
leads to a bunch of liner errors... any help?
>>
>>59659109
And nobody uses OCaml's objects

I think Haskell typeclasses + GADTs form a perfectly reasonable kind of """polymorphism""" for functional languages
>>
>>59659161
g++, not gcc
>>
>>59658946
ms build tools is like 20MB
>>
>>59658946
No, the Windows SDK includes all the compilers as far as I'm aware.
>>
>>59659173
>And nobody uses OCaml's objects
Of course FP>>>>>>>>>>>>>>OOP

OOP guys use lambda in their language and FP guys don't use objects in their languages.
>impliying...
>>
>>59659148
I picked up c++ in like 2 weeks the first time I learned it. I was writing all kinds of shit with it. And now I can barely read through a text file. Where the hell did my brain go.
>>
>>59658584
Amazing. Thanks for simply parroting the oft-repeated tenets of "good" OOP without actually providing any concrete examples of OOP improving the design of a system.
>>
>>59659153
>I check every location in the 2d array to see if there are 2 entities in it, right?
no,a bounding box
>>
>>59659161
>Starting to work on a very pathetic text editor
Me too.
>>
>>59659173
Polymorphism is more than subtype polymorphism. Haskell has parametric polymorphism with generics and ad hoc polymorphism with type classes.
>>
>>59659015
learn the terminology of what you are doing then google it (a few languages have a package manager too)? Of course, if what you are doing is niche enough there might be nothing, then anon was BSing you
>>
>>59659153
Counting loops as a measure of efficiency is pretty stupid
>>
how do you go about using stuff other than php for website backends? like, how would you run a C program? say if i want the user to enter a number into a field and then run a c program to tell if it's prime, and use the results of that to tell the user if it's prime
>>
>>59659153
I'm not sure how you have your game logic set up, but this is some way you could do it.
I'm assuming you have a "player/enemy" class and a "projectile" class. This allows you to do the following loop:
For every entity:
For every projectile:
Check if the projectile's x/y coords. match up with the entity's x/y coordinates

Essentially what this guy's saying: >>59659207


>>59659175
It seems like using g++ didn't solve the issue (though this would have definitely caused troubles in the future)

Error message ends with:
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>
>>59659252
how are you not blind yet
>>
>>59659252
Install Linux. That's the only OS really designed for coding.
>>
>>59659216
Yes exactly. It has all of the kinds of polymorphism, with more streamlined syntax for parametric polymorphism.
Java has streamlined adhoc polymorphism, and very weak generics/parametric polymorphism. And it turns out ad hoc isnt as useful as youd expect
>>
>>59659249
http://learnbchs.org
>>
>>59659273
>how are you not blind yet
What'd I do wrong this time?
>>
>>59659305
that yellow on purple is eye-bleeding
>>
>>59659300
>It's a hipster-free
>hipsterish site
Oh, the irony!
>>
>>59659305
the colors
>>
>>59659300
isn't that a joke?
>>
>>59659153
Your grid is only 10 by 10, nothing you do is gonna make any measurable difference.
>>
Are comma separated values a good way to store data into a file, or should I be looking into some sort of database system (like SQL or something)?

I need to store around 10,000 strings, where chunks of the CSV's will 'belong' to the same object. So, say my data retrieval method can take a bunch of parameters, p1, p2, p3, etc.., where p1 will retrieve the first 100 strings, p2 will retrieve strings 100 thru 200, and so on... (unfortunately, the system is unlikely to be so uniformly distributed and will probably be like p1 <--> 117 entries, p2 <--> 87 entries, and so on)

Ideally the system would be random access, so that if p5 gets called, it doesn't have to sift through 400 CSV entries to get to the beginning of its chunk, which is why I'm thinking CSV's may not be a good idea. But something like SQL seems a little overboard also.
>>
>>59659300
Why the fuck would you want to write web apps in C?
Most of web is basically text processing or database management. C is bad at both and doesn't help you write secure code unless you are *extremely* dilligent
>>
>>59659356
There's nothing wrong with C.
>>
>>59659207
>>59659252

Right. But that would be the second step. The grid would suppose to be more efficient, since you don't need to match the ones who don't share a grid square.

>>59659331
Maybe I should just throw the idea away, I won't have 100+ entities that'll require optimization I guess.
>>
>>59659363
There are better languages for text processing.
>>
>>59658584
>no example
>>
>>59659371
Its one for loop checking against an entity vs your monstrosity.
>>
>>59659363
I gave reasons for whats wrong with C. If you'd like to convice me that working with strings or recovering from errors in C isn't a pain, please do so
>>
>>59659386
If you don't know how to process text in C, that's your own fault. Don't blame it on the language.
>>
>>59659356
guy he responded to here, just wanted to know how. in case i have to in the future
>>
>>59659408
>HURR DURR THERE'S NOTHING NO HIDE IF THERE IS NO CRIME
>>
>>59659405
It's one for loop comparing every single entity to every other single entity in existence.
>>
>>59659323
>>59659327
Alright... Is this better?
desu, I kind of need suggestions for terminal themes (font, bg color, font color), and I was too lazy to change anything
>>
>>59659249
You either write a CGI script or run the program as a web server.
>>
File: 1480712963344.png (953KB, 1000x680px) Image search: [Google]
1480712963344.png
953KB, 1000x680px
>>59656280

Im a beginner developer, the languages im familiar with is Pascal, Visual Basic, PHP.

I got a work offer to develop a video management software (for soccer games) that select clips from the game and add ssome statistics to them and saves them in sub folders.

I don't even know where to start but I have a lot of time to develop it.

What language could I use for this project that can I can learn with relative ease?
>>
>>59659363
>These languages are discovering that certain jobs just don't get done sensibly without inheritance
Well which ones? I don't see how it'd be a huge bother
>>
>>59659408
I know how to process text in C.
I say there are easier and more convenient languages to work with text.
And there's one from C creator.
>>
>>59659443
python, c#, java, etc... will all work.
>>
>>59659437
Do whatever you like.
But typically background colors have a lot of saturation, and the text color just increases the lum to something off-white.
>>
>>59659348
Just use an sqlite database
>>
>>59659443
>learn with relative ease
Go

And your problem seems like it could be solved with simple enough FFMPEG calls.
>>
>>59659443
python
>>
>>59659495
ok, thanks.
>>
>>59659475
>And there's one from C creator.
?
>>
>>59659562
AWK.
>>
I'm learning C, and so far all I can do is basic arithmetics, how long until I can code my very own virtual gf?
>>
>>59659567
Oh wait, Kernighan is K&R co-author.
The more I know.
>>
>>59659589
>AI in C
wew
>>
>>59659610
rude!~
>>
>>59659610
>AI in anything but C and Lisp
eww
>>
I'm a math major, should I make the switch to CS? Math has become boring after doing it for 3+ years at the university.
>>
>>59659589
easy, just use scanf and printf to make a chat and then write the dialog. assuming you wanted graphics it's be more complicated and you'd need an anime artist and a graphics library
>>
>>59659666
>LisBOT, how many brackets are you made of?
>>
File: 233281936737435648.png (22KB, 128x128px) Image search: [Google]
233281936737435648.png
22KB, 128x128px
>unpaid internship for 3 months
>had to learn PHP
>he didn't even hire me at the end despite doing everything he asked for


I have a bit over 1 year experience with ASP.NET/C#, should I get deeper into that? I attempted to branch out with PHP but idk what to do now.
>>
>>59659683
probably, everybody here says that programming is heavily tied to maths.
Since i only did highschool i wanna ask a question, Did you study lambda calculus? is it hard?
>>
>>59659715
non-wage slave lmao
>>
>>59659711
((I ((( Don'(t (( underst(a(nd wha( you) ))) ))me)an))))
>>
>>59659729
lambda calculus is just functions, in the mathematical sense.

it's just stuff like this

${\textstyle ((x,y)\mapsto x^{2}+y^{2})(5,2)}$
>>
>>59659683
it's not too uncommon to double major with csci and math
>>
>>59659801
Oh, thanks i thought it was super complex shit.
i gotta study it, i suppose it will help me to learn how to program.
>>
>>59659823
it'll help you code golf in haskell and scheme better for sure
>>
>>59659711
>not calling her Lisa
>>
>>59659850
you mean Litha.
>>
File: 19836136.png (265KB, 609x461px) Image search: [Google]
19836136.png
265KB, 609x461px
>>59659850
>>59659874
>not calling her Lain
>>
>>59659729
>>59659823
Lambda calculus is mostly used in formalizing type theory these days. If all you want to do is use higher order functions effectively then you don't need to care about things like eta conversions or Church encoding.
>>
>>59659715
PHP is the deepest circle of webdev hell. Avoid, unless starving for money, and avoid anyone actually advocating PHP.
>>
>>59659885
Theres no bad joke with that.
>>
>>59659885
>implying you can write an AI worthy to carry her name
>>
>>59659889
no one >likes< php, it's just easy to use. you plop it in. it's used loads of places
>>
https://www.youtube.com/watch?v=MBvdWULRBU8

how do i become an ebin hacker to make things like this
>>
>>59659914
Just like prostitution.
>>
>>59659911
Trust me, I work at Tachibana labs
>>
>>59659914
there is absolutely no consistency anywhere in the entire language. that doesn't fit my definition of "easy to use".
>>
>>59660069
i didn't say easy to write in, i said easy to use
>>
If I don't turn in anything for this job review how bad is that compared to turning in the best I can do even though its totally horrible and the program doesn't even work? would either 1 get me black listed?
>>
>>59660356
Why on earth would the first "black list" you. Just mail them saying you withdraw your application if you're worried they'll take offense if you drop out with notice.
>>
>>59660448
What about the second? Is it worthtrying my best even though I might flop badly?
>>
>>59656294
haha welcome 2 first year CS what are u 17
>>
>>59660477
On that specific company? Maybe. I don't know. You're applying for some job, right? And they want you to do some assignment? Or what?
>>
>>59660533
yep. they want me to do an assignment to see where I'm at programming wise.
Its over my head, but I could always try. but I don't want to try and they're so offended by my poor programming that they blacklist me.
>>
>>59660545
>that they blacklist me.
If you cant do the test just withdrawal with " i changed my mind"

I think this blacklist meme is silly outside of people who actually get fired. The CS world is 2giant for a cabal list.
>>
File: 1487824100725.png (565KB, 600x610px) Image search: [Google]
1487824100725.png
565KB, 600x610px
>>59660545
>they're so offended by my poor programming that they blacklist me.
pretty funny thinking about it
>>
>start categorizing checkins as "feature", "fix", "refactor", etc.
>create class that isn't used yet
>want to check it in
>not sure what it is

Is it a feature?
>>
File: Screenshot_2017-03-30_23-54-34.png (113KB, 683x700px) Image search: [Google]
Screenshot_2017-03-30_23-54-34.png
113KB, 683x700px
>>59656280
>What are you working on, /g/?
Site-wide admin notifications. Submission and propagation is done, just need to fix the display part.
>>
>>59660695
you need a pre-feature category
>>
>>59660695
future
>>
>>59660621
HR departments pass around a "do not contact list" with other regional HR people as a heads up so they don't waste their time with problem applicants

It's not like they have anything else to do, they keep in contact with each other.
>>
>>59660695
>class that isn't used yet
"Waste of time"
>>
File: moot_spike.png (159KB, 504x381px) Image search: [Google]
moot_spike.png
159KB, 504x381px
>>59659482
>>59659496
>>59659500

Thank you anons.

I also found codeacademy to learn some basics.
>>
File: 1478608314279.jpg (52KB, 500x500px) Image search: [Google]
1478608314279.jpg
52KB, 500x500px
>>59657499
>email a zip file
>>
>>59657790

Look for "or equivalent experience".

Send in a convincing example related to their business - something that solves a problem or demonstrates aptitude.

Shit-tier examples:
>muh indie platformer
>muh minecraft clone
>muh Unity poop in general

Great-tier examples:
>Sim City clones
>PhysX/Havok physics engine clones
>Multiple-precision integer arithmetic - with division and GCD

God-tier examples:
>Standards-compliant compilers: hand-written (for C or a subset of C++ - e.g. a shader compiler)
>Minimalistic FEM-based fluid simulation that can run at interactive speeds
>Minimalistic CSG based CAD suite (stable B-Rep implementation is 100x more impressive)

If they can't respect the work that went into any of those kinds of samples, working with them will be more damaging to your mental health than starving to death.
>>
>>59661046
>Minimalistic FEM-based fluid simulation that can run at interactive speeds
I'm working on a similar framework kind of like the Fenics back end. Does 1 and 2d scalar simulations on regular geometries. Slow as balls though.
>>
File: 1489157020195.jpg (51KB, 666x501px) Image search: [Google]
1489157020195.jpg
51KB, 666x501px
>Subpajeet is so fucking bad he manages to break the code and flop interviews after someone else did all the job for him and literally gave him the answers
CAN'T MAKE THIS SHIT UP
>>
saw someone using this instead of some kind of counter += 1

d = [0] + [len([1 for i in range(1, j + 1) if j % i == 0]) for j in range(1, n + 1)]


is this good or bad?
>>
>>59661111
Nice quads
>>
>>59661125
wtf is that supposed to do?
>>
cmake is gay
>>
>>59659715
How are unpaid internships even legal?
They don't even cover the gas you spent driving there everyday?

This is literal slavery.
>>
>>59661173

its counter divisors of numbers

and instead of using something like

counter = counter + 1

he fills a list with 1s and counts the length of the list so his code looks tidy

but is this actually a good habit?
>>
>>59661111

I'm supposed to say "yuuze cooda", but its basically useless for anything but VERY REGULARLY structured data (asinine bus latency aside).

Use yourself a thread pool and: Split your domain into several pieces, then patch them together at the seams (if possible - not everything permits this), and your solver (most likely CG) should be easy to parallelize. Just don't make the mistake of forcing the calling thread wait for every operation to complete - have it handle the largest subset.

Also: Gauss-Seidel doesn't cope with stiff problems as well as it is suggested to.
>>
>>59661209
its """"""""""voluntary""""""""
>>
>>59661211

* it counts the divisors
>>
>>59661202

And what don't you like about CMake?
>>
>>59661211
not really, as the code is pretty unreadable in this case.
>>
New thread:

>>59661245
>>59661245
>>59661245
>>
>>59661209
>>59661230

Here's how it works:
time == money
knowledge == time
experience == time
=>
knowledge + experience == 2*money

You see? They're actually paid nearly twice as much as they should be!
>>
>>59661213
DDM with preconditioning is one of the things I plan to implement at some point. I just don't have enough features in the preprocessing part yet to feel like it deserves focus for now (I still use Eigen as the linear solver). The solver is BiCGS for now even though I only deal in symmetric problems (although I already managed to assemble and solve advection problems).
Thread posts: 317
Thread images: 28


[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.