[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: 41

File: screenFetch-2016-07-22_22-00-28.png (1MB, 1366x768px) Image search: [Google]
screenFetch-2016-07-22_22-00-28.png
1MB, 1366x768px
Old thread: >>55699322

Post your IDE edition
>not using background images and font ligatures

What are you working on, /g/?
>>
>>55706201
Why is your IDE in your web browser?
>>
>>55706225
wut u on
>>
>>55706201
Whats a nice easy script I could make to help me learn python?
>>
>making threads before the bump limit
>>
>>55706275
This one is after the bump limit: >>55706254
>>
>>55706264
brainfuck interpreter
>>
>>55706201
>Talking with cutie girl at work
>Discussing final year projects and programming
>/g/tard waddles over
>Starts interrupting us when he wants to "correct" us
>Talks about how good D and RUST are
>Dismisses anything else as "casual" "meme"

I just had to let him go with it and wait till he needed to waddle off to lunch before I could get back to a reasonable conversation with the girl
>>
>>55706379
D will be goat soon.
>>
I did it lads. Now to clean up the code. And create it as a Java.fx program..
>>
>>55706201
Stupid question incoming. Learning C.
What is the best (lightest, simplest) way to store this type of data. (pic related, it's Football Manager).
I think there are formats like xml, or json, is raw text, like ascii files even possible?
>>
>>55706421
json
>>
>>55706408
D will never compare to GHC/Haskell
>>
>>55706445
Haskell's a meme
>>
>>55706421
text files possible? yes but that's stupid just use json like any sane human being
>>
>>55706451
What do people even meme by that?
Because people keep advocating it?
Is that supposed to be a bad thing?
Because you don't understand it?
Is that supposed to be a bad thing?
>>
>>55706490
It's a joke language, designed just to be elegant, and not practical
>>
>>55706508
>It's a joke language
It's not

>not practical
In performance critical systems
>>
File: hasklel.png (42KB, 947x623px) Image search: [Google]
hasklel.png
42KB, 947x623px
>>55706445
Yeah, right.
>>
>>55706550
>it's more popular therefore it's better
Then why is D #23?
>>
>>55706550
>0.3%

haskellfags on suicide watch
>>
>>55706559
It's still garbage collected, although that's to be fixed.
>>
>>55706566
>as soon as it loses garbage collection everyone will use it
kek
>>
File: 1469042430440.png (168KB, 727x682px) Image search: [Google]
1469042430440.png
168KB, 727x682px
>migrating from the wrong thread

lately i have been working a lot with java and thought i should give android development a try but it's fucking turbo cancer.
>>
>>55706616
git gud faggot
>>
File: thinkpad_crash.png (46KB, 1014x557px) Image search: [Google]
thinkpad_crash.png
46KB, 1014x557px
>>55706413
Did you have any problems with unicode characters not printing properly. I've hit a wall with my command line browser because it keeps shitting itself when a non western standard unicode character shows up
>>
File: Java.png (17KB, 484x402px) Image search: [Google]
Java.png
17KB, 484x402px
>>55706616
>Java
dumb frogposter
>>
>>55706684
get good idiot
also stop using outdated python
>>
>>55706684
use python3 where it doesn't have unicodedecode bullshit
>>
So in python I have a value and I want it to print text and the value on the same line, how do I do this so far I could only think of
print ("text" & str(value))

how should I do it?
>>
Why has /dpt/ been full of snekfags these past few weeks?
Is kindergarten closed over the summer?
>>
>>55706628
i want to git gut, but the ide gave me aids
>>
So I'm trying to learn C++ with code::blocks, is there an easy way to automate adding declarations in the header files after implementing functions, constructors or variables in the source file?
>>
>>55706755
print('{}{}'.format('text', value))
>>
>>55706793
Read "The Big Nerd Ranch Guide on Android".
>>
>>55706851
thanks, i'll look into it.
>>
>>55706826
thanks
>>
How do I read Intel Software Developer Manual and not kill myself?
>>
>>55706817
hah, no
this is c++, a mans language
you gotta do that manually in every ide.
>>
>>55706875
No problem. It's important to note that you don't need str(value) here because format will take care of that for you. It's different if you use %s%s (C-string format)
>>
>>55706710
>>55706741
ok thank you
>>
>>55706432
>>55706465
Is json superior to xml for any specific reason, or is it just personal preference?
>>
>>55706901
>more redundant, needless lines of code is what defines a manly language
>>
>>55706905
Oh wait, I tested it and I'm wrong, you don't need str( with %s

>>55706932
easier to understand, much easier to parse, easier to create
>>
>>55706817
I've thought of writing a program to do this. There is absolutely no reason you should have to manually update your forward declarations.
>>
why do people do this:
int *variable
or
int *functionName(){....}

why do they put the * to the right side?
it's like saying:
create an int.........pointer variableName
when the correct way should be:
create an int pointer...........variableName
>>
Why does everyone publish their APIs in fucking json?

Am I supposed to write my own C parser for this shit?
I don't want to include yet another library.
>>
>>55706961
It's just for consistency.
The function returns a int *.
>>
>>55706961
because
int* x, y;
does not do what you expect it to do.
>>
>>55706966
would you prefer XML?

or some garbage, non standard collection of colon separated values
>>
>>55706961
Because it makes more sense when you have multiple variable declarations in 1 line, and the possibility that it will be a mix of non-pointers and pointers
>>
>>55706961
Because if you declare multiple variables on one line, it's inconsistent and easy to forget to add a * for each you intend to be a pointer. In your head you're then declaring pointer to an int, but in reality you're declaring, some of which being pointers.

eg:
int* var1, var2;
var1 is a pointer, var 2 is an int.
>>
>>55706983
>>55707000
>>55706990
>int var1, var2, var3;
if you code like that you should kill yourself
>>
the replies to this tweet: https://twitter.com/ID_AA_Carmack/status/753745532619665408
are scary.
it's incredible how many people are completly ignorant of the fact that excessive abstraction causes boilerplate, hard to read and hard to refactor code

how do we stop this overabstraction trend, /dpt/?
>>
>>55707036
t. beginner
>>
>>55707057
I think overabstraction is fine when the developer knows how to create their own and isn't blindly using other people's black box libraries all the time.

This is almost never the case, however.
>>
>>55707095
overabstraction isn't fine when a developer creates it himself.
seriously. you can take DRY very far (even to the degree of using COMEFROM like code like aspect oriented programming).
libraries, as an abstraction, at least often have a purpose, while most abstractions in local code don't.
they're there for the ego of the author, not because they actually have a purpose (either that, or the author blindly believes principles and applies them everywhere).
>>
>>55706201
Just wrote my first ever fizzbuzz and would like some feedback
start = int(input("from:"))
end = int(input("to:"))
yes = set(['y'])
no = set(['n'])
print ("Do you want numbers that are not Fizz/Buzz/Fizzbuzz to be printed? [y/n]")

choice = input().lower()
if choice in yes:
print ("Doing fizzbuzz from", start, "to ", end)
for count in range(start,end+1):
if (count % 5) == 0 and (count % 3) == 0:
print ("Fizzbuzz ", count)
count = count +1
elif (count % 3) == 0:
print ("Fizz", count)
count = count + 1
elif (count % 5) == 0:
print ("Buzz", count)
count = count +1
else:
print (count)

count = count + 1

if choice in no:
print ("Doing fizzbuzz from", start, "to ", end)
for count in range(start,end+1):
if (count % 5) == 0 and (count % 3) == 0:
print ("Fizzbuzz ", count)
count = count +1
elif (count % 3) == 0:
print ("Fizz", count)
count = count + 1
elif (count % 5) == 0:
print ("Buzz", count)
count = count +1
>>
>* oriented programming
When will this neverending meme die?
>>
>>55707337
is this bait?

you can do this in like 10 lines max and even that might be verbose
>>
>>55707339
>tfw only OOP has the oriented in it
>>
>>55707355
I didn't know having fewer lines mattered
>>
>>55707357
>object
>component
>set
>language
>return
>protocol
>data
>monitoring
>return
>railway
>multi-agent
>design
>>
>>55707367
repeating code is bad, if you repeat a piece of code often, you're doing something wrong
>>
>>55707388
haven't heard of most of these. They do sound like memes.
>>
>>55707396
also
> * driven design
>>
>>55707367
you should make your code verbose enough to be clearly understandable, but not so verbose as to have unnecessary lines and statements. Also you should strive to never repeat yourself.

really code verbosity can be a disputed matter
code that is very verbose can be tiresome to read, e.g. something simple like
 count = count + 1 

can be condensed to
 count++ 


code that is not very verbose can be hard to decipher:
  (1 to 100).foreach(n => {
print(f"$n:")
if (n % 3 == 0) print("Fizz")
if (n % 5 == 0) print("Buzz")
println
})

There's probably a way for me to condense that into a single line but it's been awhile and you get the idea
>>
>>55707337
wat

You don't need to increment count ... that's the point of the for loop. And for some reason you print count every time.

Holy shit.
>>
>>55706771
t. haskell neet
>>
http://www.mercyforanimals.org/jobs-application?jobId=252646

Should I apply?
>>
>>55707936
>applying to a company that can't spell Dr correctly
>>
>>55707809
not only that but you only needed to iterate thru the numbers once and check if they wanted numbers in the loop
>>
>>55706379
>Rust

pls no

C is good enough

Oh also, which functional language should I learn that isn't completely fucking useless when it comes to actual programming, not just math meme languages?
>>
>>55708217
scala or F#
>>
>>55707936
>http://www.mercyforanimals.org/jobs-application?jobId=252646

this looks awful
>>
>>55708217
seconding >>55708256

my vote would be for scala but F# looks really neat too
>>
Any way I can make a quick little python script to block a computer from getting to a website? I've gotta lock down a bunch of computers for zero dollars and I dont want to spend hours messing with firewall.
>>
File: 1451314385297.png (187KB, 500x500px) Image search: [Google]
1451314385297.png
187KB, 500x500px
I was planning to program something last sunday but was too busy then and during the week. Now I have time but I can't remember what I wanted to do.
>>
>>55708256
>>55708369
Thanks guys I'll probably go with Scala seeing that F# is a Microshill brainchild
>>
>>55708476
scala also has the nice ability to mix regular java directly into your code
>>
>>55708461
Why didn't you type it in your org-mode capture buffer?
>>
>>55708397
Firewall is needed here. Just add a rule that forces traffic to go through your HTTP proxy(python script) and take it from there.
>>
>>55707936
Just the company name is cringe, must be full of SJW.
Apply, if the pay is good, become an even try-hard SJW
>>
>>55708539
I use vim, I have a todo file but didn't think to put it in there.

That todo file seems to be filled with porn links, no idea how that happened.
>>
>>55706201
Debugging my trie implementation.
>>
>>55707438
Data driven design is a legit thing though.
>>
File: 1413579722355.jpg (71KB, 352x726px) Image search: [Google]
1413579722355.jpg
71KB, 352x726px
>>55708217
>>55708369

http://www.tiobe.com/tiobe_index

Java and C, nothing else comes close.
>>
>>55708609
>legit thing
It's a meme you dip.
>>
>>55708631
literally was just about to say this
>>
>>55708558
They sound like Python programmers

>>55708633
Whoops, didn't mean to namefag, sozall
>>
>>55708627
I already know those but thanks
>>
File: no.png (559KB, 1280x720px) Image search: [Google]
no.png
559KB, 1280x720px
>>55708642
Fuck off ya cunt.
>>
File: 1466578032508.png (191KB, 1000x386px) Image search: [Google]
1466578032508.png
191KB, 1000x386px
dumb frogpost incoming

>>55708665
https://www.google.co.uk/search?q=python+sjw
>>
Reposting from /sqt/ because I'm a hopeless fool:

I'm trying to use the Boost library for a project I'm working on, but I'm doing the tutorial on their website. I open XCode and "Linked the Binary with Libraries", where I have the boost folder. Problem is, this still doesn't work.
>>
>>55708698
>C++
>Boost
Jesus christ.
>>
File: still no.png (697KB, 1280x720px) Image search: [Google]
still no.png
697KB, 1280x720px
>>55708693
I know your faggot never-go-outside /g/ shit, you still can't have any.
>>
>>55708698
try #include "../boost/lambda/lambda.hpp"
>>
>>55708698
First off, it's unusual to have Boost libraries inside your project.

Second, C++11 has lambdas, not sure why you need Boost's version.

That said, try "../boost/lambda/lamdba.hpp". If that doesn't work, show us a pic of the contents of the Boost directory. If it does work, you should set it up so the compiler knows to search that directory for headers, which would avoid the ugly ../ .
>>
>>55708717
>can't have any
Any what?
>>
Rust or C?
>>
File: comfy.png (726KB, 1280x720px) Image search: [Google]
comfy.png
726KB, 1280x720px
>>55708793
>Any what?
*
>>
>>55708831
C

Rust has no future.
>>
>>55708831
C. Rust is a fad language that will be barely used in a few years.

C on the other hand is the language that most of the shit you use is programmed with.
>>
>>55708831
C is a language that is going to be with us for the next 50 years.
Rust is a mildly interesting "research language" that may not even be relevant in 2 years.

But they aren't mutually exclusive. It's not like you can only learn 1 language.
>>
>>55708698
You need to edit your Header search paths
>>
>>55708876
>Rust is a fad language that will be barely used in a few years
It's barely used now.
>>
Are there tutorials on how to master git with code examples? preferably c since that's what I know.
>>
>>55708831
C

Most satisfying language to master if you know a lot of low level shit
>>
>>55708945
>preferably c
git has no language preference and it doesn't change shit.

Also: https://git-scm.com/
>>
>>55708945
The language used in a project to learn git is completely irrelevant.
You could use it to manage text files for your Harry x Voldemort fanfiction.

Just go to the git-scm website. If you're ever unsure of anything, just google it.
>>
>>55708945
the best git tutorial is on their website git-scm.com

also, git is stupidly easy for 99% of use cases
git add .
git commit
git push origin master

wanna make a new branch?
git branch new_feature
git checkout new_feature

wanna save changes for later?
git stash
git stash pop
>>
>>55708888
>But they aren't mutually exclusive. It's not like you can only learn 1 language.

Joke's on you, I'm asking what to develop my project in.

(learning is also implied in that yeah)
>>
>>55708977
You forgot the commands for finding out who fucked up your shit and sending them an angry email.
>>
Dumb question but is it bad to have too many for/while loops? And if not, how do I fix it?

I'm summing up the rows and columns of an input matrix inside of a 2d array, and have 1 loop to get the data, 1 loop to create a string of zeros to tag onto the bottom of the array, a nested loop to calculate the sums of the array columns/rows, two more to calculate the sum of the final column (1 to get the bottoms of the rows and another to get the sides of the columns), and then yet another nested loop to display the data.

So something like:

4 loops and 2 nested loops. I feel like it would be a mess with a big amount of data.
>>
>>55708831
Rust is the better language
>>
>>55709061
Loops are necessary but if you have all those nested loops together, in the same function, you need to learn to abstract or you end up with a big ugly spaghetti mess.
>>
>>55709080
Irrelevant, rust is DOA because it tried to replace C.
>>
>>55709084
No, they're all in different methods. I'm not that terrible at OOP, I'm just worried that there's some faster way to calculate the sums that I'm too stupid to get.
>>
>>55709104
>Irrelevant, rust is DOA because it tried to replace C.
Contrary to that poster from before, Rust seems more aimed at C++'s thing - when you need performance but you also want to be able to make a big project that isn't a clusterfuck.

C will always be the best for C-scale projects, but Rust is for C++-scale projects.
>>
File: BoostLibrary.png (336KB, 1000x1000px) Image search: [Google]
BoostLibrary.png
336KB, 1000x1000px
>>55708743
>>55708736
Alright, this didn't work, but here's what my setup looks like: I have the boost folder inside the Downloads folder on my mac, (the pic on the right) and the column on the left is what the actual boost folder looks like

And if you don't mind me asking...
Why do I keep getting comments like this>>55708712 when I ask about Boost?
>>
Why does programming have to be so difficult?
>>
>>55708918
Where do you find this?
>>
>>55709138
If it was easy, it wouldn't pay well.

Also, you have to have a certain level of autism to put up with programming.
It sucks, and it takes a really long time without payoff until it finally clicks and you can write a non-trivial program that doesn't shit itself.
>>
>>55709119
What exactly makes Rust better than C++ for large projects?
>>
>>55709154
I been programming for a year and a half and I still suck so much at it
>>
>>55709174
What have you written so far, and what part seems difficult to you?
>>
File: whooo.png (223KB, 364x555px) Image search: [Google]
whooo.png
223KB, 364x555px
>>55709174
Maybe you're just stupid.
>>
>>55709080
For what reason?
>>
>>55709196
math based applications those random math programming problems that are medium to hard difficulty
>>
>>55709210
Because CoC.
>>
>>55709214
Like which one?
>>
>>55709220
Choosing a language based on its CoC is pretty gay buddy.
>>
>>55709221
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two jugs.

If z liters of water is measurable, you must have z liters of water contained within one or both buckets by the end.

Operations allowed:

Fill any of the jugs completely with water.
Empty any of the jugs.
Pour water from one jug into another till the other jug is completely full or the first jug itself is empty.


Example 1:
Input: x = 3, y = 5, z = 4
Output: True
>>
>>55709256
Just use a CAS.
>>
>>55709271
what is a CAS?
>>
>>55709256
C A S
>>
>>55709129
You get comments about Boost because people on /g/ are ideologues who will hate on anything for no reason. Boost is a generally a very good library suite, though some libraries are better than others and the interfaces sometimes could be better.

I think there is a problem with your IDEs working directory. I'm not familiar with XCode, but try searching through the settings to see if there's a field for include directories or working directories.

Finally, I should emphasise again that you should familiarise yourself with C++11. There's no need (as far as I know) for Boost's lambdas or for_each.
>>
File: download.png (197KB, 465x465px) Image search: [Google]
download.png
197KB, 465x465px
Might write an after effects plugin that does the delaunay triangulation effect but over video.

Unless there is another more interesting effect I should be made aware of
>>
>>55709281
https://en.wikipedia.org/wiki/Computer_algebra_system

Think wolfram alpha, only not a website.
>>
Is Coco2d a good way to start with c++? I already know c# and xna/unity3d

>Inb4 mocking responses
>>
File: Hm....png (136KB, 400x298px) Image search: [Google]
Hm....png
136KB, 400x298px
>>55709288
Alright... Thank you! I'm not using Boost for its lambdas (I'm just using them to do the tutorial). And I'm planning on reading Discovering Modern C++, as suggested by an anon

Still have no idea how to include boost despite linking it to the project
>>
>>55709129
Boost is the very definition of bloat.
You take the most bloated language around, C++, and then amplify that bloat by 5 times.
>>
if i asked for some help with basic C# for something Unity would i be in the wrong place? this is literally my first application of code and i have no idea what i'm doing.
>>
>>55709129
I would try installing Boost in your system rather than in your project. Other than being the "correct" way to do things, it'll probably make it easier for the compiler to find the libraries.

Try http://stackoverflow.com/questions/104322/how-do-you-install-boost-on-macos
>>
>>55709129
jesus christ dude do it correctly. See >>55708918
>>
import java;
import java.util.Scanner;

Scanner scan = new Scanner(System.out.in);

System.out.println("Enter a number");

int num = scan.nextString();
int val = 0;

if(num == 0)
val = 0;

if(num == 1)
val = 1;

if(num == 2)
val = 2;

if(num == 3)
val = 3;

System.out.println(val);

>>
>>55709144
here
>>
>>55709220
Because Corruption of Champions..?
>>
>>55709375
Try >>>/vg/agdg

>>55709368
What do you mean by bloat? Almost all of the Boost libraries serve one narrow function, the exact opposite characteristic of bloat.

Is Boost.Python bloated? Is Boost.Hana bloated? Have you ever even used Boost?
>>
>>55709403
>>>/v/
>>
>>55709375
C#, here.

Unity would be >>>/vg/agdg. Although the shitposting there is on /b/ level, so maybe you'd have more luck here.
>>
>>55709375
post your question and your code that you need help with
>>
>>55706201
what ide is that
>>
>>55709436
Pycharm
>>
>>55709406
And you're going to install that massive library for just one function?
What is Boost's goal? It's the "we do everything" library.
I dislike C++, so I'm obviously not going to be using Boost, but I hate the idea of bloat libraries that do everything, and duplicate most of the functionality of a language's standard library. It's the exact same reason that I think libraries like glib are also shit.
>>
>>55709436
It's in the title bar you fucking retard.
>>
i need to constrain the angular X drive position of a configurable spring at a set value

i use playmaker for everything because i can't code.

  UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
void Start() {
ConfigurableJoint joint = gameObject.AddComponent<ConfigurableJoint>();
joint.targetPosition = new Vector3(0, 0, -10);
JointDrive drive = new JointDrive();
drive.mode = JointDriveMode.Position;
drive.positionSpring = 20;
joint.zDrive = drive;
}
}

>>
from tkinter import *
root = Tk()
menubar = Menu(root)
root.config(menu=menubar)
for modes in range (0,6):
print(modes)
menubar.add_command(label="{0}".format(modes),
command=lambda modes=modes: change_mode("{0}".format(modes)))

How do I give this color? Everything I've looked up and tried has failed.
>>
>>55709412
they actually reffered me here.
>>
>>55709453
It's a bit over 100 MB of disk space, is it really the end of the work?

If you really concerned about it, you can install individual libraries. ie

sudo apt-get install libboost-python-dev
>>
>>55709295
Yeah do the neural style transfer thing.
>>
>>55709478
>It's a bit over 100 MB of disk space
For a single library? That is fucking atrocious.
>>
>>55709473
For C# or Unity? Either way, just ask your question and post relevant code.
>>
>>55709468
You're gonna have to be more specific pynub
>>
>>55709453
Also, Boost duplicates standard library functionality because the standard library explicitly borrowed from Boost. Boost is considered a testing ground for the C++ STL.
>>
>>55709493
I need to add color to the numbers, senpai.
I'm going to eventually indicate the status of every mode but I can't do that if there isn't color..
>>
>>55709309
reinvent the wheel
make your own 3d/2d game engine
thats cooler than just making a game
>>
>>55709492
for C# im not really sure how to properly phrase the question without sounding retarded. ill just find a workaround.
>>
>>55709490
No, for all the libraries together.
>>
>>55709376
>I would try installing Boost in your system rather than in your project. Other than being the "correct" way to do things, it'll probably make it easier for the compiler to find the libraries.
That's how Linux does it but it doesn't mean it's "correct."

Just wait until a project has a hard dependency on a different major version of Boost. You'll have **FUN**
>>
>>55709534
We're on 4chan, asking a retarded question is normal.

Don't do some retarded hack when somebody could possibly tell you where your retard is.
>>
>>55709376
Okay... so I did exactly what the answer told me to do (and even though I got some errors for not having certain things, I added them), but I got a bunch of warnings:

Should I be concerned?
https://github.com/CubicProgramming/ProgrammingChallenges/blob/master/PossibleBoostError
>>
Give me a fun simple programming project to do that I would enjoy
>>
>>55709559
If you have a project that depends on a specific version of Boost, it makes sense to ship it with the project. But it shouldn't be the default.
>>
>>55709559
What, this supposed major library can't even keep API/ABI stability between versions?
What a joke.
>>
>>55709468
> modes=modes
kek
>>
>>55709590
Breaking backwards compatibility is not always bad.
>>
>>55709559
Yeah, it's the way done on most distros but 100MB is retarded even there.

It's like on Qt scale but only acts as an alternative STL.
>>
>>55709575
depends on what you like doing

For a hardware guy I liked building an emulator
>>
File: config.png (30KB, 359x708px) Image search: [Google]
config.png
30KB, 359x708px
>>55709563
im trying to make a script that changes one variable on a configurable joint on a rigid body so i can use playmaker to fit the script into my sequence of torque values.

ill try to find a better example of the same code.

   using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
void Start() {
ConfigurableJoint joint = gameObject.AddComponent<ConfigurableJoint>();
joint.targetPosition = new Vector3(0, 0, -10);
JointDrive drive = new JointDrive();
drive.mode = JointDriveMode.Position;
drive.positionSpring = 20;
joint.zDrive = drive;
}
}




i just want to change the drive.position spring variable from 20 to whatever i need at the time.
>>
>>55709574
>https://github.com/CubicProgramming/ProgrammingChallenges/blob/master/PossibleBoostError

Did you try installing twice? If I were you I would delete /opt/local/include/boost and start over.
>>
>>55709604
It is when you have a shitload of codebases using your previous version that are forced to update.
>>
>>55709604
It is when you have literally thousands of projects depending on your shitty library.
>>
>>55709376
>>55709400

So I did
sudo port install boost 
and I'm wondering, from here, how do I actually include it in XCode? There's a ton of folders called boost (I have absolutely no idea how they got there... I didn't start C++ until a month ago)... Do I just use the most recent one?

If it is the most recent one... Where would I include its path in XCode? Under Search paths in XCode's "Build Settings -> Search Paths"?
>>
>>55709646
>>55709653

Backwards compatibility is what's holding the tech industry back you greedy simpletons. Just recreate everything from scratch. On much faster software/hardware
>>
File: On Second Thought....jpg (193KB, 1024x692px) Image search: [Google]
On Second Thought....jpg
193KB, 1024x692px
>>55709633
Alright... Doing that right now... Is it just
rm -rf /opt/local/include/boost/
?
>>
>>55709618
I have no idea how to start making an emulator
>>
>>55709678
No. It's
rm -rf / /opt/local/include/boost/
>>
>>55709678
Not enough, try:

rm -rf /opt/local/include/boost/../../../../*
>>
>>55709681
Start simply:
http://www.multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/
>>
>>55709664
Just don't use boost, ever. Problem solved.
>>
>>55709664
m8
>>
>>55709678
I think so.

>>55709664
Now you can put angular brackets around the boost include. If everything goes well the compiler should find it. I'm a little concerned that it's trying to save the libraries in /opt/local/include rather than /usr/include, but I guess that's how it's done on OSX.
>>
Seriously what's wrong with Rust? explain pls
>>
>>55709730
The ownership system is a pain in the ass, and just gets in your way most of the time.
>>
how do i make a function pointer to a function that is in the standard library?
for functions that are written within my own source code, i just type void (*ptr2fun)(int x) = some_function.
but i am trying to create a function pointer to the sin() function in the math.h header, which apparently requires a different technique
anyone ever done this before?
>>
>>55709730
shit syntax, shit garbage collection, shit ownership, shitty even for a C clone.
>>
>>55709740
>which apparently requires a different technique
No it doesn't.
double (*ptr)(double) = sin;
>>
>>55709730
Personally, I'm not sure I see the point. With modern C++ and good design practices, it's hard to get memory leaks, seg faults, etc. And while it's nice for a language to *guarantee* that they don't happen, in my opinion the guarantee is not worth the increased difficulty of the language.
>>
>>55709730
Its 20 users will move onto something else in a year.
>>
>>55709752
>shit garbage collection,
??
>>
There is literally nothing wrong with the jewish race
>>
>>55709760
>And while it's nice for a language to *guarantee* that they don't happen, in my opinion the guarantee is not worth the increased difficulty of the language.
It very much WOULD be, for me, if rust could deliver that. Unfortunately, it can't, by a long shot; which makes the system kind of pointless.
>>
>>55709755
undefined reference to 'sin'
>>
>>55709773
Okay... "automatic memory management"

It's still shit if you know what you're doing in C
>>
>>55709792
That's because your not linking the math library. Add -lm to your command line options for gcc, or to your LDLIBS if you're using a Makefile or some shit.
>>
>>55709789
>Unfortunately, it can't, by a long shot; which makes the system kind of pointless.
Wait, I thought the whole point of Rust is that the compiler guarantees no memory bugs. You're saying Rust can't even do that?
>>
>>55709789

>it can't, by a long shot;

How so? Because of the FFI or unsafe mode?
>>
>>55709806
well, i'm retarded.
i forgot about that.
>>
>>55709792
try using this after your #defines

extern double sin(double);
>>
>>55709812
>>55709813
It can, but only to a very limited degree. As soon as you use nontrivial data structures at all (which you WILL use in any serious project) rust's pointer safety system can't deal with it (it's a fundamental limitation), and you are forced to resort to unsafe pointers. (Go look at rust's implementation of bidirectional circular linked lists, for example.) Given that you are thus forced to use unsafe pointers all the time, the guarantees that the language does give you are pretty worthless.
>>
>>55709826
this. This will get rid of the errors
>>
>>55709752
>shit garbage collection
It doesn't have a garbage collector.
>shit syntax
you're wrong and you should feel bad

>>55709760
>With modern C++ and good design practices
Honest question: What are the new features and design practices I could be using to keep things more stable?

I used to use C++ a lot but got tired of its various crazy-ass eccentricities.

This was in like 2008, though, before C++11 and C++14. Perhaps things have changed.

>>55709738
>The ownership system is a pain in the ass, and just gets in your way most of the time.
This is the right answer and the reason I'm tempted to stop trying to use Rust.
>>
>>55709826
>>55709874
He said 'undefined reference to', which means that it's a linker error, not a compiler error.
>>
>>55708476
Elixir is another interesting language I've been thinking about checking out, but I think it's purely aimed at webdev.
>>
>>55709879
>Perhaps things have changed
They only got worse.
>>
>>55709724
>>55709725

Just updated the Header Search Paths, removed and re-added boost... Despite this, I'm still getting errors.... I'm running out of ideas about what's going wrong.

Just so you know, I'm appreciating all your help. Seriously, thank you!
>>
>>55709856

Generic data structures are typically easily testable and the "safety boundary" is typically pretty clean though.
>>
anyone want to suggest me something to program? I am finishing my CS degree and can mess with C, Java and Swift but wanted to learn some C++, C# or even some web shit but I have 0 idea of what to do
>>
>>55709886
ah I see, yeah just use the library option in gcc
>>
>>55709879
Smart pointers are one modern C++ tool for avoiding memory leaks. RAII (although not modern) is the principle design pattern for ensuring that resources are discarded properly, smart pointers being an example of RAII.
>>
What's the proper extension for an SQL database?
>>
>>55709901
what a nice font, yes, and nice colorscheme too, yes?
congrats
>>
>>55709901
Try making your header search path /usr/local/Cellar/boost/1.60.0_2/include

That's a weird directory for a library to install in. I would have expected it to install in just /usr/local/boost/
>>
>>55706201
Name one thing you hate about any and every language you know.
>>
File: mah-nigga.jpg (31KB, 600x468px) Image search: [Google]
mah-nigga.jpg
31KB, 600x468px
>>55706201

> python
>>
>>55709901
it's probably under the path #include <lambda/lambda.hpp>

If you want to use that header location just use the search path "/usr/local/Cellar/boost/1.60.0_2/include/"

In other words, the boost folder is already in the search path
>>
>>55709910
Generic data structures, yes, but most serious projects also have involved non-generic data structures.

Say you have a widget system written in rust, like an equivalent of Qt or GTK+. Your widget objects all have a pointer to their parent widget, as well as a list of pointers to their child widgets. (This is entirely realistic and hard to avoid.) Suddenly, you need to throw out the entire safe-pointers mechanism to get anything done.

What is worse, the fact that you frequently NEED the unsafe pointers means that the value of the safety check is greatly diminished. Whenever the compiler shouts at you, you never know whether it's because you are doing something wrong that you should fix, or you are doing something that the compiler can't deal with and you should just add unsafe flags everywhere. That means that the value of the compiler errors is sharply limited.
>>
>>55709890
What possible use could you have with Elixir?

BEAM maybe, it's neat-ish. Also how ugly erlang is can be interesting as well.

Elixir is just the hipster javascript compiler of the obscure erlang world.

Literally why?
>>
>>55709965
It installs there because that's where brew puts stuff. It still installs shortcuts in where you'd expect "/usr/local/include"

for example this is a boost project I have and here are the search paths
>>
File: head_first_python.jpg (115KB, 768x888px) Image search: [Google]
head_first_python.jpg
115KB, 768x888px
>>55706201
>>
>>55709901
how to get gameboy font?
>>
>>55709975

This is the case with owned pointers, but you can avoid this (and preserve safety) by using containers that contain references instead.

The problem with this approach is it complicates code, since instead of creating a new node of the linked list and adding it to the beginning of the list, you now have to create the node, borrow it, and do what you want with it.
>>
>>55709992
Ahh okay that makes sense. In that case then, >>55709901 shouldn't need to add anything to header search path, right?
>>
>>55709990
I honestly haven't looked into it much at all, it seemed interesting from what I heard about it. Didn't want to judge before trying, but I'll probably never actually touch it.
>>
>>55710025
Well for some reason xcode doesn't have the /usr/local/include search path by default (just the stdlib) but all he has to do is add it and that's it
>>
>>55710020
That still won't help if you need mutable access to the pointed object, as you usually do.

I have a Foo object. The Foo object contains a set of Bar children. Each Bar sometimes needs to modify something in its parent Foo, and thus needs a Foo pointer internally. This is a very common structure indeed; and as far as I know, there is no way to represent it in rust. Which means, back to unsafe pointers, and fuck the ownership system.
>>
Why do you guys hate Java so much? It isn't even that bad t b h
>>
>>55710197
do you smell like curry?

Seriously though it's because it's a language which takes a cool thing like OOP and convolutes it to no end
>>
Is there any guarantee in C that 2 different structs, with the same members(and ordering) will have the same size/memory layout?

struct a {
char a;
int b;
};

struct b {
char c;
int d;
};


Will sizeof(struct a) == sizeof(struct b)? Will b/d be aligned at the same offset?
>>
>>55710228
Yes to the first, no (I think) to the second.
>>
>>55710228
it will always be the same size because of padding unless you throw weird __attributes__ on it like ((packed))
>>
>>55710224
I smell like ass I haven't showered in 2 days

this is the first time I heard /dpt/ mention OOP and cool in the same sentence
>>
>>55710228
Yes to both. But why would you define two separate structs like that?
>>
>>55710117

Mutable references?
>>
>>55710265
OOP is a cool concept, it's just that not many languages have done it right and made it way more complex than it should be.
>>
>>55710006
Gohu!

>>55709956
Uh...T-Thanks!

>>55709972
>/usr/local/Cellar/boost/1.60.0_2/include/
Alright, now I'm confused... Still still not working...
>>
>>55710276
You can have only one mutable reference to an object, so the many Bar objects can't all have a mutable reference to the same parent Foo.
>>
>>55710281
Java did it pretty well make everything an object sounds good to me to make programming more realistic to real life.

I have a chair object which should have a toSit() method makes perfect sense
>>
>>55710291
I meant do one or the other but not both
>>
>>55710270
Just a passing thought, adding const to what would otherwise be an opaque object.

thing.h
struct thing {
const uint8_t *data;
const size_t len;
};



thing.c
/* no include of thing.h */
struct thing {
uint8_t *data;
size_t len;
}

/* functions modify thing but the caller has const to warn him of modifying something he should not */
>>
>>55710342
YOU ARE A GOD AMONG MEN
>>
>>55710228
>>55710345
I don't know if that's guaranteed by the C standard. It would likely work on most compilers though.
>>
Can someone with with a Clang version older than 3.8 compile this code and tell me what it outputs?
#include <stdio.h>

#define type_name(a) _Generic((a), \
char *: "char *", \
char[5]: "char[5]", \
const int: "const int", \
int: "int")

int main()
{
printf("%s\n", type_name((const int){ 0 }));
printf("%s\n", type_name("test"));
}
>>
File: 1464988239571.png (509KB, 454x642px) Image search: [Google]
1464988239571.png
509KB, 454x642px
>>55710574
>_Generic
C, oh you
>>
>>55706684
>cp850
What the actual fuck? Is this still what is used in Windows console programs?
>>
>>55706465
There is absolutely nothing wrong with using text files. The only thing that matters is that it meshes well with the intended data structures and can be extended in ways in which the data is likely to be extended.

Managing JSON objects in C is just useless work.
>>
>>55710574
$ clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
$ clang a.c && ./a.out
const int
char[5]
$
>>
>>55710677
Thank you.
Apparently, clang changed the way it handles _Generic expressions to the way GCC does it. Maybe the C standard committee closed that defect report regarding that finally. I can't be bothered digging through their documents to find out the answer at the moment though.
$ clang --version
clang version 3.8.0 (tags/RELEASE_380/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang test.c && ./a.out
int
char *

Now it might actually be possible to use _Generic portably.
>>
What books do you recommend for learning about networks, /dpt/?
>>
>>55710744
That's very vague. Networks like general network concepts? For working on Cisco? Juniper? For programming with? For pentesting?
>>
>>55710761
Generic network concepts. I don't have the foundation to specialize.
>>
>>55710744
TCP/IP Illustrated
Unix Network Programming
>>
Concretely speaking (aka memes aside) why isn't Haskell on par with Java or C# for production systems?

>muh le syntax looks like tolkien's work
Fuck off.
>>
>>55710812
Syntax is an important aspect of a programming language. It's easier to train people using Java and C# or Python, if it's easier it's cheaper.

Javascript is probably the most popular programming language right now, you think it's because of their structure? Anybody can do a fizzbuzz in half an hour in JS.

Not only that but most systems don't really need to use anything other than JS, Java or C#
>>
>>55710761
For pentesting?
>>
>>55710830
I'm not talking about the development ease, but performance, security, stability and scalability.

Don't get me wrong, I love Python but I wouldn't use it for anything but as a tool.
>>
>>55710865
It'd be expensive to train someone to use Heskell. Companies want money.
>>
>>55710903
I don't care about companies, I'm talking about an hypothetical case scenario. Why would I want to use Java or C# when I already know Haskell. Pretend I'm building google 2.0.
>>
>>55710812
No functional language is useful for actual program development unless you're building a le .io framework
>>
>>55710923
Dunno. Maybe it'd be easier to get people to help you build it in C# or Java?
>>
>>55710966
>>55710950
Meme responses. I see the FP bashing is just butthurt because people can't follow along.
>>
File: 1467501063743.jpg (180KB, 947x891px) Image search: [Google]
1467501063743.jpg
180KB, 947x891px
>>55710923
don't use any of those bloat cancer shit. haskell included.
>>
>>55710923
it's nearly impossible to build anything in haskell
there's only like one project that anyone uses that is written in haskell and it's a simple as shit window management thing for linux
anything more complex than that is essentially impossible to do
>>
>>55710966

This is exactly why using haskell in a project is a bad idea. It's a lot harder to get contributors to the project.

The sad fact is the enterprise languages have more developers available. If you're not planning on doing the whole thing solo it's better to use a more common language.

FP is a great idea for areas it excels in (Telecommunications, Distributed applications, Math, and building domain specific languages). It just isn't popular or often used by the average coder (Corporate lackeys)
>>
>>55710324
toSit() doesn't make any sense at all. The Human object having a sit(objecttositin) function does though.
>>
File: 1440392430201.jpg (92KB, 1280x720px) Image search: [Google]
1440392430201.jpg
92KB, 1280x720px
>>55711052
dont forget installing dependencies for haskell programs is total crap and unreliable. there is a whole mix of ways to install a stack and you can easily run into unresolable conflicts that require unrooting everything. it's so horrible.
>>
File: output.webm (3MB, 320x597px) Image search: [Google]
output.webm
3MB, 320x597px
r8 muh game /g/
>>
>>55709990
Elixir has a much better standard library, much better string support, a much better package manager, and the language is much nicer overall. Elixir macros are also very easy to use and make it simple to eliminate a lot of Erlang boilerplate. Try writing a simple gen_server in both languages.
>>
>>55708577
C++ benefits most from font ligatures. Get on your IDE's version 2016.2 m8
>>
>>55711090
Enemies still don't shoot back and no explosions.
>>
File: UnAssigned_104.jpg (275KB, 1400x1410px) Image search: [Google]
UnAssigned_104.jpg
275KB, 1400x1410px
>>55711090
You're on your way to developing the next Minecraft.
>>
>>55711090
looks pretty, is that just temporary? would be a nice art style
>>
>>55711090
"not touhou"/10
>>
>>55708977
>git branch new_feature
>git checkout new_feature
aka git checkout -b new_feature
>>
>>55711115
It was meant to be temporary but I think it just werks, thanks lad.
>>
>>55711108
tomorrow anon, I promise!
>>
I'd love to see someone do this with haskell.

https://github.com/ahefner/asm6502
>>
>>55711025
>not really used in the real world but still thinking it should be used in the real world

The "everyone is stupid but me" thing doesn't work when you're dealing with companies who are stupid and know it
>>
>>55711137
If you stick with that style, you should change the health icons and other UI stuff to match it.
>>
>>55711052
>that is essentially impossible to do
Why?

>>55711188
You're assuming I'm a CS wagecuck.
>>
>>55711186
post something smaller and maybe someone will
>>
>>55711216

Since when was less than 5 k lines of code not a relatively small project?
>>
>>55711271
He's probably used to <100 line scripts or toy projects
>>
>>55711271
>hahaha haskell users won't even translate this 5k lisp program for no reason other than to give me, a hater of haskell, a single example of haskell code
>haskell btfo
>>
>tfw no /g/ anon mentor to teach me how to be a competent programmet
>>
File: required reading for (You).png (381KB, 528x528px) Image search: [Google]
required reading for (You).png
381KB, 528x528px
>>55711310
>>
>>55711285

Toy projects are usually around 1 - 3 k lines of code..
>>
>>55711327
>Haskell logo on cover
>Sussman

(Y)
>>
>>55711340
it's a greek letter for which a calculus is named
>>
>>55711361
LIES
>>
>hear that learning to program doesn't really require math knowledge
>tfw i horrendously failed even algebra 1
Will I make it /g/?
>>
>>55711195
I will!
>>
Can anyone tell me what I'm doing wrong? I have no idea what I'm doing. Trying to run python with sublime text while I do a online class for programming just started today. the code should work but I'm doing something off with sublime I think.
>>
File: 1462666020059.png (389KB, 554x463px) Image search: [Google]
1462666020059.png
389KB, 554x463px
>>55711403
>python kids learning
>>
>>55711340
I remember when that was the Half Life logo
>>
>>55711416
I take my folder naming seriously.
>>
>>55711382
You need to know a fair amount of mathematical reasoning if you want to make your programs efficient and want to be able to analyze them (which I'm assuming you'll want to do eventually)
>>
>>55711403
Teach Ruby for the kids, it's easier.
>>
>>55711307

> Doesn't realize the assembler itself is only about 1900 lines. The rest are demo examples of nes programs made with it.
>>
>>55710950
Banks use Clojure and train systems use CL.
>>
new thread

>>55711471
>>55711471
>>55711471
>>55711471
>>
Am a shitty Script Kiddie which always coded some shit that works, but was for real shitty coded. Learned everything by myself, so i skipped some basics and went directly to the javascript react + 234789 'npm i'-modules shitfest.

To learn basics things, i wanted to learn golang and i am working through the “The Go Programming Language” by Brian W. Kernighan. But there are some things i simply dont understand:

The whole chapter about init-values via a function. Why should i use that? And the included example about 'Popcount'. What am i doing here? I know that i somehow take all bytes of an 64-Bit Interger and somehow loop through it to ... count 1 ? Can anon explain me this code?
>>
>>55711090
kawaii/10

Explosions pls
>>
>>55711432
Any specific concepts i should study up on?
>>
>>55711488
learn about bit shifting and why it's important before doing anything else
>>
>>55711568
Thanks, i was searching for a keyword to google.
>>
>>55711429
>Uzzy Tech
faggot
>>
>>55707438
Only legit one should be TDD.
>>
>>55711910
He probably included TDD, because that's the most recognizable *-driven design existing
Thread posts: 320
Thread images: 41


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