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

File: K&R c.png (1MB, 1000x1400px) Image search: [Google]
K&R c.png
1MB, 1000x1400px
old thread >>57060394

What are you working on, /g/?
>>
Haskell is the ultimate language
>>
>>57068375
can the meme books stop?
>>
>>57068413
no
>>
>>57068413
the meme book is fine

i'm sick of the crossdressing programmer meme
>>
>>57068421
:((((
>>
>>57068426
t. pajeet
>>
>>57068426
niigga the opposite
>>
/dpt/ discord
https://discord.gg/mbRn7
>>
>>57068505
get out ircfag
>>
>>57068561
Well done anon
>>
I'm working with Django. I hate this framework.
>>
>>57068375
what do you guys think of processing?
>>
>>57068561
>somebody decided to save and repost that
>>
>>57068632
>processing
Could you have a term any more vague?
>>
>>57068632
I hate it.
>>
>>57068632
It's the kind of framework i'd rather learn how to write myself.
>>
>Frameworks are to libraries as inheritance is to composition
Opinions?
>>
>>57068660
Meaningless, but sounds about right.
>>
>>57068660
full of shit
>>
>>57068561

Oh hey, porn on a blue board...

In all seriousness though, fuck this meme. Being a crossdressing femboy does not make you a better programmer.
>>
>trap OP
ghci> succ it
>>
>>57068742
>Being a crossdressing femboy does not make you a better programmer.
There is a paper by Microsoft Research on this topic.
>>
>>57068742
Don't be jealous
>>
File: 1443500977688.png (835KB, 1200x1080px) Image search: [Google]
1443500977688.png
835KB, 1200x1080px
>>57068742
actually, yes, it does
>>
Hey guys, I'm thinking about the best way to make a hash tables where the hash function uses the middle-square method (on C++).

I was thinking of using an array to store the result of the square number and then eliminate the first and the last position until I only get the numbers I need. I actually don't know much about string functions, so I was wondering if there are some that could help me to eliminate or manipulate a character on n position.
>>
>>57068749
Truly now? How about you link it so that I can critique it.
>>
Hey guys, I want to get into web scraping.

What would be the approach for doing something like this?

https://www.freelancer.com/projects/Web-Scraping/would-like-hire-Web-Scraping-11782541/

Would I need to create different scraping logic for each different website or is there a way to generalize it?
>>
>>57068757
>>57068786
This has nothing to do with crossdressing.
>>
>>57068754
>python.org
As expected of snakefags.
>>
>>57068786
I'd probably use wget's mirroring mode and build a small set of shell scripts to extract the data.
>>
>>57068786
Yes, usually you will have to write a scraper for a single site.
You will even have more problems when one university will have many different kind of sites (for each faculty)
Some things you will be able to duplicate though.
>>
>>57068413
There's nothing wrong with K&R.
>>
>>57068426
no
>>
>>57068786
>42 scrapers for $150
Not even pajeet would do this.
>>
>>57068803

I want to make scrapers in Java. I already have some successful ones.

>>57068808

Thanks, I figured as much.

>>57068869

What would be the price for this many? Around $800-1000?
>>
>>57068757

So... you want to convert from integer to string and then back again to do hashing with the middle-square method? I feel as though there should be a more efficient method...

That said, take the length of the string, compute the range of bytes you're looking to operate on, and then use a substring function. If you're using a C string, you can get a substring from this by shoving a null byte at the end of the substring, and then using your strtol/atoi/whatever function on the original string pointer plus a couple of bytes. So if you had a char foo[11] holding some 10-digit number that is null terminated, and you wanted a 4 digit number, you could set foo[7] to '\0' and call atoi or strtol on &foo[3], or foo+3 for simplicity.
>>
In Java's abstract machine, what's the difference between an object whose static type is an Interface type and an object whose static type is a class type?
>>
Is K&R still the best book for learning C or has something better come along the way?
>>
>>57068904
I found Stephen Prata's C Primer Plus much easier to start with and read alongside K&R, although you might feel it's too slow
>>
What the fuck is up with the crossdressing programmer meme? Where did it come from?
>>
>>57068982
stupid trippinewfag
>>
>>57068993
I'm sorry, did the big bad tripcode trigger you?
>>
>>57069001
yes
take the bad man away
>>
>>57068389
fpbp
>>
>>57068982
Probably the same retard spamming negresses
>>
File: Capture.png (31KB, 1262x479px) Image search: [Google]
Capture.png
31KB, 1262x479px
>try to get into Endless Sky development since it'd be a good way to learn OpenGL and I want to make a star/planet shader for it
>get this problem
what do
>>
>>57069005
>unsheathes katana
>teleports behind you
Pssh, nothing personnel kid

>>57069016
negresses?
>>
>>57069020
install mingey double u
>>
>>57069027
But I did!
>>
>>57069033
do it again faggot
>>
>>57068884
>What would be the price for this many? Around $800-1000?
Something like that for reasonable quality I'd say. Assuming each one takes you 2 hours that's already burger flipping wage. A pajeet factory might do it for $2-300 but who knows what the result would look like.
>>
>>57069033
Fix your PATH.
>>
>>57069020
Install Linux.
>>
>>57068638
its a java based ide
>>
>>57068375
Trying to make an ALSA daemon.
Man it is easier reading the src than the docs, at least you kinda know what it does.
>>
>>57069072
wow
so informative

>>57069074
I very well might with how much Windows 10 bothers me.
I can't say I know how to use my sole USB stick to both hold files and perform an install though.
And I certainly don't know what distro to use.
>>
File: ahhh.jpg (18KB, 840x630px) Image search: [Google]
ahhh.jpg
18KB, 840x630px
i have to 'probe' a blackbox .p file using MATLAB

the black box is a method i can call using a seed and xy coordinates
in a range from both x and y in -15 to 15, there is a rectangle and i need to estimate the corners to 10^-5 accuracy
first thing i did was probing the whole area with 1 unit spacing (result matrix plotted in pic related)
now how would i approach this problem any further?
I thought about binary searching the areas around the first non-zero spot in the matrix
or recursively doing the probing in every edge area but i have some serious trouble doing the proper scaling

how would you approach this?
>>
>>57069094
what's that?
>>
>>57068786

>wget -r (...)
>gimme my $152
>ktnxbye
>>
>>57068506
>discord
>calls them IRCfag

but why anon
>>
>>57069144
>>>/g/wdg
>>
>>57069114
>wow
>so informative
Definitely don't google "what is PATH" then.
>>
>>57069173
You can't Google acronyms.
>>
>>57069187
I googled your boipucci faggot
>>
>>57069165

>wget
>programm written in C by the GNU software foundation
>/wdg/

ftfy
>>
File: Capture.png (52KB, 863x734px) Image search: [Google]
Capture.png
52KB, 863x734px
>>57069072
>using acronyms that are only possible to identify by people who already know them to give advice to someone
>if they knew what you were talking about they wouldn't need the acronym
>>
>>57069248
>wget
>starts with w, has a g

>wdg
>starts with w, has a g
>>
>>57069253
*wouldn't need the advice
>>
>>57069256

>what the fugg
>starts with w, has a g
>>
>>57069272
>>>/g/wdg
>>
File: Untitled.png (58KB, 874x533px) Image search: [Google]
Untitled.png
58KB, 874x533px
>>57069253
PATH is not an acronym though, it's just capitalized.
>>
FINALLY beginning to understand non-static references

Took me forever to figure it out, but you just have to instantiate it with an object reference then call it as [object name],[non-static variable]

Starting to regret not going the CS route desu
>>
Explain to me why LISP is bad.
>>
>>57069288
Shitty type system
Shitty syntax
Unnecessary uses of macros
Shitty community
I could go on
>>
>>57069280
So what happened was:
>anon shows path issue
>other anon says "fix your path"
How retarded is this board?
>>
I suck major donkey dick at math, what am I doing wrong

Target = 793;
Current = 792;
Increment = (Math.abs(Player.target_x % 2 == 0) ? (4) : (3));

if(Current + Increment > Target)
Current + (((Current)+Increment - Target)-Target)
>>
>>57069303

>google "what is path"
>read links
>profit

>google "fix your path"
>read links
>profit

I wonder how anon managed to ask his question in the first place.
Maybe programming is not the right choice for everybody..?
>>
>>57069341
>fix your path
>when the files which are supposed to be there are completely nonexistent
>>
>>57069330
What are you trying to do? Also, depending on the language, the body of the if statement is storing or calling anything.
>>
ASM
>what if everything was registers
C
>what if everything was ints
C++
>what if everything was classes
D
>what if everything was compile time
GO
>what if everything was not present
BASH
>what if everything was pipes
HASKELL
>what if everything was lazy
RUST
>what if everything was [insert paradigm]
LUA
>what if everything was tables
PYTHON
>what if everything was anything
LISP
>what if everything was lists
JAVASCRIPT
>what if everything was everything
MATLAB
>what if everything was matrices
LOGO
>what if everything was turtles
JAVA
>what if everything was objects
PHP
>what if everything was hell
>>
>>57069354
Moving a ball in canvas, if the target X is even then I increase it by 4 otherwise by 3, if increasing by 4 or 3 would go outside the canvas I try to get the difference or something but it always comes off wrong
>>
>>57069288
somehow more useless than haskell
>>
>>57069360
>>what if everything was [insert paradigm]
Err...
>>
What's heavier: A thousand feathers or a thousand rocks?
>>
>>57069187
Good thing it's not an acronym and the first result on google then.
>>
>>57069373
Now that I look it up, I see that PATH is a system variable which specifies paths...
For command prompt.
You are giving command prompt advice for an IDE.
>>
>>57069418
Java
>>
>>57069366
>Moving a ball in canvas, if the "target X" is even then I increase the CURRENT one by 4 otherwise by 3


typo
>>
>>57068609
Why?
>>
>>57069360

>Java
>What if everything was objects
No, that would be Ruby. Java has primitives. Ruby doesn't.
>>
If you seriously can't google your way out of a cardboard box why are you even trying to learn programming.

>>57069442
Google harder.

>>57069303
Anon did not know that it was a path issue. He is asking why can't it find the binaries I have already installed.
>>
>>57069418
What classifies as a rock?
Does a grain of sand count?
>>
>>57069467
>already installed
>program files folder has been gutted
It might be a pathing issue, but it'd be a very odd one.
Clearly, some things were installed there since pretty much no software creates folders without creating files, and then god-knows-what has happened to the installation.
Search engines only tell you how to solve obvious problems.
>>
Can someone tell me why my this bash script outputs 2 different answers depending on whether I use a variable or type in the characters manually.

#!/bin/bash

arg=letters+7
cut_arg=$(echo $arg | cut -f 1 -d +)

echo arg: $arg
echo cut_arg: $cut_arg

if [[ $(echo $arg | grep -E '(letters)(\+)([0-9]{1,})') == letters+7 ]]; then
match=true
else
match=false
fi
echo result using characters: $match

if [[ $(echo $arg | grep -E '($cut_arg)(\+)([0-9]{1,})') == letters+7 ]]; then
match=true
else
match=false
fi
echo result using cut_arg variable containing the same characters: $match


and the result:

arg: letters+7
cut_arg: letters
result using characters: true
result using cut_arg variable containing the same characters: false
>>
File: 1476365113878.jpg (99KB, 1280x720px) Image search: [Google]
1476365113878.jpg
99KB, 1280x720px
What should I code for my birthday?
>>
>>57069533
make a drawing that could be considered artistic programmatically
>>
>>57069522
He literally said he already installed mingw.
>>
>>57069527

You should encase variables in double quotes like this everywhere.

echo arg: "$arg"
>>
>>57069573
Which is why the mingw folder is there.
For there to be a folder there must have been files.
Assuming that anon didn't tamper with mingw in any deliberate way, something removed those files by itself.

Honestly, the best thing to do might be to just uninstall everything then reinstall it, because this seems like one huge convoluted mess.
>>
File: :- .png (8KB, 551x153px) Image search: [Google]
:- .png
8KB, 551x153px
Friendly reminder that Ruby is fucking retarded and doesn't know the difference between the .NET Framework and .NET Core.
>>
File: kys.jpg (37KB, 600x600px) Image search: [Google]
kys.jpg
37KB, 600x600px
>mfw ASPajeets think they matter
>>
>>57069533
Oh shit, anon, my birthday is tomorrow!

We should fuck.

I'll be writing the data model for a basic RPG inventory system.
>>
Hey, how might I go about moving a CodeBlocks project to Geany?
Can I get Geany to just recognise the source folder as being its own?
>>
File: shock.jpg (141KB, 550x412px) Image search: [Google]
shock.jpg
141KB, 550x412px
when a webdev talks to you like he's on your level

it's cute

they think they're people
>>
>>57069600
>he hasn't filtered ruby

how do you even deal with that obnoxious faggot that keeps pretending he knows his shit
>>
>>57069600
CoreFX != .NET Framework
But the .NET Framework is open source anyway.
>>
>>57069462

This.
>>
File: hY9sZMc.png (2MB, 1673x824px) Image search: [Google]
hY9sZMc.png
2MB, 1673x824px
>>57069592
Thanks for the advice. I looked up why incase anyone's interested:
>http://stackoverflow.com/questions/10067266/when-to-wrap-quotes-around-a-variable
Although, it still doesn't work, sadly. here's the changed code if it matters:

#!/bin/bash

arg=letters+7
cut_arg=$(echo "$arg" | cut -f 1 -d +)

echo arg: "$arg"
echo cut_arg: "$cut_arg"

if [[ $(echo "$arg" | grep -E '(letters)(\+)([0-9]{1,})') == "$arg" ]]; then
match=true
else
match=false
fi
echo result using characters: "$match"

if [[ $(echo "$arg" | grep -E '("$cut_arg")(\+)([0-9]{1,})') == "$arg" ]]; then
match=true
else
match=false
fi
echo result using cut_arg variable containing the same characters: "$match"


result:

arg: letters+7
cut_arg: letters
result using characters: true
result using cut_arg variable containing the same characters: false
>>
>>57069647
Sure, where do you live?

Although I have to admit that I'm not that into coding yet. I recently began studying C++ and started to lurk these threads in hopes of picking something up.
>>
>>57069675
>But the .NET Framework is open source anyway.
No it isn't, you dumb faggot.

>.NET Framework
This is the "classic" .NET that comes installed on Windows. The source has not been released.

The .NET Framework is not FOSS.

>.NET Core
This is a SUBSET of the .NET Framework. It's a lightweight piece that you ship with your software to whatever OS you're deploying to. This is NOT the .NET Framework.

.NET Core is FOSS.

>Mono
An open-source implementation meant to essentially copy what the .NET Framework does. It's extremely close to the .NET Framework in functionality, because Microsoft has paid employees contributing to Mono (primarily because they own Xamarin now).

Mono is FOSS.

Xamarin and its components are also FOSS.

.NET Framework != .NET Core

>>57069684
Texas.

You should learn C# for a first language. C++ isn't bad, but there are better options that won't make you hate programming.
>>
>>57069684
>started to lurk these threads in hopes of picking something up
Sorry to disappoint, but you'll only find assholes and memes here. Although it might spark your interest in less used languages like forth, lisp, idris, haskell, etc.; lurking won't do you much good unless you actually read a lot too.
>>
>>57069659
>Implying I am human
>Implying you're not NPCs
>>
>>57069716
Not that anon, but i have occasionally received very helpful advice from /dpt/. Although not since i started lurking regularly. /dpt/ seems to have gone to shit since then. This correlation worries me.
>>
File: emoji.png (2KB, 45x45px) Image search: [Google]
emoji.png
2KB, 45x45px
>>57069330
Fucking hell managed to do it after a long-ass time, now this is a piece of code I hope I'll never see again because it's an absolute mess


        Increment_X = (Math.abs(Target_X % 2 == 0) ? (4) : (3));
Increment_Y = (Math.abs(Target_Y % 2 == 0) ? (8) : (7));
Log('X: %s/%s, Y: %s/%s -> %s ~ %s', Current_X, Target_X, Current_Y, Target_Y, Increment_X, Increment_Y);

if (Current_X === Target_X)
Target_X = -1;

if (Current_X + Increment_X > Target_X && Current_X - Increment_X < Target_X)
Increment_X = (((Current_X + Increment_X) > Target_X) ? ((Current_X + Increment_X) - Target_X) : (-(Current_X + Increment_X) - Target_X))
if (Target_X > -1) {
if ((Current_X + Increment_X) > Target_X)
Current_X -= Increment_X;
else
Current_X += Increment_X
}
>>
>>57069784
what the fuck are you trying to do
>>
>>57069824
I have a ball object, it has Current_X/Y coordinate and a Target_X/Y

I want to move it around a canvas when Target_X/Y changed and is higher than -1 (default)

If Target_X/Y is changed when the ball is still moving to the original destination I want it to go back/to the new coordination

That's it, the code I posted is inside a loop running every frame
>>
So how to make a P2P game?
>>
>>57069866
>P2P
Peer to peer?
Pay to play?
Penis to penis?
>>
>>57069872
yes
>>
>>57069872
Like seriously of course it's pay 2 play. I really hate humans you see
>>
reminder that quicksort is the best sort
>>
>>57069911
reminder that std::sort is faster than qsort
>>
Hey, guys!
I'm studying programming and we learn really useless things like sorting arrays and searching in lists. What should I learn myself if I want to be a web developer?
PHP and frameworks? Python? Ruby on rails? JS?

What about Linux? Would it be good to try it an learn how to use it?
Which books or courses do you suggest?
Sorry for asking platinum questions, but you left no annotation.
>>
>>57069957
10/10 bait, almost fell for it.
>>
>>57069957
>plantinum
what
>>
File: 1459418245861.png (335KB, 1280x720px) Image search: [Google]
1459418245861.png
335KB, 1280x720px
>>57069957
>we learn really useless things like sorting arrays and searching in lists
10/10 it was Rasmus-tier.
>>
File: really makes you think.webm (325KB, 1158x854px) Image search: [Google]
really makes you think.webm
325KB, 1158x854px
>>57069784
>>57069824
How can you guys even hope to compete with this???
>>
>>57068426
Give fifty (50) good reason why.
>>
>>57070056
>I'm not a cute boy so I'm jealous
>>
/dpt/-chan, daisuki~

>>57069911
>unsafe

>>57069709
http://sourceof.net/

>>57069533
A linux daemon that will summon you on your next birthday.

>>57069288
Lisp is so powerful that problems which are technical issues in other programming languages are social issues in Lisp.

>>57068982
Rust

>>57068904
C primer plus

>>57068899
Probably none. (except that one due to a flaw in the java standard.)

>>57068845
It's a decent manual for c89 at most.

>>57068660
A library is used by your code
A framework uses your code.

>>57068632
>DSL

>>57068389
No.

>>57068375
Thank your for using an anime image.

>>57068375
>What are you working on, /g/?
/r/dailyprogrammer 287 easy (pic)
>>
>>57070076
THAT'S THE REFERENCE SOURCE, NOT THE SOURCE CODE OF THE FRAMEWORK YOU DUMB CUNT

FUCK YES I MAD
>>
File: klabni.png (165KB, 632x765px) Image search: [Google]
klabni.png
165KB, 632x765px
>>57070084
it's not the _entire_ source but the source codes of wpf and winforms are present.
>>
>>57069288
It's not.

>>57069296
>Shitty type system
types are a meme. gb2hasklel
>Shitty syntax
it's homoiconic and unambiguous. your ungoogleable symbolic math circlejerk is even worse
>Unnecessary uses of macros
there are very few cases that actually demand macros. they're mostly a crutch for people who don't understand closures or eval
>Shitty community
not an argument
>>
>>57070105
>it's homoiconic
What did he mean by this?
>>
>>57069296
lmfao you have no idea what you are talking about.
>>
>>57069462
smalltalk doesn't exist? stop trying to force your meme hipster language that no one will use in five years
>>
Man, alignment and casting compatibility is bullshit. I wish I could just read and write arbitrary locations in the memory and cast them to whatever type I want that I know works out on the byte-level, without the compiler warnings throwing a fit
>>
>>57070138
This guy.
>>
>>57068375
>What are you working on, /g/?
Trying to understand what std::forward is for. No success so far.
>>
>>57070161
std::forward turns named rvalue references into rvalue references and named lvalue references into lvalue references.
>>
https://news.ycombinator.com/item?id=2235281
First reply made me cry
>>
>>57070214
hmm, article is dead
there are some smart people on hn but "ha ha x sure is difficult am i right" gets old
>>
Is there a difference between the following two Java methods:

<T> void f(I<T> s) { }

void g(I<?> s) { }
>>
>>57070368
What is the first one? What is <T> void?
>>
File: dad_of_the_year.webm (2MB, 1335x720px) Image search: [Google]
dad_of_the_year.webm
2MB, 1335x720px
>>57070368
i am not sure but i think that, with the first one, you can reuse the type inside the procedure.

<T> void f(I<T> s) 
{
T t = ...;
}
>>
first for Objective - C
>>
ORMs and query builders. They take your code, probably stored as nodes of some kind, covert into a SQL string, then you send that string to the database so it can parse it, probably into an AST and then use that to produce results.

Can't we just skip the part were it gets turned into a string and parsed back?
>>
>>57070432
You can but it's a convenient way for ORM programmers to write the glue between ORM and the database.
>>
>>57070182
Why would you turn an rvalue reference into an rvalue reference? That's crazy.
>>
How are generic functions in Java implemented? How does the generic function know where to find the methods of the passed type?
>>
>>57070484
That's not what I wrote.
>>
File: 648.jpg (64KB, 1280x720px) Image search: [Google]
648.jpg
64KB, 1280x720px
>>57070486
the compiler generates a method for the passed type on the fly
>>
I use Digital Mars C compiler is this bad?
>>
>>57070530
Why not clang/llvm?
>>
>>57070548
too mainstream
>>
>>57070486
>>57070508
I'm pretty sure type information is erased for compiled functions, at least that's how it was for Java7.
>>
>>57070641
that's why it's done at the java compiler level, not at the jvm level.
>>
>>57070548
I'm on Windows and the Digital Mars one just werked without all the Cygwin shit

Should I be using Clang/LLVM?
>>
>>57070671
Sorry windows user.
>>
>>57070655
Well, Java compiler erases type information. In the .class file there is only one version of a generic function (unlike with C++ where for each generic variation the compiler generates a different function).
>>
>>57070671
>I'm on Windows
My apologies.
>>
For class, one of my labs involves minor base conversion; going from base 10 to another base between 2 and 9 for 4-digit numbers. The math itself was easy to do, but the professor included a variable called maxNumber that's supposed to do something to prevent a number from going over the limit; i.e., 1111 in base 2 = 15 in base 10, so if a user wants to convert to 30 in base 10 to base 2 the most they'll get is 1111 since that's all 4 digits in base 2 can hold. This seems really straightforward because the first thought is to just use a conditional/loop, but since we "didn't go over" loops or conditionals in class, we can't use them in this lab.

How do you have this kind of sentinel value without using a conditional?
>>
>>57069866
>>57069872
I'm willing to help with the third option.
>>
>>57068375
who is this demon druid?
>>
>>57070716
Math.min could probably work although it seems insane to do programming without loops and conditions.
>>
>>57070738
K&R
>>
File: Untitled.png (5KB, 719x392px) Image search: [Google]
Untitled.png
5KB, 719x392px
>>57070671
If you want to use clang on Windows I suggest installing msys2, install clang via pacman, add the msys2 bin to your path, you can now call clang from anywhere, it will make native Windows binaries and you can't call *nix functions/heders. If you need *nix stuff you'll need cygwin and you'll need to ship it with a cygwin dll or compile it in.

http://msys2.github.io/
>>
>>57070091
Is this how you avoid blatantly admitting that you were straight-up wrong?

Just move the goalpost and say "Well, these OTHER small components of the entire concept meet the criteria, so I'm partially right!"?
>>
What happened to the literate programmer you could ask anything to?
>>
>>57070840
Ascension.
>>
>>57070716
can you use bit operations? you'd be using a conditional in some sense but still
>>
class X<T extends C1> {
public T f;
}

class Y extends X {
public Y() {
this.f = new C1();
}
}

class C1 { }
class C2 extends C1 { }

class Main {
public static void main(String[] args) {
Y y = new Y();
X<C2> x = y;
C2 c = x.f;
}
}


>This is a runtime error in Java
>>
>>57070798
what reference source doesn't have excepting the deprecated stuffs from vista/xp ?

>>57070840
he ded
>>
>>57070743
It's a bit crazy, yeah; we basically should have been past conditionals, loops, and bitwise operators but the Trump/Hillary debate and the two jewish holidays really put us behind. Math.min() implementation returned 15 instead of 1111 - on the right path, but not what I'm supposed to print.

>>57070919
Nope, since bitwise operators are going to be introduced to the class in the next chapter. I'm already working on the next lab and life is just that much easier.

This one part of the lab in question is the only thing that's not done. I already sent the professor an email for more clarification but I'm just considering taking a point hit on that lab just to move on.
>>
File: homer.webm (50KB, 500x375px) Image search: [Google]
homer.webm
50KB, 500x375px
my header files are in a separate folder.
../include/foo.h

how do i tell gcc to include them like
<myproject/foo.h>
_without_ having to have an additional subfolder like
../include/myproject/foo.h
>>
>>57070977
can you use a square root function? you can write the min of two numbers a, b in terms of a, b, and |a - b|. and you can disguise |x|, which of course is a conditional, as sqrt(x^2)
>>
>>57071031
symlinks desu
>>
Anyone else pulling an allnighter for work or school?
>>
>>57071082
I'm too old for this shit.
>>
>>57071091
I'm at a startup in my 20's. Today was supposed to be my day off. I realized I have too much coming close to the deadline.
>>
>>57068632
It's good for arduino and maybe for introducing kids to programming. Outside that it's fuckn useless.
>>
>>57071037
Yeah, since we're using POOINLOO (Java), I can use Math.sqrt() since we went over part of the math library. I think he'll take issue to working around it, though; he likes the class to stick as close to the curriculum as possible.

>>57071082
I kind of miss the days. I probably wouldn't if I had to actually do them again and often.
>>
File: 8899898990908778.jpg (7KB, 173x96px) Image search: [Google]
8899898990908778.jpg
7KB, 173x96px
Can someone explain why this doesn't output 0?
>>
>>57068786
There are a number of frameworks for this kinda thing.

You could use nutch, which has Frontier managment and all that shit built in

Scrapy is good too.

If you want a somewhat ghetto method of doing it get a server with PHP on ot and use Querypath to scrape the content you need. This is probably the simplest option.

And yeah, with most of these, unless you're just parsing out text and nothing else you're gonna have to look at the HTML for each page and figure out what to pull.
>>
How can I pick a random word from a list of words in java?

import keytools.Konsoll;
/* ^ Reads numbers and characters */

public class FoodPicker {

public static void main(String[] args) {
int foodAmount = Konsoll.readInt("Type in amount of dishes");
String [] row = new String[foodAmount];
for (int i=0;i<foodAmount;i++) {
rekke[i] = Konsoll.readLine("Type in dish "+i);
}
{
System.out.println("Your meal for today is: ");
}
/* I want to print out a random food item here */

}
}
}


Code looks terrible atm, but you should get the gist of what I'm trying to do.
>>
>>57071157
Shifting a 32-bit value by 32 bits or more is undefined in C and C++. One of the reasons it was left undefined is that on some hardware platforms the 32-bit shift instruction only takes into account 5 lowest bits of the supplied shift count. This means that whatever shift count you pass, it will be interpreted modulo 32. Attempting to shift by 32 on such platform will actually shift by 0, i.e. not shift at all.

t. stackoverflow answer
>>
>>57071147
>I kind of miss the days. I probably wouldn't if I had to actually do them again and often.

It's definitely interesting. I'm on a team of 3 engineers including myself and it's definitely an experience. From building the product and to hiring.
>>
>>57068375
what are some programs C is good for that scripting languages aren't? i want an excuse to use C so i can learn it
>>
>>57071168
http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#nextInt(int)
>>
>>57071200
kernel
hardware drivers
other boring shit
>>
>>57071200
baremetal.
otherwise, none.
>>
>>57071200
gaymemes
>>
>>57071031
Use the -I flag

For example:
-I"myproject/include"
>>
>>57071200
Do you want to write kernels, drivers or work with embedded systems? If not then C is pretty much wrong choice for anything else.
>>
File: stargazer.gif (924KB, 500x281px) Image search: [Google]
stargazer.gif
924KB, 500x281px
>>57071251
>>57071214
>>57071226
>>
i need a picture of a sad dennis ritchie
>>
>>57071200
>>57071269
You could learn C to get a better understanding of the fundamentals. That excuse is always valid.
>>
>>57071326
fundamentals of what ?
>>
File: New Piskel.gif (9KB, 32x32px) Image search: [Google]
New Piskel.gif
9KB, 32x32px
>>57068375
what is the best thing i could do to learn programming for real? what course or what resource is the best? i only need access to the courses or study materials 24/7 & a tutor or teacher who can answer my concerns.
>>
>>57071332
Programming and computer memory of course, silly.
>>
>>57071341
i forgot to add that i tried codecademy and all i can say about it is that there are some sad memes out there
>>
>>57071332

Programming. C is the distilled essence of programming. You've got primitive types, compound data types, memory management, and a shitty macro system.

That's pretty much all there is to it.
>>
>>57070091
>then i grew up
he wrote unironically on Twitter while disregarding the rules of English regarding capitalisation of words.
>>
>>57071341
Do you have any projects? Ideas you want to be real? I yes, just do it.
>>
>>57071365
The macro system is indeed shitty.
>>
File: just do it.jpg (296KB, 576x1024px) Image search: [Google]
just do it.jpg
296KB, 576x1024px
>>57071378
>>
>>57071382

Nothing will ever compare to LISP macros.
>>
>>57071393
Am not familiar with LISP.
>>
>>57071347
>>57071365
lel, no. C misses a lot of basic concepts like closures, tuples, high order functions, overloading, pattern matching, type inference, ... c sucks at the most important concept of computer science: abstraction.
>>
File: ss (2016-10-14 at 04.51.23).png (46KB, 653x783px) Image search: [Google]
ss (2016-10-14 at 04.51.23).png
46KB, 653x783px
https://archive.fo/0D1fU
>a video about recent developments in what is pretty THE compiler for the language by one of its co-creators posted on a forum dedicated to the discussion of said language
>literally ALL of the comments are off-topic
Why is the Haskell community so shit?
>>
>>57071414
>computer science

The most important concept of PROGRAMMING is hardware interaction.
>>
>>57071226
>>57071236
>>57071251
Since when has been /dpt/ so shitty?
>>
>>57071449
Since i became a regular.
>>
>>57071414
>basic concepts like closures, tuples, high order functions, overloading, pattern matching, type inference

Functional fags get out, reee
>>
>>57071200
Software that runs fast. Software that uses an appropriate amount of ram.
>>
File: file.png (9KB, 273x201px) Image search: [Google]
file.png
9KB, 273x201px
I don't understand how it's possible for a calculation to return NaN

What does that even mean? I'm not even doing any abstract calculations
>>
>>57071458
Those are not basic concepts.
That's like saying Shakespeare is basic English.
>>
>>57071200
>>57071459
This. If speed matters, C is almost the only viable option. Else any language would be fine
>>
>>57071452
t-thanks ( ´_ゝ`)
>>
>>57071463
division by zero
>>
>>57071463
0/0?
>>
>>57071472
"core" concepts, then. is symbolism a basic concept in literature? you can make books without it so maybe not, but it is "core" to understanding most works with any value to them
>>
>>57071472
i won't disagree with your conclusion, but please do not use analogies

analogies are pure deceit
>>
>>57071463
Look at the I triple e spec. NaN is returned in certain circumstances.

If you're a bit too lazy to chew though that then here's a slightly damaged person explaining it to you:
He mentions the nan specifically
https://youtu.be/97bxjeP3LzY
>>
>>57071414
>c sucks at the most important concept of computer science: abstraction
The fact you learned it was important doesn't mean it is.
>>
>>57071476
A subset of c++ also work.
>>
>>57071476
Except why would you get rid of safety belts and airbags when you can use C++ and Rust with zero cost abstractions when applicable?
>>
>>57071492
>For sufficiently high pretentiousness of 'value'.
fixed it for you
>>
>>57071515
Because they're poorly established, they don't provide the tools you need to write performing code, have poor compiler optimization support and their designers do not understand performance programming whatsoever. (so they are at risk of being made dumb and useless)
>>
>>57071511
>>57071515
Why do you want so much to hide how your program works? Is it just too shitty?
>>
>>57071515
Why use Rust when you can use <dead language nobody uses> instead?
>>
>>57071472

I know, I'm accusing the guy who suggested them of being a functional fag, because that's what functionalfags like to talk about.

I'm surprised he wasn't upset about C's lack of monads.
>>
>>57071532
Not all of c++ hides things that way.
>>
>>57071519
t rasheed
>>
>>57071511
This.


Using Sepples does not mean going full OOPinLoo. You can write C like usual and use more features when you need them. Just look at kernel/list.h and std::list, I know which I'd choose.

>muh linking/bindings
extern "C" {}
exists and does not prevent you from using C++ inside
>>
>>57071501
yeah I'm doing some linear algebra. Speaking of which, I could use doubles for this calculation but I don't really know what the effect would be as far as performance goes.
>>
>>57069137
An daemon to get ALSA Mixer stuff, for example, when I lower the volume a notification appears.
Doing it for learning stuff.
>>
>>57071583
>Just look at kernel/list.h and std::list
I hope you're just meming.
>>
>>57071617

If C allowed method syntax, that'd be super cool.
>>
>>57071583
So you are using extern for any chunk of code that matter? What about removing all the crappy bloating and keeping your code simple instead.

>>57071422
>Why is Reddit so shit
I wonder..
>>
>>57071592
Interesting.

I think my next project will have to be how to interact with ALSA. ALSA is the canonical way of playing sound on Linux, right?

I'm currently working on learning how to work with WASAPI.
>>
>>57071641
My code is not simple because my problems are not. Not that a fizzbuzzer like you would understand.
>>
>>57071532
It's not about hiding but more about convenience.
>>
>>57071674
>My code is not simple because my problems are not.
Is this the new maymay excuse for writing shitty code?
>>
>>57071583
Yeah don't reply to me pretending you agree. Don't use any std stuff. We're talking about a _very_ limited subset. If you want to be a decent programmer.
>>57071587
Approximately half the throughput. Which wouldn't be a large issue most of the time. But introducing doubles and floats in the same environment can be problematic. Because for most programmers double & float conversions is just a backdrop warning. It's not something which triggers deeper consideration.
>>
>>57071692
>interfacing with C means writing shitty code

uhhh
>>
>>57071634
>method syntax
He's mental guys. Let's just ignore him.
>>
>>57071707

Rust does it :)
>>
>>57071674
Your problems are not simple because you created your own nonsensical bubble with memes and apathy.
>>
>>57071699
OOP always mean shitty code.
>>
>>57071699
I never said that. Read the part i quoted.
>>
>>57071695
>limited subset.
>If you want to be a decent programmer.

Ohh, you're one of these """"minimal""" faggots. Enjoy your 1% faster code that took 1000% longer to develop.
>>
>>57071707
but method syntax is nice. It may be one of the few nice things to come out of oop.
>>
>>57071644
Yes. You can control directly the PCM. A bit of advice when dealing with ALSA get some examples. The alsautils code has some starting point, because the lib documentation is just what the function does in a single line and its arguments, no remarks whatsoever.
>>
Perl newbie here, do you think it's possible to write hex output as bytes to a binary file rather than text string? I'm using this script to get hex from base64:

#!/usr/bin/perl -w

use MIME::Base64;

my($base64Val) = '';
my($byteVal) = '';
my(@hexArr) = ();
my($hexVal) = '';

if(scalar(@ARGV) == 0) {
print STDERR 'Getting the base64 value...' . "\n";
$base64Val = "___BASE64_REPLACE_ME___";
}#End if
else {
$base64Val = $ARGV[0];
}

open(FH, '>', 'C:\OUTPUT.TXT') or die "cannot open file";
select FH;

print STDERR 'Value found: ' . $base64Val . "\n";

$byteVal = decode_base64($base64Val);

$hexArr = unpack 'H*', $byteVal;
$hexVal = join '', $hexArr =~ /../g;
print $hexVal . "\n";

close FH;
print STDERR 'Done. Press ENTER to quit.' . "\n";
<>;
>>
>>57071753
Minimal also means shorter time to code. Only more time is spent thinking.
>>
>have python code
>code werks but it's slowwwww
>it's slow as shit because I was brain-lazy during first implementation and just used loops all over the place
>decide to optimize in the most critical areas
>one function is particular offender
>loops over list of 500 elements, and over all pixels in a quarter HD (960x540) image; later on loops over all the pixels again
>looping a second time unavoidable because some shit happens to the entire array in between
>decide to turn those sub-routines into single line monsters
>reduce first one to vectorized single-liner that only loops over the 500 element list and nothing else
>define small test image and list (list = 4 elements, test image = 24 pixels)
>run %timeit on subroutine #1 with test data
>down to 100 us for first subroutine (previous: 160+ us)
>nice, I got this
>second subroutine is basically inverse of first
>indexing more difficult, takes some brain grease
>finally manage to smash it into a one-liner looping only over the 500 element list again
>run %timeit on the second subroutine with test data
>now takes 3 times as long as before (100 us instead of 30 us)
fug
1 hour wasted
FUG

A-at least they are aesthetic, r-right?
def subroutine1:
return np.array([np.median(img[np.where(segs == seg)], axis=0) for seg in range(np.max(segs) + 1)], dtype=np.uint8)

def subroutine2:
return np.sum([np.dstack([segs == seg, segs == seg, segs == seg]) * LUT[seg, :] for seg in range(LUT.shape[0])], axis=0)

(img has dimensions <height x width x 3>, segs has dimensions <height x width> and LUT has dimensions <np.max(segs), 3>)
>>
>>57071813
>A-at least they are aesthetic, r-right?
no
>>
Just ordered Learn You a Haskell for Great Good, paperback. Did I do good?
>>
>>57071813
what
>>
>>57071836
>Learn You a Haskell for Great Good
>>
my university's computer science course is so gimped by bending assbackwards to not force students to run linux. there's only 1 other guy who has linux on the laptop he brings to class. other than that it's a 50/50 split between mac and windows
>>
>>57071855
what do you mean by computer science
i develop on a mac and it's great
>>
>>57071813
def subroutine1:
return np.array([np.median(img[np.where(segs == seg)], axis=0)
for seg in range(np.max(segs) + 1)], dtype=np.uint8)

def subroutine2:
return np.sum([np.dstack([segs == seg, segs == seg, segs == seg]) * LUT[seg, :]
for seg in range(LUT.shape[0])], axis=0)
>>
>>57071855
maybe it doesn't matter for what you guys are studying at this moment
>>
is being 20 too late to start programming?
>>
>>57071882
it's been 3 years
>>
I am trying to understand OOP.

I have a simple python script which has a bunch of functions that are derived from one another. For example, let's say one of my functions gets all news articles from one site and returns them, and another function takes that array as input and returns one specific type of news article. I'm just doing this with simple functions.

If I wanted to implement this in an OOP fashion, how would I go about it? Is there a point?
>>
>>57071877
Any reason why you copied that and added two line breaks and some whitespace?
>>
>>57071855
OS quite literally does not matter until you get past fundamentals

>>57071892
No. Use google.
>>
>>57071892
Unless you have developed Korsakoff's syndrome you should be good.
>>
>>57071897
>take functional code
>gimp it to fit some design pattern
is this the power of OOP?
>>
>>57071911
i've never heard of this in my life until yesterday and now i see another person mention it today
>>
>>57071916
I know, memes, etc., but I'm trying to learn.
>>
>>57071897
>I am trying to understand OOP.
There is nothing to understand. Just a bunch of programmers monkey trying to justify their salary
>>
>>57071932
it does make code more reusable though
>>
>>57071932
I don't care, I want to learn it so I have a greater understanding of programming in general

I guess I'll just post in the evening when people with jobs are around
>>
>>57071944
Yes, so you never have to actually understand what you are doing. Great.
>>
>>57071970
companies don't care if their employees are familiar with every nook and cranny of their enormous systems, josh
>>
>>57071897
i think trying to force it where it's not going to help is going to be actively harmful for you
read the Gang of Four book
>>
>>57071897
That's just piping.
The thing that makes OOP what it is is this:
You can have an object (collection of attributes and methods) that run on this data), then you can derive other objects from that one that inherit some or all of its attributes (data) and / or methods (functions) and add additional ones.

So say I have an object Mammal with the Attributes
>leg_number
>shoulder_height
and the methods
>eat(){}
>shit(){}
>fuck(){}
Note that none of these have anything in their definition; they're placeholders and will be overwritten by the objects that inherit those attributes and methods.

Now I can define objects that inherit those traits:
Object Cat extends Mammal
attributes
>leg_number = 4
>shoulder_height = 20
>name = "Mr. Twiggles"
methods
>eat(Food Meal){ ... }
>shit(){ ... }
>fuck(Cat Partner){ ... }
>scratch(Mammal Target)

Object Human extends Mammal
attributes
>leg_number = 2
>shoulder_height = 150
>name = "NORMIE"
methods
>eat(Food Meal){ ... }
>shit(){ ... }
>fuck(Human Partner){ ... }

Object Human extends Mammal
attributes
>leg_number = 2
>shoulder_height = 150
>name = "NORMIE"
methods
>eat(Food Meal){ ... }
>shit(){ ... }
>fuck(Human Partner){ ... }

Object Anon extends Human
attributes
>leg_number = 2
>shoulder_height = 130
>name = "Anon"
methods
>eat(){ ... } // only type of food supplied is Hot Pockets
>shit(){ ... }
>fuck(Mammal Partner){ ... }
>>
>>57071414
>basic concepts
>tuples
no, by basic they meant CPU level things like memory.
>>
>>57072017
It's way too early for him to read GoF.
>>
>>57072055
probably you're right
i just can't think of anything else
>>
>>57072033
Is this the power of OOP?
>>
>>57072033
>>57071897
To add to that:
Obviously any attributes or methods that are inherited, but not overwritten, are preserved. Say we define an object "LonelyAnon" that looks like this:

LonelyAnon extends Anon
attributes:
>
methods:
>fuck(){}

Then its number of legs, shoulder height, default name and shitting and eating habits will be the same as those of Anon, but it won't fuck anything because the fuck method was overwritten with an empty function. The other attributes and methods are inherited from Anon, and preserved.
>>
What's the best Haskell book?
>>
Can someone explain to me exactly what a compilation unit or translation unit is? My understanding of it feels rather hazy.
>>
>>57072033
what
>>
>>57072083
>not using an
IFuckable
interface
>>
>>57072121
Quick, post the OOP picture. You know, the one with the diagram how it should be, and how it actually is.
I will never not laugh at "Leggable", even typing this I'm giggling like an idiot.
>>
> sitting at work
> software devving
> guy leaving
> throws a goodbye into the office
> everyone responds
> deeply concentrated, I react late
> "Hello!"
> everyone looking at me
Kill me please.
>>
>>57072168
this made me laugh somehow. sorry
>>
>>57072168
I feel you, man.

Earlier while I was taking a piss, a notoriously liberal co-worker walked up to a nearby urinal, flushed it, and (I thought) said
>Fucking colored men can't even flush the toilet.

I was taken aback, and responded something like, "Uh, yeah, I've noticed that too. I'm actually really fucking surprised you'd call out our token programmers like that."

He responds
>Anon, I said GROWN men.

>mfw I misheard him and he probably knows I'm racist now
>>
File: oop p2.png (57KB, 682x473px) Image search: [Google]
oop p2.png
57KB, 682x473px
Redpill me on Markov chains /g/
>>
>>57071437
no. read sicp.
>>
>>57072196
That's the one I've been looking for. Emilia is the best.
>>
File: OOP.png (69KB, 1210x467px) Image search: [Google]
OOP.png
69KB, 1210x467px
>>
File: anal beads.png (58KB, 713x713px) Image search: [Google]
anal beads.png
58KB, 713x713px
>>57072196
They can be fun.

Pic related; it's generations of this thread containing "shit"
>>
>>57072193
should have responded,
>s-so did I...
>>
>>57072196
O shit, that was my psot with the C++ code there. What a coincidence.
>>
>>57071761 (cont)
Never mind, I managed to dump the hex to bytes flawlessly adding a bash script after fixing the script.

If anyone needs, here is the final Base64 to Hex to File procedure:

#!/usr/bin/perl -w

use MIME::Base64;

my($base64Val) = '';
my($byteVal) = '';
my(@hexArr) = ();
my($hexVal) = '';

if(scalar(@ARGV) == 0) {
print STDERR 'Getting the base64 value...' . "\n";
$base64Val = "___BASE64_REPLACE_ME___";
}#End if
else {
$base64Val = $ARGV[0];
}

open(FH, '>', 'C:\HexDump.txt') or die "cannot open file";
select FH;

print STDERR 'Value found: ' . $base64Val . "\n";

$byteVal = decode_base64($base64Val);

$hexArr = unpack 'H*', $byteVal;
$hexVal = join '\x', $hexArr =~ /../g;
print '\x';
print $hexVal . "\n";

close FH;
print STDERR 'Done. Press ENTER to quit.' . "\n";
<>;


The code above converts Base64 to Hex and dumps it to a text file in this fashion: \x01\x02\x03...

This bash script instead converts the above text file to binary:

echo -n -e "$(<'C:\HexDump.txt')" > FinalBinary.bin


It's rough but gets the work done so w/e have fun.
>>
>>57072309
I was the one who replied to you

I'm doing it again right now

anon
>>
>>57072317
we're destined for each other (o・_・)ノ”(ᴗ_ ᴗ。)
>>
what's the equivalent of
int argc, char *argv[]


for python? I want to insert things from the terminal, like

python dostuff.py stufftodo
>>
File: 2016-10-14-182038_909x570_scrot.png (141KB, 909x570px) Image search: [Google]
2016-10-14-182038_909x570_scrot.png
141KB, 909x570px
Fucking hell.
>>
I'm kind of new.

Is there an idiomatic way of doing this?
>>
>>57072334
sys.argv
very googlable
>>
>>57072365
>is there an idiomatic way of doing this?
fuck I forgot to post the actual code

def gearscore(crit=0, agi=0, haste=0, mastery=0, vers=0):
score = 0
if crit > 0:
score += crit*7.05
if agi > 0:
score += agi*7.79
if haste > 0:
score += haste*7.25
if mastery > 0:
score += mastery*9.15
if vers > 0:
score += vers*7.01
return score
>>
>>57071897

>OOP

Bascially you can't build a bigger system without any abstraction.

For smaller tasks it doesn't matter, but the bigger the project, the more you need to split it into sub tasks. Now you could abstract thos parts into functional components (input module, output module and so on).

But that has serveral disadvantages. It's better to use abstractions of design decisions that are likely to change or are difficult or can come in many differnt variations.

This has serveral advantages:
-a "class" doesn't have to know about the surrounding, it has a certain task and does it's job
-therefore you can effectively split work into differnt groups that can work independently
-therefore results can be tested/reimplemented/extended without redesigning the complete system
-errors are more likely to not compromise the complete process but can get caught as locally as possible and a proper reaction can follow

>let's say one of my functions gets all news articles from one site and returns them, and another function takes that array as input and returns one specific type of news article.

Let's say suddenly there are two or more differnt types of news articles, one article contains videos the other not..
Let's also assume the function that "takes that array as input" needs to get more sophiticated - you want to index those articles with keywords (that come from another list), you want to filter articles with bad words.. I could go on forever here.

Basically you can add one or two "features" to you "funtion", but after that it will become an unmaintainable clusterfuck. You have to make design decisions:
-maybe chaining those parts together? But how can we verify the input then?
-do we have a hierarchy here? or all of those transfomrations on the same level?
-do we ALWAYS need all transformations? Or can we add a control logic that prevents articles without videos to run the "extract videos" function?


It's a differnt world, once you do bigger projects.
>>
>>57072375
in haskell this is just

score = sum $ zipWith (\c k -> if c > 0 then c * k else 0) [crit, agi, haste, mastery, vers] [7.05, 7.79, 7.25, 9.15, 7.01]
>>
>>57072375

1. Put them into an array (or hash, for the names)
2. For i in [your datastucture]:
3. if ds[i] > 0
>>
>>57072402
you can use the exact same one liner in python
>>
So I was tasked with making a program (in java) that takes an amount of seconds and converts it to a time. I've wrote it and it compiles and runs fine. But I want to use the joption panes to input the amount of seconds and then another joption pane to display the time. How would I do this?
Here's my code
import javax.swing.JOptionPane;

public class Exercise4 {

private static final int MinsInHour = 60;
private static final int SecsInMinute = 60;

public static void main(String[] args) {

int seconds = 50391;

System.out.println(timeConversion(seconds));

}

private static String timeConversion(int seconds) {

final int MinsInHour = 60;
final int SecsInMinute = 60;

int minutes = seconds / SecsInMinute;
seconds -= minutes * SecsInMinute;

int hours = minutes / MinsInHour;
minutes -= hours * MinsInHour;

return hours + " hours " + minutes + " minutes " + seconds + " seconds";
}
}


>>
>>57072402

In the python example, the values are optional, so i.e. "haste" might not be given at all (and gets set to 0 then).

I think this isn't the case in your example?
>>
>>57072533
congratulations
>>
File: Screenshot_20161013-220136.png (689KB, 1080x1920px) Image search: [Google]
Screenshot_20161013-220136.png
689KB, 1080x1920px
>>57072545
Really need help guys
>>
>>57072550
no, if you wanted that you should be using a dictionary or map

lookupOrDefault m d k = case lookup k m of
Just x -> x
Nothing -> d


zipWith (\c k -> k * (lookupOrDefault m 0 c)) ["crit", "agi", "haste", "mastery", "vers"] [7.05, 7.79, 7.25, 9.15, 7.01]
>>
>>57072533

HAha, what?
>>
>>57072571

No, you need to read your script more carefully.
>>
>>57072375
multipliers = [7.05, 7.79, 7.25, 9.15, 7.01]
def gear_score(stats):
return sum(worth * value for (worth, value) in zip(multipliers, stats))
>>
NEW THREAD!!

>>57072602
>>
>>57072609
Actually I fucked up, that should be:
multipliers = [7.05, 7.79, 7.25, 9.15, 7.01]
def gear_score(crit=0, agi=0, haste=0, mastery=0, versatility=0):
return sum(worth * value for (worth, value) in zip(multipliers, (crit, agi, haste, mastery, versatility)))


I guess there's a cleaner way to aggregate the arguments into a tuple but I don't really know.
>>
>>57072377
>>57071897
>>57071916
>>57071932
>>57072017
>>57072033
>>57072083
>>57072083
Ok, thanks for the insight
>>
File: 1476428993500.jpg (45KB, 728x728px) Image search: [Google]
1476428993500.jpg
45KB, 728x728px
>>57072608
What part? I'm just asking for help guys come on
>>
>>57072375
>>57072575
>>57072637

Sorry, for being late to the party, just wanted to leave this here:

def gearscore(crit=0, agi=0, haste=0, mastery=0, vers=0)
local_variables
.map{|i| binding.local_variable_get(i)}
.zip([7.05, 7.79, 7.25, 9.15, 7.01])
.map{|i,j| i>0 ? i*j : 0 }
.reduce(:+)
enddef gearscore(crit=0, agi=0, haste=0, mastery=0, vers=0)
local_variables
.map{|i| binding.local_variable_get(i)}
.zip([7.05, 7.79, 7.25, 9.15, 7.01])
.map{|i,j| i>0 ? i*j : 0 }
.reduce(:+)
end
>>
>>57072917

Fugg - double post..

def gearscore(crit=0, agi=0, haste=0, mastery=0, vers=0)
local_variables
.map{|i| binding.local_variable_get(i)}
.zip([7.05, 7.79, 7.25, 9.15, 7.01])
.map{|i,j| i>0 ? i*j : 0 }
.reduce(:+)
end
>>
>>57072897

t h i c c
>>
>>57069659

jokes on you he's got more jobs
Thread posts: 330
Thread images: 32


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