[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: 330
Thread images: 42

File: dpt2.png (1MB, 2504x1409px) Image search: [Google]
dpt2.png
1MB, 2504x1409px
What are you working on, /g/?
>>
C wasn't great
ML would have been okay
or maybe LISP too, who knows
>>
>>60044514
Currently banging anon's mom
>>
how can i remove all occurrences of '0x' from a string using python? e.g. if it was 0abx i'd want 0abx, but if it was 0xab i'd want ab. not real familiar with regex
>>
nth for reipmlementing Haskell in Scala
>>
>>60044533
Haskell is creaking at the seams. We need a language with dependent types and without unsafe functions.
>>
>>60044536

I'm a shit programmer /g/.
>>
>>60044542
Scala is unusable as Haskell
Scala is more unusable as anything else though
>>
>>60044540
str.replace("0x", "")

I don't even know Python lel.
>>
>>60044553
Repost and define what you mean by "split the tuple".

Some example inputs and expected outputs would be nice too.
>>
>>60044475
>you heard her laugh
TIME TO KILL MYSELF
>>
>>60044621
Don't do it anon, you have so much to live for!
>>
File: g-side.png (260KB, 498x1480px) Image search: [Google]
g-side.png
260KB, 498x1480px
>>
>>60044635
I'm good at C++ and wasn't bullied at all.
>>
>>60044571
If I print the List I get
((throwing,a),1)
((competitive,basketball),2)
((which,two),1)
((regulated,variations),1)
((team,with),1)
((be,advanced),1)
((game,wins),1)
((by,bouncing),1)
((disruptive,physical),1)
((through,time),1)
((foot,high),1)
((not,permitted),1)
((exceedingly,popular),1)
((indoor,sport),1)
((offensive,and),1)
((developed,to),1)
((points,are),1)
((how,the),1)
((at,the),1)
...


What I want to do is format the List into a triple touple with(String,String,Int) instead of the double touple with a nester touple of ((String,String),Int))
>>
>>60044677
theList.map { case ((word1, word2), count) => (word1, word2, count) }
>>
def p():
print "p"

def r():
print "r"

def i():
print "i"

def n():
print "n"

def t():
print "t"

p()
r()
i()
n()
t()
>>
>>60044732
Why would you do this?
>>
>>60044732
>not using a macro to generate those functions
>>
>>60044755
DOGGO
>>
>>60044732
print ("""
P
R
I
N
T
""")
>>
Hi /dpt/, I'm working on a university assignment in C, which contains the following pieces of code.
data* func(){
data* all_data[100] = {NULL};
...
return all_data;
}

This function raises a compilation warning to do with returning the address of a local variable.
I'm aware that all_data is my array name, but an array head is just a pointer, so why isn't returning it okay? My program runs just perfectly. Should I cast it to (data**) before returning it or something? I just want to silence the warning.
>>
>>60045020
The array is only valid for the block it's defined in. So as soon as you leave the function, the pointer will point to invalid memory.
>>
>>60045040
This is not true. I return the pointer and everything works just fine. The pointers the array is populated with are generated via malloc so they also stay the same.
>>
>>60045020
I'm not sure but unless you use a different storage specifier, then your all_data will be overwritten on the stack after another function call. Pass all_data pointer to func() to avoid this or use malloc to reservere memory on the heap instead of the stack.
>>
>>60045054
>This is not true. I return the pointer and everything works just fine.
That doesn't mean that it's not undefined behaviour. Try calling the func, then some other function, then use the result.
>The pointers the array is populated with are generated via malloc so they also stay the same.
That doesn't matter. The array itself is local to the function.
Allocate that using malloc.
>>
>>60045054
Try doing data* all_data = (data*) malloc(sizeof(data)*100).
>>
>>60045070
I have done. My entire 600 line project relies upon this one function working at the start, and it does. All the data I read in using func (it's not actually called that) is stored properly and all calculations done with it work exactly as expected. I even have a set of given outputs that I've tested against which are identical.

>>60045080
>>60045058
I think this was what I was after. I'll try it and post again if it doesn't help. If not, thanks.
>>
>>60044672
im ok at ruby and i was bullied every year, which made me stronk
>>
>>60044760
just stopping by for my monthly shitpost quota
still haven't got a captcha without "calle"
>>
>>60045020

There is a reason you are being given a warning. The all_data array is located on the stack, and so when the function is returned, subsequent function calls are allowed to write over it. Returning a pointer to it only ensures that whatever code is using that buffer cannot be guaranteed consistency.

Do this:
data **all_data = calloc(100, sizeof(data*));
>>
Is there a reason besides bad luck that horrible Python got picked up by academia/sci, while best girl Ruby got picked up by douchey brogrammers and Rails pajeets?
>>
>>60045191
One was stuck in Japan, the other Yurop
>>
>>60045054
This is why C is not for pajeets.
>>
>>60045265
Every time I see anyone calling others a "pajeet" I automatically know:
1. Anon is an underage fuckwit
2. Has no real argument
3. Failure in life
>>
>>60045020
you're allocating all_data in the stack and it is deleted after the function returns.
>>
>>60044726
Thanks alot anon.
>>
can pajeet make a sum of all primes below 2000000 program?
>>
>>60045265
>C is not for pajeets
goddamn i'm sick of this meme. pajeet is literally all over every popular language. there are C pajeets, C++ pajeets, (most famously) java pajeets, ruby pajeets,....
the only languages still untouched by poo hands are lisp, FP languages, Rust
>>
https://www.bloomberg.com/news/articles/2017-04-03/new-h-1b-guidelines-crack-down-on-computer-programmer-jobs
>>
File: C.png (35KB, 1052x542px) Image search: [Google]
C.png
35KB, 1052x542px
>>60045368
cont...
I took a random screenshot of C solutions to a 'hard' hackerrank bit manipulation problem.
what do you notice?
>>
>>60045265
>tfw university professor teaches C
>100% pajeet with deep, strong and profound indian accent
>looks and smells like shit
>"C is the best language, all other languages are based on C"
And /g/ makes fun of pajeets. I wonder if most /g/ are actually self loathing pajeets
>>
Does anyone know how to make a foobar plugin in 2017 visual studio?
I can't seem to find the right information to get anything to work here.
>>
File: java-vs-haskell.png (102KB, 2435x913px) Image search: [Google]
java-vs-haskell.png
102KB, 2435x913px
>>60045402
hackerrank's made for pajeets anyways. look at who makes all the questions
>>
>>60045402
>AndrewMiT
>india
top lel. On a side note, how will C pajeets ever recover?
>>
>getting this triggered "pajeet"
wew
>>
>>60044540
You don't need to use regex for that.
>>
>>60045413
as I said, there doesn't seem to be many Indian functional programmers. even hobbyists. Pajeets gravitate towards whatever is in demand / marketable.
>>
File: paj.png (64KB, 276x469px) Image search: [Google]
paj.png
64KB, 276x469px
>>60045421
b t f o
>>
>>60045368
I bet there are no Mathematica pajeets
>>
>tfw just signed up in pajeetrank
Add me up, /g/ chan @Culpreet_Pajeet
>>
>>60045482
who does use mathematica when matlab is out there?
>>
>>60045497
>implying a symbolic mathematics environment competes with a numerical analysis package
>>
>>60045413
How many people need to submit for a language before they release a leaderboard? Seems like a good way to curb my autism.
>>
I want to port Opera to MIPS32. The leaked 12.15 source code has already been ported to ARM, and I'm assuming ARM ASM will be easier to learn than x86. So my main question is will I be able to learn MIPS ASM and just what I need of ARM ASM to port it to MIPS, or will it be more viable to just learn both ARM and MIPS ASM?
>>
File: chen_spit.png (52KB, 325x216px) Image search: [Google]
chen_spit.png
52KB, 325x216px
>>60045497
People with an actual brain lmao.
>yfw Mathematica is excellent for what it does while Matlab has dozens of better alternatives
>>
>>60045543
>is a chen poster
>has a brain
choose one
>>
>>60045293
>Every time I see anyone calling others a "pajeet" I automatically know
I make broad generalizations about broad generalizations.
>>
File: ran_disgust.png (53KB, 204x288px) Image search: [Google]
ran_disgust.png
53KB, 204x288px
>>60045558
>doesn't like Chen
Confirmed brainlet. All past, present and future opinions discarded.
>>
File: 1483525649803.jpg (34KB, 680x734px) Image search: [Google]
1483525649803.jpg
34KB, 680x734px
>>60045494
>To complete this challenge, you must save a line of input from stdin to a variable, print Hello, World. on a single line, and finally print the value of your variable on a second line.
>
import std.stdio;

void main(string[] args)
{
string inputString = readln();
writeln("Hello World.");
writeln(inputString);
}

>Wrong answer
Well fuck you too
>>
>>60045604
>Frogposting
D(ead)lang users confirmed for cancerous, yet again.
>>
>>60045604
Might need a chomp after readln
>>60045628
t. cancerous meme poster
>>
File: 1466775273656.jpg (171KB, 2000x1333px) Image search: [Google]
1466775273656.jpg
171KB, 2000x1333px
>>60045628
Are you offended by my white supremacist frog?
>>
>>60045646
Yes, you necrophiliacs really are cancerous meme posters.
>>
>>60045664
No no no, I was calling you the cancerous meme poster
Easy mistake to make when you're retarded
>>
>>60045628
>cancerous
He posted D, not C
>>
>>60045684
You clearly said
>t. cancerous meme poster
How is that not an admission of guilt?
>>
>>60045701
Because it's not
>>
>>60045693
exactly
>>
>>60045604
>print "Hello, World." on a single line
>prints "Hello World." instead
even pajeets can follow directions better than you
>>
>>60045722
You missed
>and finally print the value of your variable on a second line.
>second line
>>
>>60045693
This
>>
>>60045738
I didn't miss that, mouth-breather.
It isn't the issue.
>>
>>60045753
>I didn't miss that, mouth-breather.
Sure you didn't. Any other reason you are so angry? :^)
>>
>>60045770
you need to improve your shitposting game. Here's a complimentary (You), sport.
>>
>>60044554
top kek
>>
>>60045790
I except your defeat
>>
you're tryin too hard m80. Now you don't even deserve a (You).
>>
>>60045543
>dozens of better alternatives
which ones? octave? scilab? python? heh
>>
>>60045838
kys pajeet lover
>>
File: tips.png (161KB, 265x281px) Image search: [Google]
tips.png
161KB, 265x281px
>>60045857
>heh
>>
>final week of first programming class of comp sci where there's anything due that's not the final
>actually look through the discussion section (needed for participation credit)
>there's like four people posting there

I wonder if this class cleared out. It wasn't a hard class at all.
>>
>>60045891
Participation credit is what? 5%. Only people who do it are those who want an A+ instead of A.
>>
>>60045891
yeah you'd be surprised at how many people can't even comprehend simple loops, conditionals, recursion, etc...
>>
>>60045904

>write a few sentences once per week
>get half a letter grade, guaranteed

I don't imagine that most people who skip that are getting As. Certainly, the B and C students need it.


>>60045931

I can only see it as lack of effort/intimidation. If you can't manage-

if (milk > 0)
Drink;
else
Place on grocery list;

while (clothesonbed = true){
fold clothes;
place in drawer;
}

-how do you manage to live?
>>
Programming a raycaster in Javascript for fun.

Other people have done it, but I'm trying to avoid simply following a tutorial. Working through the geometry on my own.

I have the basics working (a 2D grid the camera can move around), and differently colored walls appear in the "order" they should in the first person ("3D") view. So, I have a room you can walk around in, and know where you are. The wall height is still messed up.

It's a neat project.
>>
File: dpt kaguya.jpg (579KB, 1280x1115px) Image search: [Google]
dpt kaguya.jpg
579KB, 1280x1115px
Have you read your SICP today?
>>
>>60046045
People are just lazy. Anybody can figure out loops and conditionals. I'm living proof of this.
>>
>Go BTFO
https://github.com/ksimka/go-is-not-good

Press F for respect
>>
File: test (2).png (716KB, 811x599px) Image search: [Google]
test (2).png
716KB, 811x599px
>>60046151
Nope.
>>
File: 1492832709498.jpg (44KB, 434x479px) Image search: [Google]
1492832709498.jpg
44KB, 434x479px
>>60046151
>>60046237
tech/l/oli/g/y
>>
>>60046191
>no OOP
But that's not a bad thing.
>>
>>60046191
i knew that from the moment it came out
>>
flags, globals, inheritance
>>
Anyone here use R?
>>
Made a Django App.

Behind the scenes it scrapes car selling web sites and their prices. Then runs some machine learning algorithms over the data and generatimg rules to predict prices.
In thr web interface prices are compared and cars with prices too low can be found.

I'm evaluatimg now if I should use Heroku or AWS or somethimg different.

(All for my portfolio, it's also a lot of fun).
>>
>>60046625
What library are you using to scrape the data?
>>
>>60046592
Better would be:
Anyone here use R? Here's my problem ...

a <- if '['(30:100, 40) < dickbutt


Nobody likes the additional step of saying "Yes, what is your problem?"
>>
>>60046592
R is garbage. Found your problem.
>>
>>60046640
lxml for the smaller sites.
The bigger ones have API's.
>>
>>60046656
R is functional
CRAN is incredible
I like R quite a lot actually, certainly more than the python I'm recently being forced to do
>>
>>60046625
Just out of curiosity, what are you using to do the scraping?
>>
>>60046661
Nice. What language are you running the machine learning alorithms with?
>>
Studying C++ now.
Was programming on python for 2 years.
I decided that its time to become a human being.

Also is learncpp.com any good or is it just a meme?
>>
File: 1480779617263.jpg (62KB, 631x720px) Image search: [Google]
1480779617263.jpg
62KB, 631x720px
>>60046625
This is more for /wdg/, but I'm impressed. Good luck, anon.
>>
File: 1487022728214.png (626KB, 840x904px) Image search: [Google]
1487022728214.png
626KB, 840x904px
>>60046694
Download a book, anon-kun.
>>
>>60046701
Pretty sure the machine learning part isn't /wdg/ and is actually the hard part vs scraping off sites.
>>
>>60046644
Yeah, true. my bad.

I used strsplit on a column in a dataset to turn what is basically a CSV into an array, but it decided it would be a good idea to not make everything an array, but instead make things arrays except where there was only 1 entry, in which case it would just be a plain string.

I anticipate this will make it more difficult to analyse. What's the best thing to do from here? I was thinking about doing something along the lines of

data$Column = ifelse(typeof(data$Column == 'Array'), data$Column, c(data$Column))
>>
>>60046677
http://python-guide-pt-br.readthedocs.io/en/latest/scenarios/scrape/
I basically followed this guide with lxml and request and put the needed info into my DB (Oracle).

>>60046682
I did it all with python because of the ML libraries. Stuff like sklearn is pretty handy.
And since I was already using Python for Django I prefered Python over R.
>>
>>60046731
I have been thinking of doing machine learning and since you did it in Python, I guess that is a appropriate path I should take. Is there an actual environment or server where you stuff is setup or does it only work in IDE conditions?
>>
>>60046723
Don't bother, one-element arrays are fine, especially if this allows not making a special case.

K I S S
I S S
S S
S
>>
>>60046765
K I S S K
I S S K I
S S K I S
S K I S S
K I S S K
>>
>>60046765
>Don't bother, one-element arrays are fine
You misunderstand. It DIDN'T make a one-element array - it looks like it just chucked the one value directly into the cell. I want it to be a one-element array for the reason you've said.
>>
>>60046723
Sounds like you're overcomplicating things. I mean it depends on what you intend to do with the data I guess but surely the more homogeneous the columns are the better. I don't really have a good picture of what you're doing or why you're doing it though. But it seems like the sort of problem one has when they're making a poor design choice in the bigger picture.
>>
>>60046777
>it decided it would be a good idea to not make everything an array
Wait, I misread, i read 'I decided'. Bad language, change language. or put your ifelse inside whatever bullshit R uses instead of a 'map' function.
>>
>>60046701
Thanks.

>>60046714
It's also way more fun running and trying out different algorithms and thinking about which one gives the best results and how to improve them.

Meanwhile, every site has to have it's own script and cleaning some of their data is sometimes annoying.

Defenitely recommend everybody to once dig into ML and try it out.
>>
>>60046791
> it decided
> not anon, he didn't want to scrap off one-column array, R did it by itself.

Aren't R sequences so stupidly special-cased that c(1) yields just 1 and not a one element array like in any sane lang?
>>
>>60046805
Do you need maths to dabble in ML?
>>
>>60046805
>Defenitely recommend everybody to once dig into ML and try it out.
What's your math background? I'm interested, but I've only got Calc 1 and some discrete math under my shitty belt.
>>
>>60046812
scalars in R are all one-dimensional vectors friend
Which makes good sense to me, and makes treating scalars as non-vectors seem stupidly special-cased
>>
>>60046791
Input:
x | x | a,b,c | x
x | x | b,c | x
x | x | c | x
Desired Output:
x | x | [a,b,c] | x
x | x | [b,c] | x
x | x | [c] | x
Actual Output:
x | x | [a,b,c] | x
x | x | [b,c] | x
x | x | c | x
>>
>>60046831
There's no way for a value such as [c] to even exist according to >>60046827
, so forget about it. or try to act on the way it's formatted out, or just use a sane language.
>>
i've been playing around with udp broadcasts and python

i haven't ever done networking stuff, and barely ever touched python so it's kinda challenge haha. I got some of it to work though, thanks google.
>>
File: ree.gif (1MB, 680x680px) Image search: [Google]
ree.gif
1MB, 680x680px
>>60046848
>>
>>60046859
dumb frogposter
>>
>>60046831
So initially it was "abc" that you turned into ['a' 'b' 'c']? And it's giving you 'c' in one case, a 1-dimensional character vector, but you're not happy with that?

I still think it's a flaw with your approach to whatever your problem is, but probably a little also that you misunderstand R's data types. Oh and >>60046859 confirms it, the problem is that you're retarded so I wish you good luck.
>>
>>60046749
Most of the stuff either use Python or R as introduction. I'd try out both and decide ehat you like more. Later you can dig into the big guys stuff and try out Hadoop with Spark and whatever they are called.

>>60046813
ML is basically doing statistics on data and trying to understand what they mean. Sure, the libraries can do a lot of things, but you'll need to understand the rsults you get.

>>60046819
That's good enough for starters, just get a good and easy to understand statistics book while digging into it. You'll get the hang of it.
I had a lot of statistics during my studies since I always wanted to go into this direction.
>>
>>60046929
>ML is basically doing statistics on data and trying to understand what they mean
Really? I am more interested in building my own NN with weighs and bias and how they propagate. So basically ML libraries are just calculator where you punch in variables? That is disappointing.
>>
File: 1456117005164.png (116KB, 404x323px) Image search: [Google]
1456117005164.png
116KB, 404x323px
>>60046929
>easy to understand statistics book
Well, I'm sure it exists. Thanks, anon.
>>
>>60046819
With some multivariable calc (pretty easy step from single variable honestly, and almost entirely just the differentiation side of it) and a little linear algebra you can get into basic ML.

As an aside it grinds my gears that linear algebra seems to get the shaft in favor of calculus. Like the implication is that after you've had 4 semesters of calc you're ready for some linear algebra, when in reality there's no explicit calculus prerequisite for linear algebra and the topics are arguably more accessible given the topics in earlier schooling, plus there's a great mix of application/theoretical, and blah blah blah. Just wish it was emphasised more in late HS/early college for STEM undergrads.
>>
File: alphago3.jpg (174KB, 1024x1408px) Image search: [Google]
alphago3.jpg
174KB, 1024x1408px
>>60046965
Here you go friend
http://www-bcf.usc.edu/~gareth/ISL/
>>
>>60046912
next time i'll be sure to post little girl cartoons instead
>>
>>60046951
No they help you achieve your stuff like any other library you're using in your programming. Setting weights and waging what to use and what to do with that info and find apply the rules is still your job to do.
>>
File: qt.jpg (133KB, 470x545px) Image search: [Google]
qt.jpg
133KB, 470x545px
>>60046971
>With some multivariable calc (pretty easy step from single variable honestly, and almost entirely just the differentiation side of it) and a little linear algebra you can get into basic ML.
I wish I didn't drop out of school. Fuck.

>As an aside it grinds my gears that linear algebra seems to get the shaft in favor of calculus...
My (then) calculus professor went on a very enjoyable rant about pretty much the same thing. He urged the ones who were going to need it to go study it now instead of waiting. He also used rape statistics to set up problems. What a ride.

>>60046984
I feel bad I can only thank you in the form of cute 2D girls.
>>
File: 1476564661987.jpg (88KB, 499x640px) Image search: [Google]
1476564661987.jpg
88KB, 499x640px
>>60047020
it's not cartoons, it's called Anime, not like a baka gaijin like you would understand
>>
How the fuck do I get into programming

I don't even want a job with it, I just want to understand the computers I use, and get better at using gnu/Linux. I've been using Ubuntu on and off for like 3 years, and I still feel like a fucking noob. I want to be able to write software for myself, to do what I need, and I'd also like to contribute to free software/GNU/whatever, but I literally know nothing about programming. Wat do?
>>
>>60047042
Anime is literally a type of cartoon.
>>
File: do_it.gif (2MB, 1100x800px) Image search: [Google]
do_it.gif
2MB, 1100x800px
>>60047058
jesus christ anon
>>
>>60047050
Buy a C or C++ programming book and learn it. Or just use some open source book.
>>
>>60047050
low level OS stuff, like Tannenbaum's book, is really /how computers work/. You get a better idea what it's doing under the hood as well insights on pretty much all the rest. Also play with VMs and containers, they're cool. Encrypt your drive also, it's doubleplus beneficial because it makes you learn a thing or two about the boot process, and it protects you against the TSA.
>>
>>60047050
1: Pick a language
Contrary to what memers will tell you, this doesn't actually matter a whole lot. Try to pick something relatively popular that is okay for the sort of things you wanna do (eg: don't learn matlab if you wanna make vidya).
Python 3 is a decent starter language for getting shit done fairly quickly.
C is good for understanding how a computer works.
2: Start writing programs
Obviously you'll have no clue where to start so pick up some tutorials or a book, or some youtube videos if that's your thing, and start writing shitty programs. Don't use books as an excuse to not code though - there's some good info out there but you learn by doing. When a tutorial/book gives you some sample code, change it around to do something slightly different. If you have no idea what to change, pick something random and if it breaks it, pay attention to what the error is.

I'll be honest with you - everything you write for a few months will be shit but at least you'll be learning.
3: Learn a completely different language
Once you feel somewhat comfortable with (for example) Python, learn something different. Python is high-level, dynamically-typed, managed, interpreted. Try a low-level compiled, strongly typed, unmanaged language C and you'll notice what's different and what's not. There are certain elements of programming languages that you can expect to be pretty much everywhere, and there are certain elements of programming languages that consistently appear in 'high-level' languages. Figuring out what those are and understanding them on an abstract level (ie: beyond the syntax of a specific language) will not only make it far easier for you to pick up a new language, but also will solidify your understanding of programming in general.
>>
File: prolog.png (46KB, 200x200px) Image search: [Google]
prolog.png
46KB, 200x200px
>>60044514
What's the most elegant way for getting the Cartesian Product with Prolog?
>>
>>60047133
>don't learn matlab if you wanna make vidya
Tell that to my copy of Bootstrap The Eigenwars
>>
>>60047038
Don't worry about having dropped out. There's loads of resources around. Combine something like a couple used/free texts, some youtubes, asking questions online, and you have the makings of a very decent education. I recommend Gilbert Strang on youtube for lin alg. For calc, like I said for machine learning you really only need to know how to do partial differentiation, and mostly you don't even need it but you'll definitely hit a ceiling quickly by just using libraries and not understanding the theory. But you can still do a lot and there are high-level explanations out there.

Also this
http://students.brown.edu/seeing-theory/
>>
File: 1490499246037.jpg (84KB, 960x544px) Image search: [Google]
1490499246037.jpg
84KB, 960x544px
>>60047482
That gives me some hope; I now just have to depend on myself to work it out.
>http://students.brown.edu/seeing-theory/
Very nice.

Again, thank you for the assistance, anon.
>>
If you use a GOTO, can you place your label outside of the function where the GOTO was used? No I don't plan on doing that, just asking since I've never used GOTO outside of a practical joke.
>>
>>60048036
Yes, it just jumps to the given location (the label).
>>
>>60048036
Why don't you just try, Anon?
>>
>>60048053
You are right, I should have just tried it out, don't know what's wrong with me.

>>60048049
I imagine that could be the biggest reason why it's deprecated, chasing labels seems like a fools errand.
>>
>>60048036
Depends on the language, but in C (and I assume every C-like language), you can not use goto to jump outside of a function.
>>
>>60047385
Dammit, I want this to be a thing.
>>
>>60046644
I just got out of the shower and there's a message from a guy at work saying

>Hey can I ask you something?

He's now afk from his computer.
>>
>>60048272
I fucking hate people like that.
>>
>>60048069
>I imagine that could be the biggest reason why it's deprecated, chasing labels seems like a fools errand.

That's right. See: https://en.wikipedia.org/wiki/Structured_programming
>>
>>60048036
Not in C nor C++, you need setjmp and longjmp.
>>
>>60048272
>Will you go out with me?
>>
>>60048092

Bitches don't know about my <setjmp.h>
>>
>>60048402
Does anyone in reality use it?
>>
>>60047225
You don't have much choice.
>>
>>60048402
I know about setjmp, but it's not the actual 'goto'.

>>60048447
For some incredibly odd reason, they use it as part of the libpng API.
>>
How do we make C safe?
>>
>>60048505
Don't use it.
>>
>>60048505
Implementing Valgrind om Windows?
>>
GCC7 WHEN
>>
>>60048617
GCC9 came out yesterday
>>
>>60048505
Increment it by one.
>>
Which gui library to use for native pc and mobile applications?
>>
>>60048711
++C?
sounds stupid...
>>
>>60048727
Web
>>
>>60048727
electron :^)
>>
>>60048756
Pedantry isn't becoming of anyone.
>>
Ho come this
public void removePerson(Person x){
this.ListaD.remove(x);
}


works but this
public void priumPessoa(Pessoa x){
this.ListaD.escreverPessoa(x);
}


Doesn't?
>>
>>60048447
Lua.

Quite frankly it can be a precious tool il used well IMHO.
>>
>>60048775
It works only with English.
>>
>>60048787
Oh shit I forgot to translate the second one, here you go burger

public void priumPerson(Person x){
this.ListaD.printPerson(x);
}
>>
>>60048787
You think the got language packs for the preprocessor?
>>
>Negative mouse acceleration
>Exactly opposite behavior - faster your mouse is moving, less distance cursor will travel. This is undesirable behavior and could indicate some sort of input or performance problem as game is dropping mouse input data, but more commonly mouse control implementation is botched and not tested properly. Examples are Dunia engine based games like Far Cry 3 or Far Cry 3 - Blood Dragon where you need to increase polling rate within game data files.

>Combination of positive and negative mouse acceleration
>Rarely you can also encounter a combination of these two (example Remember Me, Watch_Dogs), where the game practically ignores low speed mouse movements and camera just staying still. Positive acceleration is applied to medium speed movements and there is also strong negative acceleration to high speed mouse movements.

fucking ubisoft lmfao
>>
>>60048818
>expecting shit-skins to have any shred of intelligence
>>
>>60048834
Rude and meaningless.

>>60048818
I don't program using two different languages, obviously
>>
@60048861
Fuck off huehue
>>
>>60048806
what is the expected result? what error are you getting?
>>
>>60048447
Every time you have a function with lots of resource allocation and failure points.
Since you have to free every already allocated resource on every failure point you can just jump to labels that free all resources in opposite order.

int function(...){
void *r1 = malloc(32);
if (r1 == NULL)
return -1;
void *r2 = malloc(512);
if (r2 == NULL)
goto err_1;
FILE *fp = fopen(name, "rb");
if (fp == NULL)
goto err_2;
if (fread(r2,1,512,fp) != 512)
goto err_3;

(...)

return 0;
err_3:
fclose(fp);
err_2:
free(r2);
err_1:
free(r1);

return -1;
}
>>
>>60048882
but jumping to another function? do you have an example which couldn't be more elegantly solved in a different way?
>>
>>60048874
"x is not a valid field"

But I managed to fix it removing the linkedlist

public void priumPerson(Person x){
x.printPerson();
}


It wasn't working because "ListaD" was getting called twice, once in the method that looks for an specific person and once again in the method that prints said person... either that or I'm dumb as fuck and fixed it by accident
>>
>>60048908
>but jumping to another function?
No, it's inside the same function.
>>
>>60048937
You have no idea what you are doing, do you?
>>
>>60048939
right, but then you don't need setjmp.h. >>60048447 was replying to >>60048402. i'd be interested to know if it's ever reasonable to use setjmp.h
>>
>>60048939
He wanted to see an example of jumping to another function.

Which honestly sounds like a terrible idea.
You're gonna run into the most un-debuggable stack smash issues there are.
>>
File: 2017-04-23-165349_574x253_scrot.png (26KB, 574x253px) Image search: [Google]
2017-04-23-165349_574x253_scrot.png
26KB, 574x253px
My Node.JS state machine for ARM64

I'm planning to build a microkernel that does the bare minimum with a POSIX layer to allow Node to run on it, then I'll implement support for npm libraries and some graphical things (like UI windows in console)
>>
>>60048939
He was asking about setjmp, not goto.
>>
File: kon112.jpg (30KB, 640x480px) Image search: [Google]
kon112.jpg
30KB, 640x480px
>>60048946
Please don't bully me, I haven't done anything in 3 years, I've been trying to get back into programming for about 2 weeks now. This shit is harder and a lot more tiresome than I remember.
>>
>>60048975
learn an easy language like Haskell instead
>>
>>60048975
Cuz you never understood it beyond mashing buttons. It's like riding a bike, once you learn it you don't forget.
>>
>>60048975
dont listen to that internet tough guy anon, you're a cute and will learn it!
>>
>>60049006
*cute grill
ftfy
>>
Should I git gud at Emacs /dpt/

I know it's a good editor, I'm just scared it will make me a smelly left leaning hippy
>>
>>60049016
I'm not a girl anon.

>>60049006
Thanks anon.

>>60048990
Surely that can't be the case right? Most of my stuff works
>>
>>60049016
you can only say you're a cute grill if you look cute on your knees in panties
>>
>>60049064
>Most of my stuff works
Not talking about making stuff work, I'm talking about understanding, and you have no understanding.
>>
>>60045857
Mathematica's capability is a strict superset of Matlab's. When you have tried NDSolve, you will never want to go back to ode45. Mathematica is way more polished than Matlab for numerics.

The advantage is even bigger for matrix math. Matlab just bundles MKL for all matrix methods. Mathematica does that as well, but unlike Mathworks they actually contribute their own algos. They also have MUCH better support for sparse matrices.
>>
seriously thinking about switching to emacs
>>
>>60049120
I can only imagine someone considering this if they're already using a shit hipster text editor that's Totally-Not-An-IDEâ„¢ even though they're trying to glue 40 plugins, addons, or scripts to it.
>>
>>60049120
to emacs from what? You know how much of an slow, aged clusterfuck it is?
>>
>>60049120
try microemacs
>>60049137
>wanting to type all the brackets and parantheses and function names manually
>>
>>60049150
Right, there's there are many convenience features that you want out of something like an addon; however, 9 out of 10 times it seems that people using something like Vim have their shit so modified and duct-taped together that it takes longer to start up and use than a proper IDE, seemingly only used so the elitist can claim that they don't need an IDE.
>>
>>60049081
i can confirm that mathematica is based af
>>
>>60048828

Playing these with a controller is really the only way.
>>
>>60049147
vim
>>
>>60049191
I agree with you there desu, all those powerline and tree plugins to look cool and 1337 for /g/, I only have Youcompleteme and emmet and an elixir plugin for completions and that's it
>>
>>60049208
Try neovim first, then Emacs. Emacs has qualities, it's true, and I've used it, but I don't think it beats Neovim. Also it's old af and bad-wheel-reinventing-filled whereas neovim is a perfect update of a standard tool.
>>
>>60048505
Not using it will work
>>
>>60048806
You're calling printPerson on the list object - not the element. Should be something like
public void printPerson(Person x){
this.ListaD.get(x).printPerson(x);
}

Which seems pretty useless because you could just call PrintPerson on x.
>>
File: idris.png (131KB, 552x568px) Image search: [Google]
idris.png
131KB, 552x568px
Why aren't you using Idris?
>>
>>60049313
dead meme
>>
>>60049313
why are you using this cancer? do you even make software for a living and not just as a hobby?
>>
>>60049313
but i am anon

tell me about it
>>
File: screencap.png (308KB, 1920x1080px) Image search: [Google]
screencap.png
308KB, 1920x1080px
>>60049267
:(
>>
File: tddwi.jpg (134KB, 1107x1388px) Image search: [Google]
tddwi.jpg
134KB, 1107x1388px
>>60049411
btw, the book is up on bibliotik : )
>>
File: 1473514342258.jpg (17KB, 396x372px) Image search: [Google]
1473514342258.jpg
17KB, 396x372px
>>60049195
>>60049081
>>
>>60049441
I have this book

What would happen if SPJ, Edwin Brady, and Ed Kmett joined forces?
>>
>>60049418
If you already have the Person x, you don't need a round-trip through the PersonList class or its LinkedList to print that person, it's just
x.printPerson()
that's what he's saying, so the PersonList.printPerson method is pointless. as for your error fucking think about it
>>
>>60049418
huehue
>>
>>60049418
https://docs.oracle.com/javase/8/docs/api/java/util/List.html#get-int-
https://docs.oracle.com/javase/tutorial/collections/interfaces/list.html
>>
>>60049313
does it use lists of integers for strings?
>>
>>60049501
But anon that's exactly what I did, read the thread >>60048937
>>
>>60049403
Why are you still using worthless languages?

Would you prefer that your surgeon anesthetize you with alcohol, because it's quicker and easier for him to use than modern anesthetics with monitoring, safety, etc.?
>>
File: 1468472224634.jpg (61KB, 990x557px) Image search: [Google]
1468472224634.jpg
61KB, 990x557px
>>60049532
>>
>>60049486
This is literally an imaginary problem. All the useful software ever made was made at work. Your employer doesn't care if the tools you use are proprietary. License fees are chump change for a healthy, profitable business.
Most software isn't even available to the public. It's developed in house for internal use by the corporation that needs it.
>>
>>60049521
I don't think so
>>
>>60049539
Well meme'd, friend!
>>
>>60049560
you simply import the namespace it is in
>>
>>60049542
this

you don't need the source code or some freetard license if the program does what it's supposed to be doing and you don't need to waste your time rewriting some shitty freetard code just to implement some basic functionality
>>
How do multiple source files work in java? How do you tell the code from one file that the class I want is in another file?
>>
>>60049567
this is so fucking basic

https://docs.oracle.com/javase/tutorial/java/package/index.html

and use an IDE which has this stuff built in
>>
>>60049567
Memorise it you dumb fuck

>>60049577
Pleb
>>
>>60049597
Memorize*
>>
Has anyone actually used .NET Core? Does it actually deliver on its portability claims?
>>
File: opensource.png (71KB, 607x257px) Image search: [Google]
opensource.png
71KB, 607x257px
>>60049542
t. got pull request rejected

it's ok anon, keep trying
>>
>>60049666
>actually using dot cuck
>ever
>>
>>60049689
Why do you say that? .net is comfy overall and it's definitely the sanest choice out there for webshit
>>
>>60049666
>portability
When will this meme end? The only architecture with a substantial userbase is Windows on x86.
>>
>>60049666
it's trash
>>
>>60049723
for desktop applications, sure
>>
>>60049720
Wrong in every possible way. It is not sane, it is not comfy, and it is not a sane choice for webshit.
>>
>>60049720
>the sanest choice out there for webshit
if you're looking for "portability" which was your premise in >>60049666 then php is objectively the sanest choice
>>
>>60049723
You are seriously retarded.
>>
what is good to implement in C++ to practice it when everything is a python one liner?
>>
>ask a simple question
>nerds start flipping their shit on each other

Never change, /g/.
>>
File: Capture.png (22KB, 669x187px) Image search: [Google]
Capture.png
22KB, 669x187px
>>60049723
>>
>>60049760
Personally I only use rotary phones and I only know two people who own phones at all.
>>
Whenever I interview someone, I treat any experience with Python on their resume as being half its claimed length, e.g. 2 years of experience in Python is equivalent to 1 year of experience in Java. It's necessary because Python is such a brainlet language. Every former Python dev we've hired has been slower on the uptake than people with backgrounds in other languages, and they've required much more training and hand-holding.
>>
>>60049777
trips of truth
>>
>>60049777
When I interview applicants I subtract their Python experience from their experience with every other technology on their resume, because it actually damages their understanding of computers.
>>
File: 1474314353198.jpg (68KB, 700x700px) Image search: [Google]
1474314353198.jpg
68KB, 700x700px
>Project leader fell for the Rust meme
>>
>>60049795
I'd hire someone with 2 years experience in Rust over someone with 5 years experience in Java/C# in a heartbeat
>>
>>60049777
>>60049787
If people list Python on their resumes I make them pay for their own plane tickets and cancel the interview after the plane takes off.
>>
>>60049795
kek
>>
>>60049804
There will never be programmers with 2 years of experience in Rust. Nobody writes code in it. It only exists to be shilled.
>>
>>60049795
>Project leader probably doesn't mash /b/ memes together to communicate
Seems to be doing pretty well for herself.
>>
>>60049820
If you shill it, they will come.
>>
File: 1492021528919.png (61KB, 325x971px) Image search: [Google]
1492021528919.png
61KB, 325x971px
>>60049822
>>
>>60049826
>mozilla knowing anything about shilling
golang confirmed for the language of the future
>>
File: 1453651138545.jpg (57KB, 601x577px) Image search: [Google]
1453651138545.jpg
57KB, 601x577px
>>60049828
>Rust programmer (male)
>>
>>60049846
>golang
please no, anything but golang

golang is an atrocity
>>
>>60049846
Did you just say """"Go""""?
Here is an interesting link for you
>>
>>60049666
>Has anyone actually used .NET Core?
Yes.
>Does it actually deliver on its portability claims?
Yes, although using .NET Core is a little more painful than just using the .NET Framework to target Windows machines.

Personally, I'm looking forward to .NET Standard 2.0 making portable libraries 1000x better.
>>
>>60049846
>>60049865
https://github.com/ksimka/go-is-not-good
>>
>>60049851
>being this much of a flamboyant sissy
>>
>>60049846
Want to write a generic Fibonacci heap in Go? Tough shit! No generics for Go users.
>>
>>60044514
I'm working on things that require me to deal with large integers. Due to various reasons, a copyright notice distributed along with the binary (or, God forbid, GPL cancer) is not an option.

Is there an arbitrary precision number library in C?
>>
There are no men on /dpt/, only women pretending to be men, prove me wrong
>>
>>60049903
GMP
>>
>>60049894
Why would I ever want to do that in a real world application?
>>
>>60049909
>Due to various reasons, a copyright notice distributed along with the binary (or, God forbid, GPL cancer)

I forgot to mention it'll get statically linked. My bad.
>>
>>60049499
cunt destruction
>>
>>60049931
If you don't want to acknowledge other peoples' work then write your own implementation.
>>
>>60049926
It has good asymptotics.
>>
>>60049959
>said nobody ever
>>
>>60049894
i don't even like go but i don't give a fuck about generics
>>
>>60049795
For real? How does he expect to hire people?
>>
>>60049968
I just said it.

>>60049975
Brainlet detected
>>
>>60049977
I'd work for him.
>>
>>60049986
>I just said it

Yeah. And you're a nobody.

/thread
>>
>>60049736
Well name me one? Unironically comparing php or fucking js with C hash is a complete madness
>>
>>60050003
Haskell
>>
>>60049997
t. failed his algorithms and complexity classes
>>
>>60050027
Jokes on you, I majored in bio ;^)
>>
>>60044514
Just got some code running bare metal on rasp pi 3.

Took about 250 lines of assembly to get an LED flashing with pretty much any pattern I want.

Way cool.
>>
Can someone explain static to me
when I was a beginner everyone said don't worry about what this means yet
now everyone looks at me like I'm retarded because I don't know what static means
>>
File: 1492913983134.png (90KB, 780x402px) Image search: [Google]
1492913983134.png
90KB, 780x402px
>>60050027
>>
>>60050037
That's literally one import and one function call in Python
>>
>>60050045
Which "static" are you talking about? Static in C? Static linking? Static IP addresses? Static electricity?
>>
>>60050055
electricity
>>
>>60050055
static classes in nested classes in c#
>>
wait, hold on

you can't statically link gpl thing into non-gpl? but why?
>>
File: 1c3107c72c35ff82f608ff9670c7bf12.jpg (132KB, 550x1241px) Image search: [Google]
1c3107c72c35ff82f608ff9670c7bf12.jpg
132KB, 550x1241px
About to start SICP
>>
>>60050067
If it's anything like in Java, then: much like you can define static and non-static methods and fields in classes, and the static ones are not part of instances of the class, they're just global, you can also have static and non-static nested classes that follow the same rule.
>>
>>60047385
I would play this
>>
>>60050090
>that image
What if I don't want to work everywhere and everywhen?
>>
File: Untitled.png (14KB, 640x400px) Image search: [Google]
Untitled.png
14KB, 640x400px
>>60050048
And that would've been boring. :)
>>
>>60050090
lol, great pic
>More than 1/3 have worked while having sex!
>34% have worked on their deathbeds!
>>
>>60050067
If you make a private static nested class, you're basically creating a non-instantiatable logical collection of values and methods belonging to its outer class.

Frankly, I don't think I've ever come across a time where I've done this. I'm sure it has uses, but I don't see why you would bother with it as a beginner.
>>
>>60050131
this reminds me of this https://www.youtube.com/watch?v=gjuHxjdv3ZE
>inb4 jews
>>
>>60050135
If this is done, it's a huge code smell.

If it's simplifying things, you're probably on the verge of a God Object/Class, and/or things need to be factored.
>>
>>60050102
What? You don't want to be a complete slave to your corporate masters?? Lazy slacker.
>>
rewriting GNU Hurd in pascal
>>
NEW THREAD

>>51971506
>>51971506
>>
File: 1470671602288.gif (607KB, 250x249px) Image search: [Google]
1470671602288.gif
607KB, 250x249px
>>60050204
>mfw i still fall for this
>>
>>60050171
>tfw your code smells like strawberries

D-don't sniff, oniichan
>>
>>60050045
>when I was a beginner
>was
learn to google
>>
>>60050228
>tfw I fell for it once, tabbed away, tabbed back, then fell for it again
>>
New thread:
>>60050290
>>60050290
>>60050290
>>
>>60050045
Maybe, since you're not a beginner:
https://msdn.microsoft.com/en-us/library/98f28cdx.aspx
This is appropriate.
>>
File: TERRA NOVUM.jpg (24KB, 400x275px) Image search: [Google]
TERRA NOVUM.jpg
24KB, 400x275px
>>60050045
>when I was
>>
this morning I almost fucked my whole life up because I did an update during a window in which openssl was updated and no other packages in the core repo had been rebuilt to account for it. I'd almost think Archlinux was a haphazard distribution if it weren't for the fact I've run into shit like this even on RHEL
>>
>>60050325
The update, once finished, leaves the system in an unusable state, right?

I have no difficulty believing you and I'm not going to put you down or anything, I'm just curious. And I also want to shill for declarative package management but that's another story.
>>
>>60050325
at least you're using a real linux and not a shitty windows knockoff
>>
>>60050396
>>60050411
I was able to fix it, I can't really say it is a problem with Arch so much as my own impatience. Full story:

came in early today and did a pacman -Syu, Afterward I started working on some stuff that involves Vagrant and noticed that Ruby was now fucked up and complaining about Openssl. So i'm like 'w/e I just updated guess i'll roll openssl back for a bit hurrrr' and didn't take into account that pacman itself uses openssl as a dependency. Moments later all the stuff in the repo is updated and pacman can't get it because I fucked up a .so it uses :-D

Manual reinstallation of openssl fixed it, did another pacman -Syu and grabbed everything again. all good now.
>>
>>60044747
It's functional programming!
>>
>>60050396
>>60050411
>>60050454
All that being said, it does suck that 'time of day' is a potential factor for fucking shit up when downloading from a repo lol
>>
>>60050468
in Haskell this is just

mapM_ print "print"
>>
>>60050411
>>60050454
>>60050477
I see. I'm on Arch rn and I had this kind of things happen in the past, so I use Snapper as a safety net, smooth as hell on Arch+btrfs. I use that until Guix can take over the work of both pacman and snapper.

>rolling back openssl
I wouldn't have. Now I know you're a big boy and you could manage it, but it's either rollback the whole update, or wait a bit or something. But in any case forward compatibility is a thing with ABIs, and pacman wouldn't have bricked itself alone IMHO.
>>
>>60050725
>rolling back openssl
yeah I saw the fruits of my mistake basically immediately. I'm sort of in a weird position now where updating again with -Syu would require me deleting the openssl stuff installed but..pacman needs that? it'll be fucking interesting thats for sure.

caaaareful using btrfs as a local drive. it's a great object store at large scale but it does dangerous things that are not good for reliability. Just had a coworker lose absolutely everything and then realize 'those aren't my files those are checksums of my files it's keeping'
>>
>>60050798
if you have a https mirror, openssl is used to talk with it AFAIK.

I see your point, I have a distant ext4 backup anyway. btrfs is probably the future though

>Just had a coworker lose absolutely everything and then realize 'those aren't my files those are checksums of my files it's keeping'
how the fuck did that happen?
>>
>>60050867
ah that makes sense why that'd be a dependency then. hopefully things go smoothly trying to update again later (maybe after the work day lol)

I'm not privvy to the specifics of how he configured btrfs but essentially what he thought was a backup of his filesystem was actually just checksums of his files and not the files themselves. My understanding was btrfs was intended to be used for object stores that scaled across lots of drives for redundancy i'm not to keen on what the shortcomings of it would as a standard drive for personal use but his experience seemed to be a big one
>>
why do I love R
it's a weird language with weird things but it's cozy as fuck somehow
maybe I've just been fooled by how good rstudio and cran are
>>
did we switch threads
>>
>>60052288
Yes, dipshit, this thread is at over 325 posts and page ten.
>>
>>60052334
bye
>>
>>60052526
>>60052526
>>60052526
>>60052526

new thread /g/uys
Thread posts: 330
Thread images: 42


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