[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: 320
Thread images: 26

File: moogs.jpg (121KB, 1280x720px) Image search: [Google]
moogs.jpg
121KB, 1280x720px
What are you working on, /g/?

Previous thread:>>61461859
>>
>>61469216
>>> https://reddit.com/r/anime
>>
How good math skills do you need if you want to study programming at uni, or whatever?
>>
>>61469045
>anti-oop
Yeah. It's not related to him at all though.
I'm just taking them as an example of how much programmers follow stupid trends.
Pair programming was brought up on stream. It was really popular actually.
I feel OOP is very similar in that it's light on promises and people ignore the downsides.
>>
>>61469284
>study programming at uni
If you're talking about taking individual courses it's not much at all.
If you're talking about a CE or CS degree it's quite a bit.

I don't think you should go to uni for programming courses unless it's to get the merits. You'll learn faster with most online materials or just books.
>>
File: 1407726974855.gif (885KB, 480x270px) Image search: [Google]
1407726974855.gif
885KB, 480x270px
>>61469216
Thank you for making a non-mudslime /dpt/
>>
File: .jpg (32KB, 640x348px) Image search: [Google]
.jpg
32KB, 640x348px
>>61469342
I don't approve of this unfair treatment of mudslimes. Mudslimes can be just as programming related as anime as anime girls.
>>
What is the Java of anime?
>>
>>61469315
pair programming is completely worthless corporate bullshit
OOP doesn't have 'downsides' because if your problem doesn't suit OOP, you don't have to use it
but anti-OOP grognards act like using OOP means you have to turn into a terrible Java programmer who has to have an object and encapsulated interface for everything
>>
>>61469378
Dragon Ball Z
>>
>>61469378
k-on
>>
>>61469388
>OOP doesn't have downsides
Wow. You genuinely believe this?
>>
>>61469378
Bleach
>>
>>61469396
>not Naruto
Go to bed grandpa.
>>
>>61469413
>95% of the show is verbose monologues
>the other 5% is cool for exactly 10 seconds before the monologues start again
>characters get increasing absurd
>multiple inheritance POO everywhere
>>
File: 1414301152206.png (1005KB, 753x673px) Image search: [Google]
1414301152206.png
1005KB, 753x673px
>>61469388
>OOP doesn't have downsides because you can just not use it
>>
>>61469408
I mean it in the sense that it's not an 'ideology' like pair programming is, it's not something that's forced upon you, you can choose to use it or you can choose not to use it
>>
>>61469450
Pair programming isn't an ideology. It's something you're encouraged to do for misguided reasons.
Nobody ever claimed you should never ever program alone.
>it's forced on you
That's true. Much like OOP or TDD or any of these corporate memes.
>>
>>61469471
>It's something you're encouraged to do for misguided reasons.
that's basically what an ideology is
pair programming is completely useless
TTD is only useful when safety matters like code that drives machines
OOP has plenty of uses and the only argument people have come up with against it is by looking at stuff like Java and saying 'well not everything fits this paradigm so OOP sucks'
>>
>>61469383
back to ribbit
>>>/r/ibbit
>>
>>61469439
AIDs doesn't have any downsies; you just don't have to catch it
>>
>>61469551
Ayy lmao it worked
>>
>>61469503
>encouraged to do it for misguided reasons
Perhaps I didn't make myself clear but OOP is exactly the same. It started off with the promise of encapsulating state which was something bad programmers had issue with. People keep adding on promises. Some weak some strong. But I haven't seen OOP deliver on it ever.

>OOP has plenty of uses
Elaborate anon. What are these uses?
I hear people list things but tell me how it helps. Let's take the popular example of GUI perhaps.
It has so many drawbacks there it's not even funny. The only reason I see why people think oop fits gui is because it fits their mental model well there. The visual elements can be objects. They do have actions they can manage themselves and they can pass messages in a sane manner.

But among the drawbacks is massive inflexibility in interaction. So much redundant state you need to track.
>but you dont
You do. Through a library or whenever you have to take it on yourself because you don't have the most simple use case for you UI.
Customizing object classes creates massive code coupling for no sensible reason.
It's one of the few retained mode api still in use. We moved away from that shit for very good reason.
You take on a huge amount of initialization effort too.

And I dont see the upsides compared to the alternatives. For a greenhorn it's way more complicated than many of the other ways to do GUI. For senior developers it still introduces a layer where you need to translate your data into presentable form instead of letting your GUI act on the data and present it for you like most other solutions do.

It's a terrible fit yet i hear people claim that's one of the places where oop shines. Not that it matters. I'm not new to this game. These ideologies are just like that. They claim they're the best for everything and slowly their claim erodes until there's next to nothing left.
Just a few years OOP was THE way to program for everything. It's tough to find anyone saying that now.
>>
>>61469503

>that's basically what an ideology is

So you really think companies decide on a whim to introduce things "for the lulz"?
You don't think they measure the results, compare and try to optimize their results?

Goddamn..

>pair programming is completely useless

It has serveral advantages. You can team up experienced devs with newbies and therefore:
-you power-up your code quality, since the review process is already included and the newbie won't make huge mistakes
-the newbie will learn a lot and therefor you can build up good devs faster
-people do less breaks for checking emails or stuff like that (if any)
-people have a minimum of social interaction and therefore don't get dull so fast
-you use the "coding breaks" for reviewing, this way they can regenerate and think about the code at the same time
-people will challenge themseves when their code gets immediate feedback


>TTD is only useful when safety matters like code that drives machines

TDD has so many advantages, I don't even know where to start..

-people usually try to NOT write tests or they do it at the end when they have completely forgotten what they should test
-writing tests after your code always means you test what you just wrote, if you write the tests first you sperate the "what" form the "how" (you think about he behaviour/results first and don't simply imitate your functions)
-writeing tests in the beginning can save you a lot of time, since it forces you to think about the details and edge cases of your implementation. if you find out that you try to accomplish the warong thing, its better to find out with a simple test you can write in 2 minutes and not after implementing a huge function that took you 30 minutes - only to find out you need to redesign/refactor things


>OOP has plenty of uses and the only argument people have come up with against it is by looking at stuff like Java and saying 'well not everything fits this paradigm so OOP sucks'

This is correct.
>>
>>61469664
>pair programming
It cripples any productive developer to at least some degree.
There's no guarantee programmers will agree on approaches or that their arguing will ever lead to improvements compared to having a single programmer implement and prove his case
The overall speed of programming as a pair is lower because both of you need to keep up with the code.

Also you're mistaking mentoring for pair programming. There's no explicit newbie+senior pairing.

To only present one side of an argument like this is misleading and its what causes people to follow these ideologies. You rarely hear of the explicit downsides of them before they're close to dead. You can read all about how pair programming fails. In a few years other ideologies will be born and old stuff will be on the chopping block.

If you're only presented with positives you should be extremely sceptical. People tend to leave scepticism at the door when it's taught at university though. Understandable because they're supposed to teach you hard truths. That's not what happens when CS people talk about software development though.
>>
>>61469659
yeah people treat OOP like an ideology and a crutch for bad programmers, that doesn't mean it's a completely worthless paradigm like pair programming
I'm not sure GUI is the best fit for an OOP model. It's great for objects in a video game. Binding functions to data is something people whine about alot but it makes alot of sense for plain data structures like lists and stacks and maps. Typing List.Add(object) is better than typing AddList(list,object)
>>
>>61469731
>Typing List.Add(object) is better than typing AddList(list,object)
That has literally nothing to do with OOP. That is pure syntactic sugar.
>>
>>61469664
>newbie
yes, they're crutches for bad programmers to limit the amount of damage they can do. Seriously, email breaks and social interaction? Don't try and justify something by applying it to complete retards. A competent programmer does not need to pair program
>>
>>61469731
>UFCS
>has anything to do with OOP
Oh. How silly of me I assumed I wasn't talking with a moron. I should probe more before I make lengthy posts.
>>
>>61469664
>Pair programming
>Not trash
You sound like a project manager.
You're a project manager aren't you?
>>
>>61469738
what do you consider OOP then?
>>
First time poster in dpt. Yesterday I made an Excel macro to set some values in a report I do daily, using a loop for each cell in a defined range, to be copied and pasted as values, to the cell to the right of it (thus becoming the "previous day" value)

I tried doing this with the entire ranges but I can't paste as values it seems.

Can anyone point me to what I'm doing wrong to cause the macro to start off slow, then speed up to normal speed at a seemingly random position? I've tried to not update the screen and disabled page breaks but that did not help.

Here's the loop I'm using:

    Dim CDay As Range
Dim Cell As Range
Set CDay = Range("CurrentDay") 'range was set in the spreadsheet with this name
[..]
For Each Cell In CDay
Cell.Copy
Cell.Offset(0, 1).PasteSpecial Paste:=xlPasteValues
Next Cell
Application.CutCopyMode = False
>>
File: 1498883278608.jpg (60KB, 500x375px) Image search: [Google]
1498883278608.jpg
60KB, 500x375px
how old can you get while keeping a programming job? im not talking about being promoted, being a sysadmin, or whatever other bullshit niche job that only a few can do. im talking about your average programmer in java, c/c++, webdev, etc. can i keep finding jobs until im 60? 50? im already 27 and i dropped out of college so i am considering what to do.
>>
>>61469727

>There's no guarantee programmers will agree on approaches or that their arguing will ever lead to improvements compared to having a single programmer implement and prove his case

That's one more pro of pair programming:
It develops the character.
Programmers that think like "thi is my code, I do it in my way, don't touch it" aren't good programmers. You need to be able to adapt. If you code something and then someone does it in a different way, that is shorter and more reliable, than you just need to swallow your pride and learn from the other one.


>The overall speed of programming as a pair is lower because both of you need to keep up with the code.

This is a false conclusion. You see, "programming" is not typewriting. It's not about lines of code. Most of the time you THINK about the code, and there is no speed disadvantage in parallel thinking. Often it's better to take a step back every now and then and rethink your design. It pays of in the long run.

"One of my most productive days was throwing away 1,000 lines of code."
-- Ken Thompson


>You rarely hear of the explicit downsides of them before they're close to dead.

That's because the downsides are obvious: you pay two people to do "the same thing".

The advantages are more subtle and you not so obvious, until you try it.


>You can read all about how pair programming fails.

This is also an oversimplification. Yes, Software is not about finding the "silver bullet", there is no "one size fits all". After all you are facing very difficult problems and different approaches offer different solutions to hard problems.


>>61469731

I wasnt talking about OOP yet, did I?
But "seperations of concerns" make sense and MVC makes sense.


>>61469748

That's to illustrate my point. If you have 15 "rock star programmers" that are battle-tested one-man armies that spit out brilliant code like a machine gun, forget pair programming. But who has those? Exactly.
>>
how hard would it be for someone with no programming language to make a GUI program that does this?
>open program
>prompt user to select directory
>promt user to select a mode of sorting (filename/date/size)
>prompt user to configure directory names (1 = C:\ , 2 = D:\Images,) etc
>display first image in set directory
>user presses the 1 key to move image into the director specified as 1
>image is moved to that directory
>display confirmation message
>load next image
>repeat
this would considerably increase the efficiency that I sort images
currently I just manually drag and drop, which doesn't work well when I have to go through tens of thousands of images
>>
>>61469888
The older you get, the more experience you're perceived to have. I've worked with a 55+ year old programmer and he was 10/10
>>
>>61469752
yes I know it's technically possible without, I don't even know what you define OOP as as I haven't used a language with method calls that isn't OOP
>>
>>61469888
>Past the age of 24

Might as well give up now, old timer
>>
>>61469904
Making a meme sorter would be good practice for intermediate learners. Not that difficult either.
>>
>>61469888
>>61469916
On a serious note, why the fuck are there so many people consistently afraid that they've missed the call after 20-something?

Are you guys taking Tech movies/shows as fact or something?
>>
>>61469895
uh, you don't need to be a "rock star" programmer, you just need to be competent
>>
>>61469922
yeah, but all I know is HTML, could never get a handle on programming
it seems like something simple enough to just write a shell script for though
>>
>>61469924
For everyone who isn't an 8 year old savant, apparently it's "too late" and they are doomed to failure.
>>
>>61469924
The "if you arent born a savant or started THING as soon an you were in the womb" meme taken too seriously.

A lot of famous people in all fields started late in life.
>>
>>61469934
A shell script would require an external image previewer and that could take focus away from your shell, requiring you to click back on the window.
>>
>>61469895
>there is no speed disadvantage in parallel thinking
if that was the case then my computer with 4 cores should run programs 4 times as fast
>>
>>61469934
The hardest part of that would be the GUI itself, honestly, and that's just because most GUI frameworks are a pile of horseshit.
Check out C#, putting together a really simple wpf viewing box shouldnt be too difficult. Or you can default back to win forms.
>>
If I increment a pointer that was passed as an argument, like so, does that change the pointer outside of the function? It doesn't seem to but I am new at this and might be wrong/probably am wrong?

int match(char c, char *s)
{
for ( ; *s; s++) {
if (c == *s)
return 1;
}
return 0;
}
>>
>>61469888

The first job is more difficult, but that's about it.
Try to get some practical experience, do internships if you must or at least make your own projects. Then age doesn't really matter that much.

>>61469959

Brains and computers work very different.

To illustrate this:
-Try to let your computer be really creative (i.e. tell a fantasy story)
-Try to solve a simple equation in your head

The former something where a 5 yaer old will beat any computer, the latter is something an oldtime computer will beat any math genius.


That's why reviews, refactoring and testing make sense for humans, but not for computers. 99% of all computer programms are deterministic, so if a computer could into human abstraction and imagination and could write good software, he wouldn't need to test it since he could only reproduce what he already has done.
>>
>>61470019
>does that change the pointer outside of the function?
No, you're only modifying a copy of the pointer you passed to the function.
>>
I hate webdev and C#/java but that's all that's available. Where are the C jobs? How do I get them without 40 years experience?
>>
>>61470112
>Where are the C jobs
Embedded systems jobs.
You don't want to go down that rabbithole.
>>
>>61470119
But I hate everything else. I'm honestly stumped as to what the fuck to do.
>>
>>61470112
Embedded and Operating System jobs, mostly. Unless you win the lottery and land a NASA job.

>How do I get them without XX years experience?
All of that shit is just "best case scenario hire." Put in resumes regardless, fag.
>>
>>61470054
the point is, unless they're twins or something, human communication is a huge overhead. unless you're really bad at programming and can't be trusted to produce satisfactory code I see no reason why you should do it in pairs
>>
>>61470127
Get a job working with C# at a small company.
It, at the very least, has pointer manipulation.
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/unsafe-code-pointers/pointer-types
>>
Can you land a decent prog job without falling for the LinkedIn meme? I have no desire whatsoever to make a fucking account for Job-Specific Facebook.
>>
>>61470171
"So anon, do you have a LinkedIn?"
"No"
"Wow, what are you, some kind of Luddite? We are looking for someone who isn't afraid of using new technology in our cool hip development firm."
>>
>>61470219
>Actual words spoken at a small startup in LA
>>
>>61470219
Do startups even use LI anymore?
>>
>>61470230
No, most of them will just take whoever knows a meme framework and will work for dirt cheap
>>
>>61469824
Update.

When I run the macro, Excel is slow on the part of the spreadsheet which is visible on the screen. A few seconds in, the program becomes non-responsive but you can still see the macro go through the cells and do the loop. The CPU usage is under 1% for Excel, basically idling.

Then the page scrolls, and instead of the new cells, there's a grey area. As soon as the cursor hits that grey area, the loop finishes almost instantly and CPU usage goes up to 25%.

What the fuck, Microsoft this worked perfectly yesterday.
>>
>>61469915
For example rust has method syntax without being OOP
>>
>>61470119
>>61470134
Not him, but what sorts of projects can I do to get these sorts of jobs more easily? I have a standard bachelors of computer science.
>>
>>61470332
Write a small operating system
>>
>>61470252
Why don't you just write a Python (or whatever else) script that generates the report for you and saves as .cvs then just import that in Excel instead? Would that work for you?
>>
>>61470332
Try googling: "Embedded Electronics projects" or "Operating System projects"
>>
>>61470358
I can't code for shit.
>>
File: sploorospardespude.jpg (106KB, 1024x355px) Image search: [Google]
sploorospardespude.jpg
106KB, 1024x355px
>>61469216
Why do normies always suggest Ruby or Python as a first language?

It seems like a *terrible* way to learn computer science desu. Both of them have an extensive, inconsistent syntax where feature X is invoked in an entirely different manner than feature Y. It's more like learning a new human language, which is not what computer science is about.

Why aren't we teaching all kids Scheme first? It's literally just
(operation operands ...)
for everything. Is there some kind of Python lobby pulling the strings at schools across the world?
>>
>>61470938
People who use high-level langs dont give a shit about understanding anything or being good programmers. They just want to get the job done.
>>
>>61470957
>>61470938
also forgot to mention why are you bitching about python when Lisp is just as bad?
>>
>>61470957
1. Scheme is a high-level lang.
2. get the job done != learning computer science

>>61470971
Lisp != Scheme
>>
>>61470938
Because a normalfag can fire up python, import a few modules, and generally get it to do whatever they want. It's not supposed to teach them about compsci or even programming in general, it's just a tool that lets them do what they want to do quickly and easily.
>>
>>61470957
>They just want to get the job done
That's a funny way to say "not think. at all."
>>
>>61470987
>Lisp != Scheme
Scheme is a Lisp.
>>
>>61471005
I thought Scheme was a standardized form of Lisp, since Lisp already had so many different dialects as people added their own features to the language.
>>
>>61470992
>It's not supposed to teach them about compsci or even programming in general, it's just a tool that lets them do what they want to do quickly and easily.
Then why do schools teach it?
Why does /dpt/ recommend it?

This is a series thread for non-brainlets who want to verse themselves in solid theory. "Just get the job done" computer niggers congregate in /wdg/.
>>
>>61471049
That's Common Lisp.

>>61471005
Scheme is a lisp but it's not Lisp, which always refers to Common Lisp in 2017.
>>
>>61470938
It doesn't matter what your first language is
>>
>>61471052
Since when does /dpt/ recommend Python? People who recommend it here are in an absolute minority.
>>
>>61470987
Lisp/Scheme abstract too much away for a novice. When they move to another language theyll basically have to re-learn programming.

The only language id feel okay recommending to a beginner is D. Maybe Rust if it ever sorts out the BC. Maybe Nim when it matures.
>>
>>61471052
you asked and you got your answer faggot
>>
>>61471083
Your answer fucking sucks.
>>
>>61471097
ok
>>
>>61471074
Recursion is way more natural than setting an iterator variable and running a for loop. Think about how fucking abstract that is from an objective standpoint.

You're just a baby duck.
>>
File: 009689_lin.png (3MB, 2921x2125px) Image search: [Google]
009689_lin.png
3MB, 2921x2125px
>>61469229
I'm working on a tool that stitches anime.
There, it's ontopic now.
>>
>>61471147
Very well! How's it going so far?
>>
>>61471115
>You're just a baby duck.
>VB-java-C-C++-D-Haskell-Idris
>Recursion is way more natural than setting an iterator variable and running a for loop.
D has many functional aspects, but beginners need to learn iteration. I fear for the people you try to brainwash into your lisp cult.
>>
>>61471165
It already works reasonably well but it is limited to simple motions (translation only, no zoom or rotate) and scene change detection is not quite right sometimes. but it's useful because it's much much faster than doing it manually. For the difficult cases I can still do it manually.
>>
>>61470938
>terrible way to learn CS
Certainly. CS people shouldn't touch programming languages at all. As far as choice of language goes I don't see CS people writing software that isn't trivial so almost any language will do if you wanted them to program.
C++, C and similar would just waste their time though.
>>
>>61471173
>beginners need to learn iteration
Why are you setting the next generation up for failure for no reason at all?
There's nothing inherently "easy" about iteration. It's more abstract actually.
>>
>>61471227
>It's more abstract actually.
its really not.
recursion is more an alien concept to many people. Loops and iteration are the foundation, we need to teach them. Theres nothing that says they then cant branch off and try other things such as a lisp or pascal or asm or FPL.

Stop having this shiity tribe/team mentality as you sound a little baby-duck yourself.
>>
>>61471115
>think about how abstract that is
Compared to having an implicit stack which keeps track of which of the many runs of the function you're on? That's very abstract.

I find for loops way more intuit. They're more like humans would do something. You set up state which you can repeat. Like slicing a tomato. You start at one end, increment it's position as you slice in a perpendicular to the direction you're cutting.
How does that work as a recursive function? It'd be rather contrived.

Now I don't think there should be a general preference (unless your compiler doesn't do TCO). They both vary in clarity based on the task. And every problem can be solved with either.
I'd say that generally the more parameters you pass down in your recursive calls the less suited it is for a recursive call solution.
As for what rookies find easier their confusion with recursion makes it quite clear it's not easier than iteration which people rarely fail. I've taught 2 101 programming courses. So perhaps I'm to blame. But I'd like to think I'm not.

But we always start with iteration. That's how I was made to teach. I don't think it matters that much.
>>
>>61471243
But I learned POO on C++ first. I just wish somebody introduced programming to me through Scheme. Would have saved a lot of hurt.

Anyway I homeschool our son and daughter. They are 9 and 7. I make them do their math lessons in Scheme every day and they don't have a problem understanding.
>>
>>61471283
>Anyway I homeschool our son and daughter. They are 9 and 7. I make them do their math lessons in Scheme every day and they don't have a problem understanding.
Oh god, youre going to ruin any chances they had at giving programming a try. Cant believe you sub-humans actually breed. Lisp is such a terrible way to teach programming even if it does some things right,
>>
>>61471265
>How does that work as a recursive function? It'd be rather contrived.
0. Is the tomato too small to slice?
1. If yes, stop slicing.
2. If no, slice 1mm into the tomato and ask again.
>>
>>61471227
>counting is harder than understanding the concept of a 'base case'
>>
>>61471311
Except for every slice you bring out another knife and eventually end up with knives and waste time picking up new knives.
>>
>>61471283
>homeschooling
Why? You do know that the main purpose of school for children is to develop their social skills, right? You're going to be raising a couple of supreme autists.
>>
>>61471320
>he doesn't know about utensil-call optimization
>>
>>61471311
What you described is a for loop.
>>
>>61471327
Our family is orthodox Jewish and there are no Jewish schools nearby.
They have plenty of time to play with other homeschooled kids and my daughter is in a horseback riding club.
>>
>A literal (((Lisp))) shill
You cant make this shit up
>>
>>61471350
Move to Israel
>>
>>61471359
Lisp is kinda fun, though
>>
>>61471364
You think there's plenty of wide-open land to ride horses in Israel?
Too crowded and crazy. No thanks.
>>
>>61471350
>other home schooled kids
I'm not gonna say it's a bad idea but this has been shown to not work very well. But given my public school experiences you're not hurting them too bad really.
At best you're setting their standards too high.
>>
>>61471376
camels

if you want to live in america or europe you have to conquer it
>>
>>61471368
I dont see the niche in it desu.
Idris does more and is more interesting to use if i want a toylang.
>>
/g/, what is the best state for programming jobs?

I hear Texas is pretty toptier.
>>
>>61470145
>Get a job working with C# at a small company.
>tfw have job working with C# at a small company

It's comfy as fuck.
>>
>>61471315
How do you walk down a flight of stairs?
Do you count 14 stairs and then say "step one, step two, step three..."
Or do you just keep walking until there is no step in front of you?

>>61471336
No.
>>
>>61471406
>How do you walk down a flight of stairs
I walk down a flight of stairs without thinking about it. Use a better example, man.
>>
>>61471383
According to /g/ and /pol/ we already have :-)
>>
>>61471406
You sub-consciously abstract both away as muscle memory.
>>
>>61471416
at the end of the day, at the end of the century your prospects won't be looking too good
>>
>>61471432
21st Century Civil War between the Left and the Right, fucking when?
>>
>>61471406
>loop
>having to have an index
Have you never heard of the common use cases for while loops?
>>
>>61471406
>No.
>
0. Is the tomato too small to slice?
1. If yes, stop slicing.
2. If no, slice 1mm into the tomato and ask again.

while(t.size  > preference; chop++)
{
t.size--;
}
>>
>>61471406
>no
Except you've made no effort in your example to explain the recursion at all. Where does the stack come into this at all? It's clearly just a branch and a jmp. A while loop.
>>
>>61471461
>chop++
Really anon. Cmon you don't know how to write this. What should happen is that you pass t by reference to a chop function and have the while loop just be the t.size>preference

But I agree with your intent. It's clearly a while loop.
>>
>>61471477
It was pseudo code you autist
>>
>>61471500
It's super weird pseudo code anon.
 
while(t.size>preference) {chop(t)}

This more accurately reflects his post.
>>
Kind of a specific question, but probably a general problem that comes up a lot.

I'm doing an old 1980s style text adventure game, you know, like Zork. Basically, the game is composed of a bunch of rooms that you move between by going north/east/south/west/up/down/whatever. That means that each room needs to have a reference to each room it's connected to, kind of like a linked list.

Is there a good way of getting those references into each room object? I could brute force it with some code that instantiates every single room and then injects the required references, but there should be a better way. I was thinking of having each room instantiate each room its connected to, but that would have problems with rooms getting instantiated multiple times. Maybe something like that but with a mechanism to return a reference to an existing room if one exists, or create a new one if not?

Easy way would be to do it as a grid and reference rooms that way, but since the rooms aren't actually laid out in a perfect grid in terms of how they connect to one another, it wouldn't work.
>>
>>61471464
"stop slicing" should be "don't slice" then.

Function slice:

can I slice?
no --> don't slice
yes --> slice, ask again

It's recursive because it calls itself within its body. Not all recursion involves building a stack in languages like Scheme.

In machine language this is indeed equivalent to a loop but the whole point is to transcend this primitive architecture for more immediate logic.
>>
>>61471522
Then implement it properly if you care enough, nerd.
>>
>>61469216
>What are you working on, /g/?

I'm going to try out if temporal images can be used for visualization of time series
>>
>>61471543
Quadtrees?
>>
>>61471562
and if you really want, we can (cons (tomato-slice (slice (rest-of tomato)))) so we return a pile of tomato slices at the end. Is that recursive enough for you
>>
>>61471566
What?
I'm not complaining about how the solution isn't 'proper'. Its just that your code doesn't make any sense.
What does subtracting 1 from chop mean?
>nerd
Worthless Chad programmer.
>>
File: 1500199337112.png (94KB, 971x280px) Image search: [Google]
1500199337112.png
94KB, 971x280px
How to get out of this attitude?
>>
>>61471599
>What does subtracting 1 from chop mean?
That was clearly subtracting from the size of the tomato you illiterate melon.
>>
>>61471604
I know it sounds cheesy but JUST DO IT. Discipline yourself into writing the code, then reiterate over it afterwards.
>>
>>61471562
>>61471589
This
>>61471522
Still describes your function better than what you're suggesting. Unless you show code that'd be more accurately reflecting your three points nobody will buy it.

Consider the conditional to be 'shouldSlice(t)' instead.
>>
>>61471604
If you use proper methods of encapsulation, then it doesn't really matter if your methods are shit, because you can always optimize them later.
>>
>>61471620
So that's the t.size then and why is your chop not being considered in the conditional?
What is preference supposed to be if it's not comparing against the tomato? So many questions arise when you start making excuses for crappy code.

At least pretend you made a zeno's paradox joke.
>>
>>61471641
>pseudo advice
Anon please. You can not consider segmented parts for optimization purposes. Any book on algorithms and datastructures will inform you of this painful truth. We wish it would be so but it's not.
>>
>>61469336
My friend told me to take Electrical engineering, instead of CS, or CE...Thoughts?
>>
@61471646
Cant believe im giving you (You)s and even responding.
>So that's the t.size then
// This is the size of the tomato
t.size

> and why is your chop not being considered in the conditional?
its a reference to the chop count incase i wanted to refactor this to enterprise quality
>>
>>61471678
>thoughts
I don't know what you want.
EE generally isn't a bad degree though.
>>
File: angry_face.jpg (76KB, 288x402px) Image search: [Google]
angry_face.jpg
76KB, 288x402px
Why is literally every language shit? Like, I just want a nice language that is consistent and doesn't have dumb shit. I think Go might be the least shit of them all, but I haven't used much Go to decide yet.
>>
>>61471682
>this is the size of the tomato
Except in
>>61471620
You said it's subtracting from the size of the tomato.
>some random garbo you think is funny
But sure. Store the number of chops as a negative value. Nothing could possibly go wrong.
>>
>>61471708
I want more of a programming career instead of an engineering career, but his argument was that EE has CS, and then some.
>>
>>61471732
which ones have you tried, m8
>>
>>61471732
U do C yet?
>>
>>61471747
I suggest that you ask someone at the university you're looking at to guide you after you envision what your future career should be. Then ask a dean about what they answered. Perhaps not directly saying that that's what they said. Tend to get more honest answers when you ask as if you don't have a clue.
>>
>>61471747
They intersect is more like it. I know about 4 years ago it meme'd pretty hard that EE degrees were what you really wanted, but I hear they're hard as fuck to go through.
>>
>>61471765
Yeah, C is shit because the C preprocessor is crap and including libraries is antiquated crap to modules/packages we have today, which is only the start of it.

>>61471752
I have tried C, C++, Java, C#, Ruby, Python, Perl, Haskell, Lisp, Scheme, Fortran, Prolog, Go, Javascript, Lua.
>>
File: 1492964148658.png (43KB, 700x500px) Image search: [Google]
1492964148658.png
43KB, 700x500px
Working on an image organizer. Could be very useful
>>
>>61471798
I guess D, Idris, Nim, youll probably hate rust.
>>
>>61471798
Once you get the hang of how to include your libraries, it's not that big of a deal. And remembering to #ifndef is usually done automatically be IDEs anyway.
>>
>>61471798
I mean, who doesnt like a lil c every now and then? ;^)
>>
>>61471810
Doesnt windows have something like that?
>>
File: 1362960884714.png (28KB, 499x322px) Image search: [Google]
1362960884714.png
28KB, 499x322px
So, winforms and WPF are dead, UWP is garbage, what exactly are you supposed to use for making Windows applications these days?

Do people still use Win32 still, or is that just around for legacy purposes?
>>
>>61471828
I know, still doesn't make the language any less dumb. I would like C more if it had a package system more like Go's. I think C would be much better if it copied a few of Go's features.
>>
>>61471855
>winforms and WPF are dead
[citation needed]
>>
>>61471815
Nim is shit because I hate forced indentation rules.

Is there a list of programming languages that don't use garbage collection and have memory management, like C, C++, D, Rust?
>>
>>61471872
Neither are being updated any longer and Microsoft is pushing for all new Windows programs to use UWP.
>>
>>61471900
D has garbage collection
>>
>>61471912
Doesn't D only have garbage collection in the standard library? Also why do languages have a hard on for garbage collection nowadays?
>>
>>61471900
Technically you could be completely @nogc in D if you want to just use C stuff and deterministic arrays with std.range and algorithm. Theres also dub for the package manager.
>>61471924
D's GC is pretty avoidable desu, and for the times its not, you can control it pretty explicitly.
>>
>>61471872
Visual Studio 2017 was built on Electron. I think that says it all.
>>
>>61469229
>>>www.reddit.com
>>
>>61471924
It does, and the GC is optional ffs.
>>
>>61471953
I think that's only the installer though
>>
wtf does the dollar sign in javascript mean?

for example $(something)

is it a special function?
>>
>>61471953
You sure? Visual Studio IDE has been built with c++/c# since forever
>>
File: 1498438216275.gif (2MB, 680x603px) Image search: [Google]
1498438216275.gif
2MB, 680x603px
>>61471953
I think you mean Visual Studio Code, but that's still hilarious
>>
>>61471976
It's jQuery
>>
>>61471976
It's a "special" function from jQuery.
>>
>>61471855
>Do people still use Win32 still, or is that just around for legacy purposes?

Unless something changed in Windows 10, win32/64 should still be the Windows API. Everything else is just a framework built on top of win32 calls.
>>
Hey boys i have one stupid question about cordova apache:

When i want to cordova run browser it tries to run google-chrome, i dont use it so i want to run with chromium.
So i do cordova run browser --target=chromium. Problem is that it adds -browser so it tries to execute chromium-browser, and that doesn't exist. What do i do? How can i fix this
>>
>>61471855
>WPF
>dead

WPF is still very much used for native desktop applications.

I would definitely consider WinForms dead, though.

>>61471902
>Neither are being updated any longer
This is wrong.

Both received significant updates recently, particularly WPF, relating to high PPI displays and performance.
>>
>>61471953
>Visual Studio 2017 was built on Electron
VS 2017 (the IDE) is built on WPF.

VS Code (the FOSS text editor) is built on Electron.
>>
>>61472177
That's because chromium-browser is the target name as peir their docs.
>'chromium': 'chromium-browser' + chromeArgs,

Just create a symlink.
>>
what would be the AST for this expression?
*(a + b + c) = *d = e

- The assign has 2 childs
- The plus has 2 childs
- the deref has 1 child

something like this?
  
=
/ \
= e
/ \
* *
| |
+ d
/ \
+ c
/ \
a b
>>
>>61471572
After koding everything I realized that it's just heatmap
>>
Why are OOP haters usually also C++ haters? Of all the languages that support pure functional programming with ADTs, I can't think of a single one that lets you do it as efficiently as C++ does.
template <typename a> using just = a;
struct nothing {};
template <typename a> using maybe = std::variant<just<a>, nothing>;
>>
>>61472745
>Why are OOP haters usually also C++ haters?
Because they are usually second or third semester CS students who barely know how to program and their only exposure to both are extremely minimal.
>>
>>61472745
In D thats just
import std.variant;
>>
>>61472745
VOMIT.webm
>>
>>61472776
But anon, OOP actually does suck.
C++ on the other hand
>>
>>61472807
>C++ on the other hand
Suck harder
>>
>>61472800
D does that shit in the background so you don't have too
>>
>>61472800
No it's not.
That's not equivalent at all
Equivalent C++:
#include <variant>
>>
>>61471900
>forced indentation rules.
You will get used to it
>>
>>61472776
C++ is used for and created by substandard programmers
>>
>>61472841
Forced indentation is shit. It is one of the many reasons Python is so shit.
>>
>>61472856
Again, you will get used to it
>>
>>61472839
What is that even doing though?
 auto v = Algebraic!(int, string, void)(1);


ADTs are nothing special desu.
>>
>>61472745
enum maybe<a> { just(a), nothing }
>>
why even try
>>61472120
>>
File: 1495011057937.jpg (83KB, 413x413px) Image search: [Google]
1495011057937.jpg
83KB, 413x413px
How the fuck do you jump the gap between textbook type "programs" to working on actual software? inb4 "web framework tutorials" although I need shekels so bad at this point I'd probably actually do it. Might even ditch my comp sci degree half way. Kind of want to try qt again but last time I got confused by its many... things.
>>
>>61473399
get an entry level dev position
>>
>>61473399
Literally just find a project youre interested in.
>shekels
have fun with node.js
>>
File: maze.gif (2MB, 250x250px) Image search: [Google]
maze.gif
2MB, 250x250px
Can this get me hired?
>>
>>61473399
there's no threshold, it just depends whether your objective is to program for the purpose of study, or program for the purpose of making a product. I wouldn't skip out on the comp sci degree, it's extremely important to learn the things you are taught in your senior years.
>>
>>61473453
Only if you use a nicer colour palette, senpai.
>>
>>61473453
It will get some people calling you shithead and telling you to rewrite it in rust.
It might upset the SJW making them target you.
But get hired? No.
>>
>>61473447
I kind of want to make a minimalist novel-writing program that's kind of like a combination of a text editor and git except way more simple and completely local. And try to use that to learn qt.
>>
>>61473632
writemonkey is pretty perfect, desu.
Why git for a novel though, seems pretty overkill.
>>
>>61473632
That sounds pretty awesome actually. I guess you've seen Ren'Py right? might be inspiring.

I've done some development with ONScripter myself, and it was also very interesting. It's super crappy in terms of software engineering, it's basically an assembly language for VNs, yet it was used for Higurashi and Umineko and Higanbana.
>>
>>61473453
Make a nicer color palette as another anon already pointed out.
Add some other alogs/tweaking options.
Port to flavor of the month meme JS framework.
Shill it to Californian dumbfucks.
>>
>>61473671
Well comparing it to git might be overkill but really just a simplistic kind of version control, like a window to the side that tracks various additions and deletions in a list and when you mouse over them it highlights or temporarily reverts various things, and you can add comments to them.
>>
>>61473723
Now that i could get behind.
Easy diffing sounds nice, especially if i could just do alt-v or something and split the editor and compare my latest version with a history of commits i could just browse through. I'd be interested in contributing depending on the language.
>>
>>61473486
>>61473510
I never had a job. I want to prove myself to be good enough to be a code monkey.

I know:
> C, well (the C11 n1570.pdf draft, 2 years)
> Lua (small embedded language), 0.5 years
> Python (not throughout like C, but I can get a around), 1 year before I started C, now trying it out again
> OpenGL ES 2.0, GLFW3
> git (never worked with someone, only personal projects)

Pretty much this, a brainlet without a portfolio (started to build it 2 days ago, before I made a graveyard of unfinished projects in non-presentable form).

My upcoming project plans:
> Snake playthrough generator
> 8 puzzle solver, 5/8 queen problem solver
> Random geometric wallpaper generator using OpenGL
> Simple 2D platformer engine (already have 60 levels)
> Minecraft clone, but with preloaded levels
> Sokoban solver
> 15 puzzle solver (I'll have to learn heuristics, don't know how to do yet)
> /g/ scraper to know what languages people shitpost the most about, I'll use python and some json parser
> 4chan scraper that predicts when are the doubles/trips/quads coming

Stuff like that. Can any of them potentially get me hired, or many of them together?

Should I just drop C and try to learn C# (uni is teaching this anyway) or Java?
>>
>>61473692
>>61473777
I'm Eastern European pajeet, or ivan if you wish.
>>
>>61473777
>Should I just drop C and try to learn C# (uni is teaching this anyway) or Java?

C++ if anything.
>>
>>61473802
This. I work with solely C# at work and came in knowing only C++.

You can pick up C# in an afternoon if you know C++
>>
In C++, is nullptr different from NULL?
Why would they even make this distinction?
>>
>>61474362
Don't know, I'm a Cfag, but I think it's so that function overloading wouldn't be ambiguous.
>>
who was the genius that came up with

<!-- -->
>>
>>61474362
Yes.
NULL is whatever's the macro defined to in the C standard lib (so most likely 0 cast to a void pointer).
nullptr has its own type, std::nullptr_t
>>
>>61474392
Why does C++ require it's own type for a null pointer?
It's supposed to be an empty set.
>>
.NET makes you go through all sorts of hoops to access embedded resources in your application.

Does that mean that I shouldn't be embedding resources?
>>
>>61474392
And the why part?
>>
>>61474401
>>61474408
see this anon's answer >>61474379
>>
>>61474384
Me
>>
Our boss tasked two fellas from my team (C++/C#/Java/Python) to do some frontend stuff. They are so buttblasted 24/7.

>"PLEASE CAN WE FINISH THIS AND GO BACK PLEASE"
>"webdev: never again"
>"My hate could fuel a thousand suns"

I kinda care about them and need them sane later on, what would you recommend for general programmers suddenly doing frontend, /dpt/? Any particular frameworks?
>>
>>61474428
>C#/Java/Python guys
>complaining about doing frontend stuff

???
>>
>>61474532
So I should just call them sissys and tell them to man the fuck up?
>>
>>61474428
Are they using plain JavaScript or do they also get to use JQuery
Because
JQuery makes that garbage so much easier
>>
>>61474562
Tell them not to pick front end faggot languages if they don't want to work on front ends.
>>
>>61474608
>python/java/c#
>frontend
hmmm
>>
C++ is objectively the best language, Haskell comes close and has far superior syntax but the fact that it's slow as molasses ruins it. C++'s type system is every bit as sophisticated and expressive as that of Haskell, except hideous.
>>
>>61474632
they both use the hideous ::
>>
>>61474643
why did you pick on : specifically when essentially all of the following are used in most programming languages and are as "ugly": !@#$%%^*&*()<>:"{};'][
>>
>>61469216
more mugi
>>
>>61474667
it's a double colon, anon, i can't stand looking at it
>>
>>61474697
and what about it? how come people get so buttblasted about something as insignificant as this?
>>
>>61474713
aesthetic reasons
>>
>>61474643
Different purposes. C++'s :: is only ugly because its purpose lends it to ugliness. Haskell's :: is fine because it indicates a declaration and isn't a chain delimiter.
>>
>>61474713
Because languages should be using the far superior period.
>>
>>61474713
I think it's because C++ uses it for something fundamental like namespace resolution, so you'll see it fucking everywhere and since everyone is told never to use "using namespace std" you'll see it even more.
>>
>>61474731
we should change web standards to be like www::4chan::org
>>
>>61474780
find the nearest noose please.
>>
>>61474731
That's OOP and OOP is gross.
In Haskell you don't need a member access operator because you have pattern-based overloading. Instead of accessing members you just assert their existence by giving them external bindings and then refer to them by those bindings, and if the assertion fails then that particular instantiation of the overloaded function is just not selected.
>>
>>61474780
>[Return] [Catalog] [Top]
it's actually a good idea, i like it
>>
>>61474777
std.vector<std.string>


>tfw you will never write code like this
>>
What languages have constructor inheritance?
>>
>>61474777
>using namespace std
Literally fine in implementation files
>>
>>61474809
>Instead of accessing members you just assert their existence by giving them external bindings and then refer to them by those bindings, and if the assertion fails then that particular instantiation of the overloaded function is just not selected.
god haskell is such trash.
>. are just for POO
Neck yourself too hasklet
>>
>>61474828
sepples
>>
>>61474815
"Will C++ ever get UFCS?".writeln
>>
>>61474847
The hell it does.
>>
File: framestutter.webm (2MB, 400x604px) Image search: [Google]
framestutter.webm
2MB, 400x604px
>>61469216
Working on my Minecraft clone. I have water looking pretty good now: I added shader code to connect its surfaces. But as you can see the game is a little stuttery when there's lots of water updates. Well this is dishonest; this clip is running on the interpreter: when the game is compiled it doesn't lag. But that doesn't matter because I'm using water as a baptism by fire.

There's several performance wrecking shortcomings:
>no protection against the same block being marked for an update several times
>there's code that I could precompute, so I need to write some macros to do that
>there's no sender information for the interface that the water surface updating mechanism uses, so it must recalculate all four corners

There's also a flaw in the actual water algorithm itself, which is that it schedules block updates every 12 frames, when it would be best to schedule some every 12, and others every 11 so that the work load is more evenly distributed, but that is such an easy fix, and fixing it now would make this baptism by fire less intense.
>>
>>61474860
they can't agree on what it should do
>>
>>61474905
What do you mean?
>>
>>61474873
Is it open source?
Github?
>>
>>61474922
from what i remember they don't know if they should look in the methods of an object first, and then the free functions, or the other way around
>>
>>61474828
Ruby.
It achieves this by calling the constructor "initialize" instead of calling it by the name of the class.
Ruby has no method overloading, so you can only write one constructor. But it does have variadic methods and keyword arguments, so anything you could do with method overloading you can do with conditionals over the argument list / map.
>>
File: threading.png (27KB, 1188x687px) Image search: [Google]
threading.png
27KB, 1188x687px
>>61474981
I can't think of a way to do pic related in C's pthreads, please help.

I want child threads to unblock main and block themselves atomically, so that the steps marked 1, 2 and 3 always go in that order. The order 1, 3, 2 should absolutely never happen. Currently my program uses polling, which is not very elegant and uses additional resources. The condition variables of pthread are pretty close, but don't have atomic signal and block.
>>
>>61471061
What is ISLISP? A meme?
>>
>>61474998
USE SEMAPHORE
>>
File: 1424926932984.png (356KB, 572x380px) Image search: [Google]
1424926932984.png
356KB, 572x380px
Has anyone here worked for a large company and likes to share their sentiments?

I'm working for a small (<50 employees) company for nearly 2 years now and it's slowly killing me

>total lack of structure (there was no VCS, new projects were launched with some random new meme language, no quality standards, no testing, programmers have to be project managers out of the blue, etc.)
>no time to do things right (boss wanted to change the entire IT infrastructure on a weekend, let's introduce scrum without any training, starting new projects without any solid requirements, you can't just get good at one thing, etc.)
>advice gets regularly discarded ("this project won't be realized with this budget" - "I believe you can do it", "If we do this the client will quit" - "Nah, just trust me", "This is a proven method for doing X" - "Let's do it my way")
>no real accountability (everyone has this "family" feeling, don't blame other's for their mistake, it's expected that you work overtime when other people fuck up)
>money is spend on stupid crap instead on productivity (half the PCs are 5+ years old but we take a day off to go rock climbing as a group, want this software which costs $100/year - lol no but there's our new company coach that just costs $130/hour and the company will pay for her!)
>>
File: cflogo.jpg (6KB, 175x175px) Image search: [Google]
cflogo.jpg
6KB, 175x175px
Red pill me on ColdFusion. Should I learn it? I've seen a few job posting for CF developers...
>>
>>61475169
It's trash, don't learn it
>>
>>61474929
There is minetest if you're interested.
>>
>>61475016
Semaphores were somewhat awkward for this, but I figured out a good solution by googling about them. Thanks.
>>
File: 1473806266220.png (41KB, 871x693px) Image search: [Google]
1473806266220.png
41KB, 871x693px
>>61475169
It's still very popular and worth learning.
>>
Does this make sense?
int isprime(int n) {
int i, r;
i = 1;
r = 1;
do {
i = i + 1;
if (n % i == 0) {
r = 0;
break;
}
} while (i * i < n);
return r;
}


translates to:
(1) n := param[0]
(2) i := 1
(3) r := 1
(4) t0 := i*i
(5) if t0 >= n goto (11)
(6) i := i+1
(7) t1 := n%i
(8) if t1 != 0 goto (5)
(9) r := 0
(10) goto 11
(11) return r
>>
Been adding more metrics to measure framestutter.
Interpreted:

Lag "FPS": 15.858599
Total Lag: 8071331290
Lag Frames: 128

Compiled:

Lag "FPS": 33.425475
Total Lag: 1854872718
Lag Frames: 62

Interpreted is only 4 times as bad. Less bad than I thought. With that done I can actually see if my changes have a positive result.

>>61474929
Not yet. Soon(TM)

>>61475437
What exactly are you translating it to? Some ugly version of basic?
>>
>>61475380

nice b8
>>
>>61475437
Are you making your own language? Seems like you're decompiling into something more primitive than C.
>>
>>61475437
You're one degree away from assembly with whatever that is. Might as well go all the way.
>>
>>61475437
That's not how a do while loop works.
>>
>>61475452
>>61475478
>>61475503

that's intermediate representation of code

Lexical analysis

Syntactic Analysis

Semantic Analysis

Intermediate Representation of code <---- i'm here

Optimizing code

Code generation

>>61475512
>That's not how a do while loop works.

this was precisely my doubt!

mind explaining, anon?
>>
>>61475512
Loops are glorified conditional jump instructions, no? So that's precisely how while loops work.
>>
>>61475524
Not that anon but you're doing a while loop. First iteration has to be executed unconditionally.
>>
>>61475563
so have to do this part first?
i = i + 1;
if (n % i == 0) {
r = 0;
break;
}


but that break doesn't make sense,
>>
>>61475599
On break jump to end and return 0.
>>
>>61475599
Anyway, why do you do it by hand? This stuff has been automated in 1950s
>>
>>61475625
how's this?
( 1) n := param[0]
( 2) i := 1
( 3) r := 1
( 4) i := i+1
( 5) t0 := n%i
( 6) if t0 != 0 goto (10)
( 7) r := 0
( 8) goto (15)
( 9) t1 := i*i
(10) if t1 >= n goto (15)
(11) i := i+1
(12) if t0 != 0 goto (10)
(13) r := 0
(14) goto (15)
(15) return r


>>61475685
because in the final exam (tomorrow) i have to do this by hand, without a computer, so i'm practicing
>>
>>61475454
Nice shitpost.
>>
>>61475041
i'm interning in a tech consultancy company
it isn't much better
>>
>>61475041
Yeah, bretty much
Sometimes I wonder how the fuck do some companies stay profitable, sometimes extremely profitable, with a shitshow like that behind the scenes.
>>
What a good project to increase my C skills?
>>
>>61475936
raytrace compiler
>>
>>61475936
doom like shootan game
>>
>>61475936
write memory allocator on top of malloc,calloc, realloc and free which let's you allocate variable size memory, free allocated memory and free everything allocated from that allocator with one function call.
+ for making it align the allocations.
>>
>>61473777
don't bother listening to the other fags saying it won't get you hired
what you have now is good for a junior position
>>
File: IMG_0932.jpg (31KB, 318x314px) Image search: [Google]
IMG_0932.jpg
31KB, 318x314px
>>61469216
What does static actually mean? I kind of get it but I don't understand it fully. Anyone care to explain it to me? I could google it ofc, but
>>
>>61476069
>static actually mean?
Context?
>>
>>61476069
not dynamic
>>
>>61476069
when you touch something metallic and you get a shock.
>>
>>61476069
what language?

>C
applied to variables, static means it persists between function calls past the initial assignment.
applied to functions, it means it's not visible outside of the translation unit unless you deliberately fuck this up

In java it means the opposite
>>
>>61476069
In a class, static means that the variable doesn't belong to a created object but to the class itself.

Java/C# pseudo code:

Class object = new object();
object.nonStaticMethod();
Class.staticMethod();
>>
>>61476131
*new Class();
>>
>>61476100
Java and C, the only two langauges I use so far. I tried Python for a while but i didn't like it.
>>61476131
>>61476123
Thanks
>>
Idris noob here
Is there any less verbose way of achieving basically this?
data Color = Red | Green | Purple
data Cog: Color -> Type
data MakeCog: (a: Color) -> Cog a

My understanding, gathered from working with it, is that the "data" keyword says, "whatever type T is at the end of this curry chain, fully applying the function being thus declared will produce a new datum of type T, as opposed to a hole." Am I right about this? If so, is there a better way of instantiating a type?
>>
>>61476226
That's not context. Static means different things in different situations.

In C if a global is declared with static, then it cannot be accessed in other files with extern.

Declaring a variable inside a function with static makes it keep its value between invocations.

Declaring a static field (or method since java is a shitty excuse for a high level language with data-code distinction) in java makes it unable to access nonstatic fields and methods.
>>
>>61476289
Not less verbose but more elegant:
data Cog: Color -> Type where
MakeCog: (a: Color) -> Cog a
>>
Programming some numeric computations for stuff related to QKD in GNU Octave.
>>
>>61476289
"data" declares a new type constructor, guaranteed not to be an alias for another type constructor, and also declares its (value) constructors (which in pattern matching act as eliminators)

You can use GADT syntax to see the full type of constructors
>>
>>61476343
>>61476226
Forgot to mention static methods and fields are the same among all objects and can be accessed with Class.[static field]. So think of static fields and methods as C functions and globals inside of namespaces.
>>
Self taught codemonkey here.
Someone explain the big O notation to me.
>>
>>61476426
O(n) is an O(1) module
https://en.wikipedia.org/wiki/Module_(mathematics)
>>
Hey /g/, today I'm trying to get the Play Java Framework to make a simple ajax GET request and it is being a super ballache

2nd worst moment of programming life. Eh I'm still here though
>>
>>61476426
It describes the relationship between how much data an operation needs to process and how much of some given resource, usually clock cycles, it must consume to do so. This relationship is then used as an indication of the operation's plausibility in production code.
e.g. O(n) usually means the amount of clock cycles consumed by the operation is directly proportional to the amount of data it's given to process.
Whereas O(n^2) would mean proportional to the square of that amount of data, and O(log(n)) would mean proportional to the logarithm.
Generally the "smaller" the function inside the O, the better.
>>
>>61476426
To add to >>61476490, O(1) means the amount of clock cycles the operation takes to complete is roughly unrelated to the size of its data. This, if possible, is ideal, because it means performance of the operation does not suffer at all as its input size scales up. However, for all but the most trivial computational tasks, this is usually unachievable.
>>
>>61476490
Hmm, so say, I have a thing here that processes GIF files. GIF frames' image data is divided into sub blocks with a maximum length of 255, but the number of the sub blocks is not contained in the image data portion anywhere. What complexity would an algorithm be, that seeks the buffer to the starting byte of sub-blocks that is a byte marking the length of that sub-block, sums these length bytes with which a new array is created, then seeks back to the first sub-block and reads the data into the newly created array?
Thought I'd ask something practical, since I'm experimenting with this exact thing.
>>
>>61472454
= right-associates in my mind, and also in C.
>>
>>61476613
Code in question here
let totalLength = -1;
const startPointer = ++pos;
log("| | Counting total sub-block length");
while(buf[pos] !== 0) {
const length = buf[pos];
totalLength += length;
pos += length + 1;
}
log("| | Processing sub-block");
const subBlockAccumulator = new Uint8Array(totalLength);
let accumulatorPointer = -1;
pos = startPointer;
while(buf[pos] !== 0) {
const length = buf[pos];
for (let i = 0; length > i; ++i)
subBlockAccumulator[++accumulatorPointer] = buf[++pos];
++pos;
}
gif.frames[frame].data = subBlockAccumulator;
>>
>+300
We need a new thread now!
>>
>>61476746
>let
>const
it looks like js, yet it isn't js
>>
>>61476746
Wow cool, this looks shit. Maybe you should just kys, senpai?
Or if you dont want to pick that simple line, then maybe just learn to code properly and get a good coding style
>>
Have a load of values and associated text with them, e.g.

1, dsfdsfs
5, fdwqoeasl
8, dsaasdada
2, dssrewrwrw
3, dsadasdad


Need to sort by the integer and access the string. Is there a data structure that does this? It feels like it should be easy but I'm having a hard time finding something.
>>
>>61469378
I would say Sword Art Online. Very popular with children and Indians, but really no one else.
>>
>>61476872
No we don't
>>
>>61476987
hashtable
>>
File: unknown.png (3KB, 382x24px) Image search: [Google]
unknown.png
3KB, 382x24px
>>61476887
or so you think
>>
File: consider.jpg (29KB, 600x600px) Image search: [Google]
consider.jpg
29KB, 600x600px
new thread
>>61477059
>>
File: 1493485033820.jpg (1MB, 3000x1637px) Image search: [Google]
1493485033820.jpg
1MB, 3000x1637px
I want to learn, /g/! but I failed even high school Algebra II. Math has never clicked. I'm not sure just how relevant that is.
I can't stand just feeling like a "consumer," though. I want to understand how everything works. Learning about the internals of computers made me feel good, but then I realized just how simple and normie it is. It's legos for adults. I want to become smarter and be able to create things!
I am on my computer nearly 24/7 and yet it's so difficult for me to get to learning something. It's so very difficult for me to force myself to open up an ebook and read it, or to try and watch videos on educational topics. I don't know how to do it.
I realize this is quite a messy post, but if anyone has any words I'd greatly appreciate hearing 'em.
>>
>>61477162
Start a project and finish it.
>>
>>61469888
The only really bad thing about starting old is that you have to start at the bottom of the barrel as if you were 22, which might be hard to bring yourself to do. Obviously if you start programming at 27, you're never going to be the best of the best, but you can let me know how many programmers you know that are even good at anything, let alone the best.
>>
File: hotdog.jpg (39KB, 480x712px) Image search: [Google]
hotdog.jpg
39KB, 480x712px
>>61471732
>Why is literally every language shit?
Because they all require you to think, which you don't want to do.
>>
Using OpenGL, is it viable to call glViewport if I want to draw a model on one part of the window and render text about it on the other?
>>
>>61477361
According to the internet. Yes.
>>
Finally, the fastest way to add a list of integers

https://gist.github.com/anonymous/e103d264cecf10e31e6dadfb1c398007

compile gcc -O3 -ffast-math add_list.c -o add_list

here are the results
Benchmarking deoptimizing for non-overflowed case
1000000000 in 2909456 clocks

Benchmarking naive for non-overflowed case
1000000000 in 3674978 clocks

Benchmarking deoptimizing for overflowed case
100000000477160128512 in 5362049 clocks

Benchmarking naive for overflowed case
100000000477160128512 in 6127824 clocks
>>
>>61477361
Just did a test. And yes it works.
Thread posts: 320
Thread images: 26


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

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


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