[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: 363
Thread images: 49

File: programmer talks2.jpg (379KB, 2048x2048px) Image search: [Google]
programmer talks2.jpg
379KB, 2048x2048px
old thread: >>60679964

What are you working on, /g/?
>>
First Ruby as the comfiest language.
>>
>>60686369
Was OOP the billion dollar mistake?
>>
>>60686369
>#4 CUTENESS CONNECTS US
stop making me want to cry
brb writing a program to help me pretend to be cute
>>
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!

>Features
https://dlang.org/comparison.html
>Standard library
https://dlang.org/phobos/index.html
>Package manager
https://code.dlang.org
>GC
https://dlang.org/spec/garbage.html
https://dlang.org/blog/2017/03/20/dont-fear-the-reaper/
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Books
https://wiki.dlang.org/Books

>>60686369
>Cuteness connects us
Not with that picture.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
>>60686419
Oops!
>>
I'm learning C again. It's way easier to write when everything is header files and only header files rather than header files and also sometimes namespaces
>>
here is the answer to that question of yours:
>>60686399
>>60686332
we all have our problems.
I got a bunch of kinks i'm working out of my system. God is the catalyst to my reformation, and he will be the reactant also.
>>
File: 1492832709498.jpg (44KB, 434x479px) Image search: [Google]
1492832709498.jpg
44KB, 434x479px
Is there anything more boring than a programmer convention?
Notice how only the shitty languages have corporate backing and have their own dedicated confrences.
>>
File: zirconConfusion.png (210KB, 378x492px) Image search: [Google]
zirconConfusion.png
210KB, 378x492px
>>60686443
>God is the catalyst to my reformation, and he will be the reactant also
>>
>>60686419
Better
>>60686426
Oh shit
>>
>>60686462
I'm fucked in the head.
But i'm also Christian.
So i'm trying to stop fetish-centric shit, focus on God, and hopefully escape the hell i am in.

>I've got 99 problems, and fetishes are some.
>>
>>60686478
what if your fetishes are God, you sick, kinky fuck?
>>
>>60686470
I'll pick a new mascot some day, anon. How are you enjoying, dlan-chan though. (If you're the same anon.)
>>
>>60686478
watch out breh because sometimes when fetishes are really weird / extreme and cause real psychological turmoil it can be a warning sign that they're secretly more than just fetishes

like when you were abused as a child and your psychological development process wanted to make sure you wouldn't find that shit and decided to stick it somewhere stupid like your penis
>>
>>60686490
definitely not.
Baphomet was for a while though...

I regret every instance of fetishism and white knighting, currently trying to form that elusive skill known as "self-control"
>>
>>60686514
D is okay.
>>
>>60686525
>>60686490
If you list your fetishes then i will list mine.
Deal?
>>
Give me some tips on dealing with a fuck-huge codebase in C. I'm a month into my internship and I'm still """designing""" how I'll do my project.
>>
>>60686563
>I'm a month into my internship and I'm still """designing""" how I'll do my project.
Have you tried restarting the server?
>>
In C#, if I have a class for files of type A, and A files contain B files and C files, both of which shouldn't really occur outside of A (but technically could), how should I organize that?
I can't use a namespace for type A (to group all of A's dependencies). Should I use public nested classes?
>>
If I had an integer that was anywhere from 1 to 4 digits long, how could I convert it to a string in such a way that it would always write as four digits? For example, if the number was 1, I want it to write as "0001", or if it were 256, I want it to write as "0256".
>>
>>60686625
I have no clue
Perhaps nesting is the best atm, maybe consult some of the other developers as nesting may be a problem in future.

Is this really what they make an intern do?
>>
Checked the gentooman library and the wiki, but I can't find any books on Rust.

Anywhere good to start?
>>
>>60686643
%04d should do it
>>
>>60686547
oh hell why not, i'll probably get banned again for something else anyway if not this

this is like an oddly specific but really fucked up thing, i'm into the idea of a chubby person being together sexually with a slightly underweight person, and then the chubby person gets really fat at the skinny person's direct expense, causing the skinny person to get like really super unhealthy level skinny due to having to support all that gluttony, only the weird thing is this is something they both want and are happy about, and they're both excited for the skinny one to starve to death so the fat one can deep fry the fresh corpse and feast on everything edible that was left on it. like the fatter the fat one gets the more stupid and sluggish and foul smelling they become whereas the more bone-thin the skinny one gets the more perfect and beautiful and pure they get but yet all the while both of them still consider the fat one's life to be infinitely more valuable and after all the only reason the skinny one so tirelessly seeks perfection is to make a perfect little single-serving roast

i've been in therapy since i was 6 :^)

also though to bring the subject back to tech i wrote a text adventure engine specifically to make games around this theme, the engine itself is clean/sfw so i might post some things from it if i can dig it up
>>
>>60686643
str_i = '0'*(4-len(i)) + 'i'
>>
>>60686656
That worked, thank you.
>>
>>60686671
Not the weirdest thing I've read, but hot damn anon you've got problems.
Hope to see this engine.
>>
File: 1492415012133.jpg (61KB, 482x427px) Image search: [Google]
1492415012133.jpg
61KB, 482x427px
>>60686369
>tfw too much of a brainlet to implement software task switching on x86
why even live
>>
I need to learn Java, and know absolutely nothing about it, or OOP, for that matter. Any good online tutorials/courses you guys would recommend?
>>
>>60686650
nah it's a hobby project, so it's just me.
>>
>>60686655
Rust Essentials
>>
>>60686739
Maybe.
>>
>>60686775
Thanks.
>>
>>60686779

pls help. Someone told me to use Eclipse, that's all I know
>>
>>60686739
http://shop.oreilly.com/product/9780596009205.do
>>
>>60686820
Nigger, use google and amazon. Then pirate a book that you like. Don't rely on others for such a simple task.
>>
>>60686820
http://lmgtfy.com/?q=java+tutorial
>>
>>60686671
>making a game around this
>with a sfw engine
pleae post it on a sfw forum, for the lols of course.

My fetishes are probably infintely worse:
>i get off to the idea of worms going up my rectum and eurethre to implant baby worms that make sex infinitely more enjoyable
>I get off to the idea of transforming into something non-human and powerful, likely stemming from me being a social outcast my whole life and desiring to overcome bullies.
>this all started with me desiring to receive some kind of disease that removes my physical humanity and gives me power imagined, such that i may do as i please with all things. this idea eventually branched off into simply not becoming human and becoming a sexually irresistible and powerful being,
>This has resulted in me becoming a fur-fag, although i don't associate with the community because fuck doing that
>I am currently attracted to the idea of being forcefully transformed into a satyr or goat-man through anal and penile worms that secrete sexually exciting substances that increase the reward of sex, and which feed on sperm.
>This has sparked a moral dilemma in me, because from every logical standpoint this makes not sense and would never work, and yet my dick is louder than my brain. Currently it is hard from describing this attraction.

For this very reason i am commited to gaining some self controll and overcomming this seductress in my heart.

i would kms but that i feel is the cowards way out.
>>
File: yukari_what (2).png (175KB, 441x599px) Image search: [Google]
yukari_what (2).png
175KB, 441x599px
Jesus fucking Christ I come back from a smoke break and /dpt/ turns into a fucking tumblr blog.
>>
>>60687016
I would just end it
>>
>syntax similar to Ruby
>fast and has very good concurrency
I really can't wait until Crystal is stable.
>>
>>60687036
what is tumblr blog liek about it?
4chan has no distinguishing features from tumblr except that it doesn't self-sensor (or at least the users dont ss themselves).
>>
So what can a computer scientist do that a computer engineer can't? And vice versa? They honestly seem fairly interchangeable and possess the majority of the same skills
>>
>>60687016
That's pretty bizarre, but I'm glad you're choosing not to kys because personally I don't see how it's any reason to. An idiosyncrasy is nothing to be ashamed of. It is something to have some proper shame about, but that's not quite the same thing; not everything you should be too embarrassed to talk about in public is something you should feel bad about.

I can't find the damn engine. (Grumble, gripe.) I know it was in Ruby. I think it may have gotten lost at some point while I was trying to reinstall my OS. It was nothing too impressive anyway, basically just a rehash of Quest with no GUI.
>>
>>60687260
>>>/g/wdg
>>
>>60687274
ty
>>
>>60687167
>An idiosyncrasy is nothing to be ashamed of
Shame is an important behaviour, as it allows us to identify what is wrong with us.
Sadly i am socially inept and feel the need to share EVERYTHING with strangers that i meet.

Im learning ot restrict such behavior, in the meantime i am learning to control myself and be rightfully ashamed of such immoral behavior.

I'm assuming you are the rock fucker.

We both know that we are broken people, we need to try to control ourselves and learn to suppress such disgusting desires. Trancend them and become more wholesome individuals both for ourselves and for the communities that surround us.

In the meantime:
public class Goodbye {
public static void main(String[] args){
String name1 = "Elvis ";
String name2 = "Presley ";
String pasttense = "has ";
String verb1 = "left ";
String verb2 = "building ";
String the = "the ";
System.out.println(name1 + name2 + pasttense + the + verb1 + verb2);
}
}
>>
>>60686820
public class Goodbye {
public static void main(String[] args){
String name1 = "Elvis ";
String name2 = "Presley ";
String pasttense = "has ";
String verb1 = "left ";
String verb2 = "building ";
String the = "the ";
System.out.println(name1 + name2 + pasttense + the + verb1 + verb2);
}
}

Use eclipes as an IDE. Use online sources (such as video tutorials on youtube, or posts on forums) to help you learn. Pirate books if you are too cheap to buy them
>>
>>60687349
>>60687365
you do know you can kode with codetags right?
from faggot import op
>>
>>60687403
>codetags
what are "codetags"?

I'm a beginner to be patient with me.
>>
>>60687436
>>>/g/rules/3 explains them
>>
>>60687464
public class Goodbye {
public static void main(String[] args){
String name1 = "Elvis ";
String name2 = "Presley ";
String pasttense = "has ";
String verb1 = "left ";
String verb2 = "building ";
String the = "the ";
System.out.println(name1 + name2 + pasttense + the + verb1 + verb2);
}
}


better?
>>
>>60687525
noticed a mistake, here is corrected version:
public class Goodbye {
public static void main(String[] args){
String name1 = "Elvis ";
String name2 = "Presley ";
String pasttense = "has ";
String verb1 = "left ";
String verb2 = "building ";
String the = "the ";
System.out.println(name1 + name2 + pasttense + verb1 + the + verb2);
}
}


better?
>>
Is it hard to build a Youtube to MP3 converter using Python?
>>
>>60687436
Jesus fucking christ. Does anybody read the fucking rules, the sticky, or lurk in general? You're not supposed to post right away, faggot.

>>60687575
It's as hard as your tiny dick, retard.
>>
>>60687575
Depends on how low you want to go.

If you just use the youtube-dl libraries, it's incredibly easy

If you intend to re-implement an HTTP client and ffmpeg in Python, it's going to be very hard.
>>
>>60687575
Nothing is hard in Python because Python has libraries for everything. Just import your shit, read the documentation and you can make it in under an hour. From scratch would be another ball game.
>>
>>60687575
youtube-dl -o - <url> | ffmpeg -i - -vn -acodec mp3 output.mp3
>>
>>60687611
>>60687650

Even reading how youtube-dl work is also scary

https://www.quora.com/How-can-I-make-a-YouTube-video-downloader-web-application-from-scratch

Let me just give up on this
>>
>>60687749
How is the difficult? Basically you are getting information from youtube and then deciphering it. If that is difficult, whelp time for you to quit programming.
>>
>>60687796
Thanks. Obviously have not read it fully and deeply yet. You know alpha like me won't ever give up on such thing, right? :)
>>
>>60687967
yikes
>>
File: 1488959658699.jpg (7KB, 180x281px) Image search: [Google]
1488959658699.jpg
7KB, 180x281px
>>60687967
I can't tell if this is bait or not.
>>
If I have
(defmacro ducc (ass) `(+ ,ass 9 dicc))
(defmacro lmao (param1)
(let ((whatever (something)))
body-which-someone-will-tell-me-how-is))

how do I make it so that the expansion of (ducc something)
is what gets expanded in lmao

reason being that dicc only makes sense in the body of a loop macro which holds dicc locally.
>>
>>60688305
*(ducc whatever)
Also, my gut tells me ,@ would be helpful here.
Maybe introduce a var into let, holding the macroexpand of (ducc whatever) and then ,@ into the backquote of lmao?

Thoughts. But I'm not really sure what ,@ exactly does.
>>
>>60688305
Forget this shitty explanation.
Basically, I want to insert code I wrote somewhere else into my macro and have the result be expanded and run.
>>
>>60686671
>>60687016
what the fuck man
and here I was thinking my hypnosis fetish was weird
>>
>>60687164
I don't know what a se learns in the anglo system. But here se is a bit like a ce. Less focused around ciruicts and stuff. But learn a lot of low level things.
One ofy TAs said that the cs guys start with math, and then slowly do away with the abstraction. While we start with transistors and logic gates, and add abstraction.
>>
>>60686625
Can you give a short example or be more specific?
>>
>>60688305
you naming is pretty nonstandard, let me help
(defmacro open-parenthesis (times) `(+ ,minus 9 seven))
(defmacro newline (close-parenthesis)
(let ((divide (four)))
by-three))
>>
Is it just me who finds the current lot of HDLs completely and utterly unintuitive? I've been through a CE education, I understand waveforms and RTL, and when I want to make something on the FPGA, I'm usually concerned about that.

Verilog, which I'm most familiar with, offers NO WAY to intuitively encode EITHER.

>"Yes, I put that shit in an always @posedge clk block. THAT DOESN'T IMPLY I WANT ALL THE GODDAMN ASSIGNMENTS TO BE FUCKING FLIP-FLOPS."
>"IF I MAKE AN ASSIGNMENT TO A VARIABLE IN EVERY CASE, THERE DOES NOT NEED TO BE A FUCKING FLIP-FLOP FUCKING GODDAMMIT, IT'S A PURE FUNCTION OF STATE, I.E. FUCKING COMBINATIONAL."
>"Okay great, to get the waveform I want I'm going to have to separate out the combinational and sequential parts of the behavior, fucking excellent."
>"Who would have thought that would have been a COMPLETE NIGHTMARE and TOTALLY UNREADABLE? Not me of course."

If you can design a waveform, it is possible to encode it in an HDL.
If you can design an RTL layout, it is possible to encode it in an HDL.
Neither is probable.
>>
>>60688684
Yeah, HDLs are pretty shit. They try to masquerade as programming languages, but what they're doing is fundamentally different.
I did a couple of university papers where we used verilog. We had to use some ancient Xilinx shit, and it was fucking garbage.
>>
Drink snack goy goy

Smoking and hoping to code out something to augment my coding experience (motif)
>>
>>60688739
You ever do anything in VHDL? I've had some people tell me it's better, that you have tighter control over the hardware, which is what it was designed for. While Verilog was simply designed for shitty behavioral prototypes. From the bit I've tried to read, it looks like gibberish, so I can't tell.
>>
>>60688767
No, I've only used Verilog.
>>
>'{' is not preceded with whitespace.

Don't you guys hate it when your team m8 always do this and never put whitespace in between em> It hurts my eyes
>>
File: yukari_disgust.png (29KB, 287x201px) Image search: [Google]
yukari_disgust.png
29KB, 287x201px
>>60688796
>braces not on separate lines
>>
what does /dpt/ think of my snake?

[(prop[0],(lambda x: "true" in prop[1].lower())(prop)) for prop in [(prop,str(getattr(self,prop))) for prop in dir(self) if ("bool" in str(getattr(self,prop)).lower() and not (type(getattr(self,prop)) == type([])))]]


it's cute, right? python-tan can connect us all with lists so it must be the cutest language.
>>
>>60688830
Braces should be on the same line desu senpai and must preceded with A whitespace. Don't be autistic
>>
>>60688834
Python is dysfunctional.
>>
>>60687094
I never understood Ruby, I learned python a long time ago but the syntax of python was intuitive too.

Curly brace master race
>>
>>60688830
If you put the opening brace on a dofferent line, literally end yourself. It doesn't serve a purpose for the programmer only for the compiler. There is no need to clutter your view with an unnecessary line. Fuck you.
>>
File: sakuya_face.png (30KB, 137x200px) Image search: [Google]
sakuya_face.png
30KB, 137x200px
>>60688887
>clutter
>literally makes code easier to read, especially on dual window mode
Thank god I'm not autistic.
>>
>>60688912
>easier to read
How? If you have an opening brace, the next line is already indented. What more visual cue would you need? If you put it on a newline, than it just wastes space.
>>
>C++ has two (TWO) stdlib
Toppest of the top keks
>>
>>60689031
You're literally confusing it with D.
>>
>>60689141
D has both STL and STDLIB?
>>
>>60689160
D has two standard libraries, and C++ has one, STL and libc being parts of it.
>>
Changing a library from JSON based to flatbuffers.
>>
>>60686671
>>60687016
Fucking kill yourselves.
>>
>>60689141
What?
>>
>>60689173

The STL and libc are arguably two distinct libraries.
>>
>>60689443
Well, yes, especially in the historical perspective, but they both are parts of the C++ standard library because 1) they're defined by the standard 2) they're shipped with all the implementations of the language 3) they don't conflict with each other.
As an illustration, Python's standard library is an unholy mess of components, yet they as a whole are considered to be the Python's Standard Library. In contrast, D's two standard libraries were incomparable, and libraries built around one couldn't work with libraries built around the other.
>>
>>60689485

Kinda like Rust's libcore vs stdlib? Or worse?
>>
File: lisptan.gif (205KB, 270x380px) Image search: [Google]
lisptan.gif
205KB, 270x380px
This is for all of you lispers in the thread, a Lisptan made i grorious nihon dancing the Caramelldansen
Source: http://lambda dot bugyo dot tk/cdr/mwl/
>>
>>60689527
Like what, like libc/STL? Yes, kinda. Like D's mess? Not at all, libcore is a subset of stdlib, the latter being built upon the former.
>>
working on my google summer of code project.

pretty cozy, work like 10 hours a week and I'm making really good progress.
>>
>>
>>60689569
Nice facebook image, fag.
>>
>>60689569
Keep me safe tech doggo
>>
>>60686419
will they really remove the GC completely?
>>
>>60689605
Isn't it gonna break the existing code? Like, all 10000 lines of it.
>>
>>60686419
>managed language
>no GC
the fuck are are they smoking over at caltech
>>
New free ebook from apple for beginner to develop app with Swift

https://itunes.apple.com/us/book/app-development-with-swift/id1219117996?mt=11

https://www.reddit.com/r/programming/comments/6eh7gw/
>>
File: available_on_iphone.png (51KB, 274x402px) Image search: [Google]
available_on_iphone.png
51KB, 274x402px
>>60689709
>"free" ebook
>you have to buy their product and have iTunes installed to read it
Yeah, well, no.
>>
>>60689731
well, if you want to develop an app in swift, it's obviously for apple products.
>>
File: 1488381290262.jpg (30KB, 361x272px) Image search: [Google]
1488381290262.jpg
30KB, 361x272px
>>60686419
>>60686478
>>60686720
>>60687016
>>60687094
>>60688684
>>60688796
>>60688830
>>60688912
>>60689031
>>60689651
>>60689731
Who was the original source of this phrase?
>>
>>60689742
1. Swift works on Linux and they even try to promote it as a cross-platform language.
2. Whatever their reasoning, hiding documentation behind a pay wall for no reason is a fucked up practice. Then again, we're talking about Apple here, they make money by selling the illusion of exclusivity to insecure people.
>>
>>60689789
>1. Swift works on Linux and they even try to promote it as a cross-platform language.
objc also is available on linux but to develop app you need the apple api which is not.
>>
File: 1489478046569.jpg (54KB, 675x738px) Image search: [Google]
1489478046569.jpg
54KB, 675x738px
How do I sort these lines in order (1,2,3 ...) in python ?
My output file gives me this :
>cas15 (Flapping Wing) - OK
>cas14 (CPT) - OK
>cas17 (SpringDashpot) - OK

and continuing in a random order.
Is there a way to sort the file to make it like
>cas1 ...
>cas2 ...
>cas3...
...
>casN ...

?
Thanks
>>
>>60689841
Why don't you try doing your own homework?
>>
>>60689845
That's not homework, just normal work, I'm really new to python and they gave me some code to clean and add things in.
>>
>>60689857
It's literally just
your_list.sort()
in python.
However, you're not 100% clear in your question. Are you looking for a natural sort?
>>
>>60689885
Yes, natural sort of the lines, from the number of their case.
Just to rearrange them in a less random order.
>>
File: facebook_rust.png (17KB, 710x261px) Image search: [Google]
facebook_rust.png
17KB, 710x261px
So now Andrei is out, it looks like Facebook's decided to embrace Rust.
>>
File: 9dba4b27a4984ba4a0abebea9c3498a3.png (543KB, 1080x888px) Image search: [Google]
9dba4b27a4984ba4a0abebea9c3498a3.png
543KB, 1080x888px
Is there a more efficient way to make a single method java program for Rock Paper Scissors?

import java.util.Random;
import java.util.Scanner;

public class RPS
{
public static void main(String args[])
{
// Arrays of moves: move name, beaten by
String[][] moves = {
{ "rock", "paper", },
{ "scissors", "rock", },
{ "paper", "scissors", },
};

String choice;
int num = 0;
Random r = new Random();
num = r.nextInt(3);

System.out.print("Choose: ");
for (int i = 0; i < moves.length; i++ ) {
if (i > 0)
System.out.print(", ");
System.out.print(moves[i][0]);
}

System.out.println(".");
Scanner userChoice = new Scanner(System.in);
choice = userChoice.next().toLowerCase();

System.out.println("System chose " + moves[num][0]);
if (choice.matches(moves[num][0])) {
System.out.println("Its a tie!");
}

else if (choice.matches(moves[num][1])) {
System.out.println("You win!");
}

else {
System.out.println("You lose!");
}
}
}
>>
>>60689932
Something like this:
import re

data = [
">cas15 (Flapping Wing) - OK",
">cas14 (CPT) - OK",
">cas17 (SpringDashpot) - OK",
">cas2 (SpringDashpot) - OK",
]

num = re.compile(r'^>cas([0-9]+)')
data.sort(key=lambda x: int(num.search(x).group(1)))

for val in data:
print(val)
>>
>>60686699
Not who you are replying to, but what language is that? Does putting "i" in single quotes not treat it as a string and give you, for example, "000i"?
>>
>>60689173
>D has two standard libraries,
No, C++ does
>>
>>60689605
I'm pretty sure that's the joke.
>GC
>eventually
>you never know when the GC will be cleaned up :^)
>>
>>60690074
have my spicy c# version
using System;
using static System.Console;

class Program
{
static void Main(string[] args)
{
while (true)
{
char[] options = {'r', 'p', 's'};
char computerPick = options[new Random().Next(3)];
WriteLine("Choose r, p, or s");
char userPick = ReadKey().KeyChar;
int userIndex = Array.IndexOf(options, userPick);
if (userIndex == -1) continue;
bool lose = options[(userIndex + 1) % 3] == computerPick;
WriteLine();
WriteLine($"Computer chose {computerPick}");
WriteLine(userPick == computerPick ? "tie" : lose ? "lose" : "win");
WriteLine("press key to try again");
ReadKey();
}
}
}
>>
File: 20140614053836724.jpg (35KB, 497x656px) Image search: [Google]
20140614053836724.jpg
35KB, 497x656px
>>60690431
>posting false claims
>ignoring the discussion above
>>
>>60690517
Everyone knows C++ has two standard libraries
>>
File: X8O0ra.png (894KB, 2560x1436px) Image search: [Google]
X8O0ra.png
894KB, 2560x1436px
>>60690484
I meant for Java :d
>>
>>60690523
stl and boost?
>>
>>60690555
i know but java is disgusting
you can translate the important bits to java, cmon, work for those grades
>>
>>60690523
You mean 3, C++ has 3 standard libraries
>>
File: 1477868066262.jpg (46KB, 288x358px) Image search: [Google]
1477868066262.jpg
46KB, 288x358px
>>60690473
>>60690517
Who said this though?
>>
>>60690473
I hope they don't remove GC, I want non-GC autism to be optional by default
>>
In OOP, what's the difference between Liskov's substitution principle and just using (abstract) base and superclasses?
>>
>>60690629
It makes no sense for GC to be optional, you either has your stdlib and third-party libraries designed around it, or you don't.
D without GC would have no libraries, thus even more useless, the whole "optional GC" deal sounds like a knee-jerk reaction to Rust.
>>
File: 1491912956633.jpg (18KB, 237x288px) Image search: [Google]
1491912956633.jpg
18KB, 237x288px
>play around in ue4 to learn some sepples
>write like 2 lines of code
>crashes and corrupts the whole project
why does c++ hate me?
>>
>>60690691
>D without GC would have no libraries
Why would you use standard libraries in kernel again?
>the whole "optional GC" deal sounds like a knee-jerk reaction to Rust.
Luckily, except for a few autist neckbeard, no one screeches about GC
>>
>>60690663
that you can replace everywhere in your application an instance of A by an instance of any children of A and the logic of your program will remain sound.

for example
class A
{
void foo() { print("Foo A") }
}

class B extends A
{
void foo { print("Foo B") }
}

B b = new B()

b.foo(); // print "Foo B"

A a = b; // Okay, b is an instance of B which is a child of A.

a.foo(); // print "Foo A", not "Foo b"


This way, you can replace every occurrence of "new A()" in your code with "new B()" and your program will not change at all.
>>
As someone with an accounting background, what language would you recommend to help with work like:
- Reformatting screwed up reports.
- Reconciliation of records

I'm somewhat competent with Autohotkey, doing some automation through COM and VBA. Though I sort of feel restricted with VBA and I really don't like its sytax.
>>
>>60690708
>Why would you use standard libraries in kernel again?
So kernel is the only use case for optional GC in D? Why do they bother with it then, D has never been marketed as a language for kernels, drivers and such.
>except for a few autist neckbeard, no one screeches about GC
D-fags itt bring "optional GC soon" every time you complain about it being slow tho, even D-tan-fag mentions it every time.
It sounds like D-tan has a mild case of schizophrenia.
>>
>>60690727
Doesn't that mean that if e.g. my program uses base classes of it's children everywhere (except on construction ofcourse), it's automatically Liskov approved?
I mean, I could replace all A by B where the implementation would stay the same.
>>
Bare with me for a couple minutes /dpt/:

I have a math degree but it took me 5 years to finish it (for non-intellectual reasons; I am actually pretty good at math, but absolutely terrible with people). I recently began a master's degree in math but dropped out. I need money because I can't leech off my parents indefinitely (no such thing as autismbux in my country). My one saving grace is that I minored in computer science but I am 27 now and I have never had a job in my life.

How fucked am I?
>>
>>60690791
How is this related to programming?
>>
>>60690695
>crash project with 2 lines of C++

sort yourself out
>>
>>60690776
I also like to add that I have tried learning C# but after watching Microsoft's introductory series. I just kinda feel lost.
>>
>>60690791
Not fucked at all, I'm pretty sure you still can get a job at McDonald's.
>>
>>60690800
Do I have a realistic chance of getting hired as a programmer or is suicide a more optimistic alternative?
>>
>>60690815
>terrible with people
>job at McDonald's
>>
File: 1496318461597.gif (4MB, 356x200px) Image search: [Google]
1496318461597.gif
4MB, 356x200px
>>60690802
Im a java god so the fact that c++ is so absolute isn't something Im used to.
>>
>>60690818
Without an internship first? No chance.

Otherwise, with only a bachelor and an internship, you can only be hired as a technician as first dev job. Basically you'll do the same shit as someone with a master, except you'll be paid less the first two or three years (that is, until you're considered having the same experience as someone with a master).
>>
>>60690840
Ok, so my only available course of action is to get an internship somewhere. I'll try that first then. Thank you for answering.
>>
File: aaaaaa.png (37KB, 737x825px) Image search: [Google]
aaaaaa.png
37KB, 737x825px
lets say i have two files. one is called 24may and the other is called 28may
how can i get the changes highlighted in red like git/github does it? something like pic related

but i only want it locally
>>
>>60690572
It's just an end of semester quiz worth like 5% (currently in first year).
>>
>>60690863
Use git diff
>>
>>60690863
Just fucking use git. You didn't even mention the types of files you are comparing.
>>
>>60690891
they're asm files
>>60690886
ok
>>
>>60690834
So you are literally the God of shit?
>>
>>60690776
Python, I guess.
>>
>>60690905
WRONG! shit has unlimited potential. you have none.
>>
>>60690863
You can use diff, it will be arrows instead of red coloring but will do the thing you want
>>
>>60690912
what
>>
I've learned a bit of C and JS and looking to expand my horizons and learn a new language. Probably going into webdev soon, what should I get into?
>>
>>60691051
>web""dev""
Why do you think this is an appropriate question for this thread?
Ask on >>>g/wdg/
>>
>>60690779
Not that anon but abstract base classes and Liskov's principle are different. Liskov's Substitution Principle is how you should use abstract classes, formally
>Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of Type S where S is a sub type of T
Basically what it is saying and what anon above was saying is that you should be able to substitute a child in your code anywhere the parent is used, it should honour the contract the used. This means that if animal is a superclass and cat is a subclass, then cat should be able to do anything a animal can do. This is an is-a relationship, which is different to a has-a relationship, for instance cats is an animal, but it also has legs compared to fins or arms. You should not use has-a relationships for inheritance because inheritance is a tight coupling between types, which is why multiple inheritance is considered bad and why languages like Java and C# have interfaces and Ruby uses modules to simulate multiple inheritance without tightly coupling a type to multiple parents.
>>
Why the fuck does Java not allow this?
public class a {
public static void main() {
int x;
for (int i = 0; i<2; i++) {
x = 1;
}
System.out.println(x);
}
}

x may not have been uninitialized. Fucking dumb compiler.
>>
File: fragzeichenidol.jpg (174KB, 640x640px) Image search: [Google]
fragzeichenidol.jpg
174KB, 640x640px
>>60686369
Is there a javashit equivalent of (cons) ?

All I want to do is append something to the front of an array, and then have the resultant array returned.

xs.unshift('x')
returns the array length for some retarded reason.

I just want something like
xs.concat('x')
except for the front. Fuck this shitty language.
>>
>>60691404
The compiler cannot be sure that x would not be used uninitialized inside the loop (that is, before you assign it 1). The language considers it a programmation error anyway.
>>
>>60691455
Are you genuinely retarded?
xs = ['x'].concat(xs);
>>
>>60691106
The thing that is bothering me is the overriding of functions. E.g. a cat and a crab both walk, but in different ways. Is this then still liskov?
>>
Gonna do some cross-platform threading in C, does MSVC support stdatomic.h yet and if so, since which version? And do you think using it is a good idea anyway if the code's going to be compiled on Linux, Win32, Android and OSX machines?
>>
>>60691599
>MSVC
>C beyond C90
MS doesn't support obsolete languages, you have to either use modern C++, which MSVC supports well enough, or to switch to gcc/clang from msys2.
>>
>>60691599
>MSVC
That garbage doesn't even support C99 properly, and even that was a very recent addition. There is no chance in hell you're going to get C11 features.
If you're writing C, don't even bother targeting MSVC. Clang or GCC is good enough for Windows.
>>
File: 8e8.png (8KB, 509x619px) Image search: [Google]
8e8.png
8KB, 509x619px
tfw I've been given a combinatorics problem to implement as a job offer but I barely know highschoop math
>>
>>60691674
(You)
>>
>>60691683
>he fell for the programmers don't need math meme
>>
>>60691774
>meme
>>>/v/
>>
File: 1495850341740.jpg (48KB, 498x456px) Image search: [Google]
1495850341740.jpg
48KB, 498x456px
>>60691812
>le "go to /v/ if you meme" meme
I don't like this meme.
>>
>>60691834
>le
>meme
>>>/v/
>>
File: 1379272606191.jpg (18KB, 512x384px) Image search: [Google]
1379272606191.jpg
18KB, 512x384px
>>60691853
>le "can't recognize ironic shitposting and weak ploys at getting (You)s" meme
This meme is even worse.
>>
>>60691812
>>meme
>>>/v/
>>
>>60691884
>>>meme
>>>/v/
>>
>>60691883
>le
>meme
>>>/v/

>""""""ironic shitposting""""""
Ironic shitposting is just shitposting.
>>
>>60691883
>le
>meme
>>>/v/

>doggo
>>>/an/
>>
>>60691774
I never believed that, but elementary and highschool math classes were so uninteresting that I simply never gave a shit.
The university math classes were probably some of the worst ones I've had, so yea. I picked up some random book to see what it's like to learn from ot and it's much easier than trying to understand anything in that fucking class
>>
>>60691920
>Ironic shitposting is just shitposting.
So is straight shitposting.
>>
>>60690791
>socially retarded
>non-intellectual
>>
Can I simplify this to set the whole traversal to a constant list?

game & playerInfo.players .~ zipWith (\x p -> p & num .~ x) [1..] (game^.playerInfo.players)


What i'd like it to look like
game & playerInfo.players.traversed.num .~ [0..length numPlayers' game]


Basically I want to set the elements of a traversal in order to 0,1,2, etc without having to use a zip and anonymous function
>>
>>60692436
Can you not literally use
elementsOf
?
maybe biplate?
>>
>>60692470
Thanks for the hints, finally managed to find a function which worked.

imap (\n p -> p & num .~ n) (playerInfo.players)


Lens is fucking cool but it's pretty complicated to find exactly what you want
>>
>>60692834
imap (num .~) (playerInfo.players)
>>
File: 1485486628707.jpg (251KB, 1266x1924px) Image search: [Google]
1485486628707.jpg
251KB, 1266x1924px
>>60686369
Rewriting D in Haskell.
>>
>>60692895
Cheers, I usually just let hlint tell me things like that but it seems to have randomly stopped working
>>
>>60692960
\p -> p & f
(&) is just flip ($)
so it's
\p -> f $ p
which is
\p -> f p
which is (eta reduction)
f

then you have

(\n -> num .~ n)
which can be done as a section
(num .~)
>>
>>60691404
make x field and it'll be ok
>>
>>60692958
Does she fuck or no?
>>
I need to learn design patterns, how do i start?
Which one should be first?
>>
>>60693135
>I need to learn design patterns
You really don't
>>
File: 1495051194199.png (322KB, 497x497px) Image search: [Google]
1495051194199.png
322KB, 497x497px
>>60693135
I will not stop you. Knock yourself out.
>>
>>60693165
>>60693182
I need, i will have test next week.
>>
>>60693135
Don't.

For every potential use of design pattern, you always have a more concise, less convoluted solution. Also, it creates more and more atrocious and inaccessible jargon.
>>
>>60693236
look >>60693216
>>
>>60693216
maybe u should have gone 2 ur lectures lmao
>>
>>60693351
this
>>
>>60693165
>>60693182
>>60693216
t. never worked in a team
>>
Reminder to stay hydrated.
>>
File: 1495709731761.jpg (38KB, 556x610px) Image search: [Google]
1495709731761.jpg
38KB, 556x610px
>>60690965
you heard me, bucko. sort yourself out. start by cleaning your room.
>>
>>60693351
that is not an option
>>
>>60693216
Good luck, you have one week to be a good sheep and read the Gang of Four book. (I'm so sorry.)
>>
>>60691599
>does MSVC support stdatomic.h yet
No.
But it's failry trivial to make an implementation for the few primitives you need (compare exchange, inc/dec covers most needs), can probably get away with some simple macros.
>>
File: maxresdefault (11).jpg (70KB, 1280x720px) Image search: [Google]
maxresdefault (11).jpg
70KB, 1280x720px
I got a bit interested in breaking one Android game. Decompiled it, took out the failure condition, recompiled it, it works.

But the game has a online multiplayer mode that works through Google Play Games framework. This was the fun part, and the fun part stopped working. It just throws a dialog box with "Failed to sign in. Check your connection and try again".

I assume the issue is that the framework checks the app for integrity and denies connection when a joker like me tries to run a modified version of the app.

Is there a way around this?
I know it's a question sort of like "can i hax google??" but I still have some hope because it's not like Google Play Games is that big of a platform anyway. Maybe they half-assed the whole thing, I dunno.
>>
Hello. Below is an assortment of book i have, which of these are useful for programming:
- NIV Bible
- Pro spark Streaming: The Zen of Real-time Analytics using Apache Spark
- Sams Teach yourself: Java
- Calculus: A complete introduction
>>
How do I format correctly, I just used a lot of space before words

def calc_drips(ml,drip_in_ml=35):
return float(ml) * drip_in_ml


def nic_in_ml(base_nic_str,desired_str,tot_vol):
return ( float(desired_str) / float(base_nic_str) ) * float(tot_vol)


def ret_percent(item_ml,tot_vol):
return (float(item_ml) / float(tot_vol)) * 100

def ret_ml(percent,tot_vol):
return (float(percent)/100) * float(tot_vol)

def calc_nic_args(des_str,tot_vol):
ml = nic_in_ml(48,des_str,tot_vol)
drops = calc_drips(ml)
percent = ret_percent(ml,tot_vol)
return ml,drops,percent



def println(item,ml,drops,percent):
print("{}: \t ml~{} \t drops~{} \t %{}".format(item,ml,drops,percent))

def print_recipe(rec,des_str,tot_vol):
nic_ml, nic_drops, nic_per = calc_nic_args(des_str,tot_vol)
println(" NICOTINE",nic_ml,nic_drops,nic_per)
for x in rec:
ml = ret_ml(rec[x],tot_vol)
println(x,
ml,
calc_drips(ml),
ret_percent(ml,tot_vol)
)


Ellas_Shortbread_Biscuit = {"Acetyl Pyrazine 5% (TPA)":0.5,
" Biscuit (INAWERA)":1.5,
" Sugar Cookie (CAP)":4,
"Vanilla Custard v1 (CAP)":2,
"Vanilla Shisha (INAWERA)":1
}

print_recipe(Ellas_Shortbread_Biscuit,15,10)
>>
>>60694022
Found the answer: it verifies the SHA1 fingerprint of the key that signed the .apk file. No way I'm breaking that. Bummer, dubs wasted.
>>
>>60694075
format however you want.
I don't follow conventions or standards, i think most programmers don't.
>>
>>60694182
no I meant the space are fine for one recipe in a dict, but im gonna have it read from 100's in a csv
>>
>>60686419
D's toolchain on windows is worse than cancer.
>>
>>60693733
is this book any good?
It has the biggest number of seeders on 1337x
https://www.amazon.com/JAVA-DESIGN-PATTERNS-Devendra-Singh-ebook/dp/B01GZKFZ5I
>>
>>60694212
I don't understand what you are saying.
Don't worry about formatting, jusst format according to what makes sense to you, spaces are good for creating distinctions between lines of code, lack of spaces helps one to recognize clusters of associated code.
>>
Why does this not create a text file?
I just want to count from 190000 to 120000.
>>
File: Untitled.png (32KB, 540x760px) Image search: [Google]
Untitled.png
32KB, 540x760px
>>60694310
Sorry, here is the picture.
>>
File: R-253315-1400928932-6062.jpeg.jpg (59KB, 600x470px) Image search: [Google]
R-253315-1400928932-6062.jpeg.jpg
59KB, 600x470px
>>60686563
start coding.
programming is an iterative process, you'll scratch and rework lots of ideas you had in your "design phase".
>>
>>60694323
is there an error?
>>
>literally using 2004 book for learning data structures
holy shiet
>>
>>60694439
Nevermind, I was just in the wrong directory so I didn't see the file. Sorry again
>>
>>60686563

You just code it.
>>
File: 1444540183460.png (258KB, 549x560px) Image search: [Google]
1444540183460.png
258KB, 549x560px
>>60686369
What programming languages could be considered a form of anime?
>>
File: nprime-big.gif (8KB, 528x384px) Image search: [Google]
nprime-big.gif
8KB, 528x384px
>>60694783
Piet
>>
why is working with files so fucking cancerous holy shit REEEEEEEEEEEEEEEEEEEEEE
>>
>>60694918
>doing any IO whatsoever
you dun goofed
>>
>>60694964
its part of a project i gotta do
i just do the main methods n shiet and when its time to test it on main and actually use a file i dont
id rather skip that shiit and get -10 points
>>
>>60690778
>So kernel is the only use case for optional GC in D?
Not only in D. GC isn't inherently bad however that's too hard for a /g/babby to fathom
>>
>>60695000
is this what it's like to be retarded?
>>
File: desudesudesudesudesu.png (312KB, 1038x455px) Image search: [Google]
desudesudesudesudesu.png
312KB, 1038x455px
hello im a beginner in image processing pls rate my code senpais

https://pastebin.com/raw/Sh3b6R55

inb4 java memes
>>
>>60695019
more like lazy
i just do the projects that got 1 month time in 2 days and skip the annoying parts that take a lot of time
>>
>>60695033
>4 inner loops
JUST
>>
File: 1473039954568.jpg (32KB, 347x425px) Image search: [Google]
1473039954568.jpg
32KB, 347x425px
>>60695033
System.out.println("colorRGB@(" + (d + blockStartX) + ", " + (c + blockStartY)
+ ") values@(" + colorAtXY.getRed() + ", " + colorAtXY.getGreen() + ", "
+ colorAtXY.getBlue() + ")");
>>
>>60695036

>pocastination

also a trait of retardation
>>
>>60695033
I don't know Java, but it looks pretty. Good formatting, anon!
But those loops are pretty bad indeed.
>>
>>60695033
>memes
>>>/v/
>>
So now that Kotlin is first class on Android, basically fuck Java forever?

Kotlin is doubly cool as it seems you can do some decent API shit if you want. Yes, you can do that in most languages (including Java) but most languages aren't first class on Android.
>>
>>60695053
stfu pajeet
dont u mean poocastination
>>
>>60695033
>import java.io
Stopped reading right there.
>>
>>60695082
Not programming.
Use >>>/g/wdg/ or some other shithole to discuss your retardation.
>>
Anyone here watch Silicon Valley? I was sceptical because normies kept recommending it but I watched it and it's like watching us but depicted in a fictional drama/comedy. And it's very good.
>>
>>60695106
>Kotlin
>Java
>Not programming
Time to actually kill yourself anon
>>
how do i get an input string from a user until he enters . in it in java? so like after entering . he cant type anything anymore
>>
>>60695051
>>60695047
>>60695065
i couldn't think of a better way ;..;

i want to be able to take the average values of red, green, blue at each rectangle as shown in my original post

the four loops aren't that bad desu,
they are essentially O(n) because the sum is equal to the x,y coordinates of the image
>>
How can I compute checksum of a file?

I know that I have to add the bits and find the remainder but where do I get those bits from?
>>
>>60695127
None of that is programming or even related to programming. Use some other thread.
>>
>>60695106
Fuck off.

>>60695082
I hope it gets a lot of traction. Seems like an alright language, at least compared to Java.
>>
>>60693182
Is she autistic?
>>
>>60695161
Oh fuck you, it is at least related to programming you fucking retard.
>>
>>60695180
You are new to the thread, aren't you?

Don't reply to the gatekeeper
>>
>>60695170
>promoting your web""dev""-like app ""dev"" poolangs
Use some other thread.
I suggest >>>/g/wdg/

>>60695180
Not even close.
>>
PLS HELP
trying to code mathematics addition gae, having trouble with it, tried for loop and for fucked sideways.

here it is:
package Math;
import java.util.Random;
import java.util.Scanner;

public class Math_Master {
public static void main(String[] args) {
//RNG
Random r = new Random();
//Scanner
Scanner s = new Scanner(System.in);
//set random integer values
int a = r.nextInt(10);
int b = r.nextInt(10);
//set random operator selector
int op = r.nextInt(3);
//operators to be called later
int add = a + b;
int sub = a - b;
int div = a / b;
int mul = a * b;
int I = s.nextInt();

switch (op) {
case '0':
System.out.println("please add " + a + " and " + b + ":");
if(I == add) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case '1':
System.out.println("please subtract " + a + " and " + b + ":");
if(I == sub) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case '2':
System.out.println("please divide " + a + " and " + b + ":");
if(I == div) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case '3':
System.out.println("please multiply " + a + " and " + b + ":");
if(I == mul) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
}
//}
}
}
>>
i'm actually reading about linux syscalls
what the fuck am i doing with my life
>>
I'm trying to code a simple menu system in C, using while() and switch cases. What I want to ask from you guys is: for clarity, should I used functions (and let the function deal with the menu), or should I nest if statements to hell? I ask this because it's a menu system that has submenus.

Kinda like this:
Choose your option:
1 - Buy
2 - Sell
3 - Wait

Choosing "Buy" would take you to a submenu.

1 - Buy with average
2 - Buy without average
3 - Go back to the main menu


So that's my question. Functions or nesting hell?
>>
>>60695199
Not new at all, I've undoubtedly been around /dpt/ way longer than any of the neo-g here but I haven't come in for a while. 4chode has changed drastically over the last 2 years (compared to the 7 before that) so nothing surprises me any more
>>
my crotch smells very lewd...
>>
>>60695237
Something actually useful and also incredible for once
>>
>>60695211
>>60695241
>trying to code
No. You're trying to "program", not "code".
>>
File: 1494973884126.gif (397KB, 480x270px) Image search: [Google]
1494973884126.gif
397KB, 480x270px
>>60686563
2 EZ. Just don't be a retard and apply a the shit you learned in school.

Use git, structs, separate your code, name files/functions accordingly, use conventional naming schemes, keep everything consistent (coding styles, etc) and draw a diagram with what you expect your overall code hierarchy to look like before you code it to not waste time. It's ok if you deviate from your major plan, but it'll just help to make things less overwhelming before you start.

Also, document as you go along.

This is all "no shit Sherlock" stuff though
>>
>>60695276
I'm koding with klossy, actually.
>>
>>60695211
What are you having trouble with?
Is it that there is no Text before you have to give an input?
>>
>>60695241
state design pattern. each menu is a state

https://sourcemaking.com/design_patterns/state
>>
>>60686563
What is one of the things you've been asked to do? This oughta be good for a few keks
>>
>>60686643
.PadLeft(4, '0')
>>
>>60695277
Not him, but
>apply the shit you learned in school
>draw a diagram
No one pays attention to Software Engineering classes. I think I forgot UML notation in the second semester. Some senior analist once asked me to draw a fluxogram for a function and I couldn't make heads or tails out of it.

All I'm saying is, some people just forget all about it once they're out of college.
>>
>>60695211
From what I can see.
1. You're asking for the user input before you even ask them a question to solve.
2. You have no loop to allow the user to retry after they fail (Hint: Use a while loop, not a for loop).
>>
>>60695296
no, it is that when i give an input no text is provided, which makes me wander if the switch operation is functioning as it should.
>>
any advanced resources to image processing? specifically image compression? i wanna look into making an image comparison website
>>
>>60695301
that is disgusting
>>
>>60695341
Read Gonzalez already?
https://www.amazon.com/Digital-Image-Processing-Rafael-Gonzalez/dp/013168728X/

Like a reference manual where you can find further reading material
>>
>>60695330
realized that i forgot a default case for the case operator. I will see if that fixes things before i try a loop.
>>
>>60695365
its the best way to do it
>>
>>60695337
For testing purposes you could set op to 0 to make sure its working properly, and add output to each step to attempt to find where you have a problem.
>>
>>60695378

that is one expensive nigga

any pdf? whats that russian website for textbooks called?
>>
File: IMG_5272.jpg (67KB, 640x303px) Image search: [Google]
IMG_5272.jpg
67KB, 640x303px
>mfw code is filled with millions of spaces and not one tab in sight
Learning Java in order to take up working on a Conversation Editor tool for the 3DS Fire Emblem games. I need the tool to help speed up the pace of a mod I'm working on with a few others to rewrite the awful story into something more tolerable, plus spice the gameplay up just a bit. The maker of the tool has been ded for 3+ months, so if I want to get anywhere, I need to take matters into my own hands. I'm familiar with C++, C#, and some C, so I've just been looking at stuff like how the class Pattern works. Anyone have any additional advice on learning Jave or how to approach this? I've already done the majority of work to restructure most of the code to make it more readable. Here's a snippet of what I'm working with:

    /**
* Matches a command to hide a character bust.
* Format: {$k{$p|\n}}?{$Ws(Name)\|}?$Wd{$w0\|}?
* $w0| can be pushed back to the end of a chain of control codes.
*/
private static final Pattern EXIT_PATTERN = Pattern.compile(
// Potentially match newline
"(?:\\$k(?:\\$p|\\\\n))?" +
// Potentially match Name
"(?:\\$Ws([^\\|\r\n]+)\\|)?" +
// Match $Wd
"\\$Wd" +
// Potentially match $w0|
"(?:\\$w0\\|)?");

/**
* Creates a game text converter for the given game text.
*
* @param text the text that the converter will convert
*/
public TextToScriptConverter(String text) {
if (text.startsWith("[" + XMLManager.getText("Script_Command_Script")) || text.startsWith("[" + XMLManager.getText("Script_Command_Formatted_Script"))) {
this.text = text;
finished = true;
}
else {
this.text = text;
finished = false;
gValues = new ArrayList<>();
type = 1;
}
}
>>
File: 1489778667270.jpg (708KB, 2560x1600px) Image search: [Google]
1489778667270.jpg
708KB, 2560x1600px
>>60695237
Having fun?
>>
>>60695441
>he komments his kode
>>
>>60695414
tried waht you said, output was default "programming is fucked":
package Math;
import java.util.Random;
import java.util.Scanner;

public class Math_Master {
public static void main(String[] args) {
//RNG
Random r = new Random();
//Scanner
Scanner s = new Scanner(System.in);
//set random integer values
int a = r.nextInt(10);
int b = r.nextInt(10);
//set random operator selector
int op = 1;
//operators to be called later
int add = a + b;
int sub = a - b;
int div = a / b;
int mul = a * b;
int I;
//while ()
switch (op) {
case '0':
System.out.println("please add " + a + " and " + b + ":");
I = s.nextInt();
if(I == add) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case '1':
System.out.println("please subtract " + a + " and " + b + ":");
I = s.nextInt();
if(I == sub) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case '2':
System.out.println("please divide " + a + " and " + b + ":");
I = s.nextInt();
if(I == div) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case '3':
System.out.println("please multiply " + a + " and " + b + ":");
I = s.nextInt();
if(I == mul) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
default:
System.out.println("programming is fucked");
}
//}
}
}
>>
File: 1492539702044.png (511KB, 836x964px) Image search: [Google]
1492539702044.png
511KB, 836x964px
>>60695328
Yeah, those are some of the most important classes you'll take. Developing for large codebases with 100+ other devs is such a headache without them.

Like with everything, you need to practice that sort of stuff. Even in small personal projects, just get in the habit of documenting shit, using repositories, making useful commits, and drawing basic diagrams.

Good documentation is essential and if you want the big bucks, you gotta know this stuff in and out.
>>
>>60695457
ah, yes, fun. that's the word.

i always wondered how they got those small components put on boards. i didn't know animey girls were so small. makes perfect sense for them to do this job.
>>
>>60695464
The comments are remnants of what the maker wrote. I personally don't comment cuz I'm lazy, though that's probably a bad habit to have.
>>
>>60695492
I found your problem, you're mismatching the types that you're comparing. A string "1" is not equal to an integer 1.
>>
File: 1494343229523.png (1MB, 1280x2045px) Image search: [Google]
1494343229523.png
1MB, 1280x2045px
hello /g/ i love u
>>
>>60695517
oh?
how to i make the case check for an integer then?
>>
>>60695524
don't put quotations .
>>
>>60695518
     public class love{
public static void main(String[] args){
System.out.println("i love you too anon");
}
}
>>
>>60695492
1 =/= "1"
>>
>>60695518
fuck off
also anime is for retards
>>
>>60695524
Putting something in quotes makes it a string. If you want to convert it to an integer drop the quotes. You're going to also have to cast the input to an integer to compare whether they are equal. I'll leave you to do some research and figure out how to do that.
>>
>>60695541
>>60695544 (nice double)
>>60695555 (nice quads)

It worked!
Console was as follows:
>please subtract 9 and 3:
>i input 6
>correct

here is the kode:
package Math;
import java.util.Random;
import java.util.Scanner;

public class Math_Master {
public static void main(String[] args) {
//RNG
Random r = new Random();
//Scanner
Scanner s = new Scanner(System.in);
//set random integer values
int a = r.nextInt(10);
int b = r.nextInt(10);
//set random operator selector
int op = 1;
//operators to be called later
int add = a + b;
int sub = a - b;
int div = a / b;
int mul = a * b;
int I;
//while ()
switch (op) {
case 0:
System.out.println("please add " + a + " and " + b + ":");
I = s.nextInt();
if(I == add) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case 1:
System.out.println("please subtract " + a + " and " + b + ":");
I = s.nextInt();
if(I == sub) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case 2:
System.out.println("please divide " + a + " and " + b + ":");
I = s.nextInt();
if(I == div) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case 3:
System.out.println("please multiply " + a + " and " + b + ":");
I = s.nextInt();
if(I == mul) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
default:
System.out.println("programming is fucked");
}
//}
}
}
[/code}
>>
>>60695579
I'm amazed the Java compiler doesnt catch this. I guess its one reason not to use switch.
>>
>>60695598
why don't we play switch ;^)
the compiler will never know ;^)
>>
>>60695553
You seem to be new here. All the *chan websites are born out of anime culture.
We apologize that seems to intrinsically trigger your plebbit sensibilities.
>>
>>60695579
You still need to wrap around your inputs with a
while(I != sum){
I = s.nextInt()
// correct input

//incorrect input
}
>>
>>60695663
i plan to wrap aoround the entire switch statement.
wish me luck.
>>
File: 1493940234527.png (553KB, 640x480px) Image search: [Google]
1493940234527.png
553KB, 640x480px
>>60695553
deal with it
>>
>>60695663
new problem:
same question is repeated 10 times.
here is code:
package Math;
import java.util.Random;
import java.util.Scanner;

public class Math_Master {
public static void main(String[] args) {
//RNG
Random r = new Random();
//set random integer values
int a = r.nextInt(10);
int b = r.nextInt(10);
//set random operator selector
int op = 1;
//operators to be called later
int add = a + b;
int sub = a - b;
int div = a / b;
int mul = a * b;
//Scanner
Scanner s = new Scanner(System.in);
//user input
int I;
for (int t = 1; t != 10; t++){
switch (op) {
case 0:
System.out.println("please add " + a + " and " + b + ":");
I = s.nextInt();
if(I == add) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case 1:
System.out.println("please subtract " + a + " and " + b + ":");
I = s.nextInt();
if(I == sub) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case 2:
System.out.println("please divide " + a + " and " + b + ":");
I = s.nextInt();
if(I == div) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
case 3:
System.out.println("please multiply " + a + " and " + b + ":");
I = s.nextInt();
if(I == mul) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
default:
System.out.println("programming is fucked");
}
}
}
}

I suspect i need to wrap a while() statement around every case.
>>
>>60695710
no friend look where you generate the random numbers
you only do it once
at this point you just gotta read your code
>>
anyone wants to be my programming gf/bf?
>>
>>60695710

im not sure how switch works but the variable 'op' is always 1?? wouldnt that make it choose case '1' all the time?
>>
File: 1493088708172.png (2MB, 1183x1815px) Image search: [Google]
1493088708172.png
2MB, 1183x1815px
What's the best Common Lisp implementation? CLISP boot is a jew-candelerier, yalmuk or whatever the fuck it's called! No fucking wat.
>>
>>60695824
SBCL
>>
>>60695803
set it like that for the moment to check for bugs and suchforth.
>>
>>60695824
The CLISP developers, both the original creators and the current maintainers, do not subscribe to the mainstream view that blames the Jews for everything from high oil prices and Islamic extremism to El Niño and global warming (or cooling, whatever the looming disaster du jour is).

Moreover, today, when Jews are being pushed out of the American and European academic institutions with various obscene boycott and divestment campaigns, it is crucial for all of us to stand together against the resurgence of Nazism.
>>
>>60690052
>it's not in production
That multi-billion company has some engineers trying out new things is hardly surprising you know.
>>
>>60695780
Depends. Let's see your programming socks.
>>
>>60695857
sorry I onlu have programming pantsu
>>
>>60695842
>>>/lgbt/
>>
>>60695872
post pics please
>>
>>60695842
Cool story bro but I don't want a goddamn jew torch on my face every time I open REPL.

>>60695837
oh nice that's in repos too, thanks
>>
>>60695824
the best free is steelbank common lisp
dunno about the paid ones.
>>
>>60695824
Consider ECL too if space is an issue
>>
File: eirin_rape.png (28KB, 237x269px) Image search: [Google]
eirin_rape.png
28KB, 237x269px
>>60695872
>>60695881
This.
>>
>>60695710
You have op initialized to 1 and your random numbers are only chosen at the beginning when you start your program.
You have to put your random number generator within your loop.
You don't have to have to have to wrap around every case you could wrap around your switch statement if you declared a Boolean
bool correct = false; 
for(I = 0; I < problems_ammount; I++){

while(correct != true){
//switch statement

//within a case

if(I == sum){
correct = true;
print("correct");
}
else{
print("retyr");
}
// out of case

//out of switch
}
}


>>60695803
Yep, but I think they were just testing it.
>>
>>60695824
ABCL
>>
>>60695881
>>60695909
sorry this is the programming board, not the pantsu board
post some code
>>
>>60695927
those capital i's were supposed to be lowercase i's or any other different variable
>>
>>60695930
get that jvm shit out of here!
>>
>>60695927
and the correct bool has to reset to false within every for loop such as
for(loop){
correct = false;

while(loop){
//switch statement
}
}

>>
>>60695935
if(benis)
while ~cum
boipucci.push_back(cock);
end;
boipucci.push_back(semen);
end;
>>
>>60696053

why 'end'??
>>
File: 1365397911945.png (62KB, 486x551px) Image search: [Google]
1365397911945.png
62KB, 486x551px
Is it possible for this old program to be fixed
>>
>>60695927
already fixed that problem by replacing "int a = r.nextInt(); - with - int a; and then calling it in each case as a = r.nextInt();
only problem is that now all the integers are massive
for example: please add 1028573957 + - 849057593729.
I'm new so i have no idea how to fix this.
>>
What's the best practice for touch interface buttons? To activate the function when the button is pressed, or when the user lets up, or what?

I'm working on a project and I have it set for when pressed but if I press and hold the app goes nuts and keeps repeating the code until I release.
>>
>>60696096
do you have the source code?
>>
>>60696086
You don't want me to end? Fucking succubus
>>
>>60696140
idk try reading the Random docs to see if you can limit the size of the int from nextInt somehow
>>
>>60696169
would if i could find the docs.
unfortunately it is like finding a needle in a java library so i wont within the next century.
>>
>>60696169
Wait i think i figured out a solution.
>>
>>60687796
>basically im giving you this extremely high level explanation thats practically useless
>>
>>60686671
I find your vision to be an enlightening beautiful human experience, may this reach an artist with an abundant imagination and endowed with the finest fingers so we could all see it be born in beautiful visual form.
>>
File: IMG_4018.jpg (258KB, 955x911px) Image search: [Google]
IMG_4018.jpg
258KB, 955x911px
>>60695441
>look at all those fucking spacesssssss
Fucking why
>>
>>60696169
here is final working product:
package Math;
import java.util.Random;
import java.util.Scanner;

public class Math_Master {
public static void main(String[] args) {
//RNG
Random r = new Random();

//set random operator selector
int op = 1;
//random integer values
int a;
int b;

//Scanner
Scanner s = new Scanner(System.in);
//user input
int I;

//operators
int add;
int sub;
int div;
int mul;

//integer variable range
System.out.println("please input numerical range:");
int range = s.nextInt();

for (int t = 1; t != 10; t++){
switch (op) {
//addition
case 0:
a = r.nextInt(range);
b = r.nextInt(range);
System.out.println("please add " + a + " and " + b + ":");
add = a + b;
I = s.nextInt();
if(I == add) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
//subtraction
case 1:
a = r.nextInt(range);
b = r.nextInt(range);
System.out.println("please subtract " + a + " and " + b + ":");
sub = a - b;
I = s.nextInt();
if(I == sub) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
//division
case 2:
a = r.nextInt(range);
b = r.nextInt(range);
System.out.println("please divide " + a + " and " + b + ":");
div = a / b;
I = s.nextInt();
if(I == div) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
//multiplication
case 3:
a = r.nextInt(range);
b = r.nextInt(range);
System.out.println("please multiply " + a + " and " + b + ":");
mul = a * b;
I = s.nextInt();
if(I == mul) {
System.out.println("correct");
} else {
System.out.println("retry");
}
break;
//error message
default:
System.out.println("programming is fucked");
}
}
}
}

try it, i insist.
>>
>>60687349
Elvis Pressley has the left building.
>>
>>60696151
I lost my copy from 2014 but the most recent source code I know of is https://github.com/hurr/DelayClose
>>
>>60696274
then, yes. start hacking bub
>>
>>60696262
u liek?
>>
>>60696274
>everything is inside of a single 3k lines file
>>
>>60686419
https://shodan.me/books is back up
also https://shodan.me/readme.txt
>>
While I'm at it, have something neato: https://pixel.shodan.me

It might be slow at the moment but that's because my workers are still spinning up.
>>
File: IMG_5946.png (66KB, 150x180px) Image search: [Google]
IMG_5946.png
66KB, 150x180px
>>60695441
Matcher match = SCRIPT_SYNTAX.matcher(text);
String type = null;
while (match.find()) {
if (match.group("SPEAK") != null) {
type = "SPEAK";
}
else if (match.group("EMOTION") != null) {
type = "EMOTION";
}
else if (match.group("LONEEMOTION") != null) {
type = "LONEEMOTION";
}
else if (match.group("NU") != null) {
type = "NU";
}
else if (match.group("G") != null) {
type = "G";
}
else if (match.group("ENTER") != null) {
type = "ENTER";
}
else if (match.group("EXIT") != null) {
type = "EXIT";
}
else if (match.group("SOUNDEFFECT") != null) {
type = "SOUNDEFFECT";
}
else if (match.group("BGM") != null) {
type = "BGM";
}
else if (match.group("PERMANENTS") != null) {
type = "SCRIPT";
}
else if (match.group("TYPE") != null) {
type = "TYPE";
}
else if (match.group("SCRIPT") != null) {
type = "SCRIPT";
}
else if (match.group("TEXTCOLOR") != null) {
type = "TEXTCOLOR";
}
if ((len = match.start() - last) > 0) {
builder.add(Collections.emptyList(), len);
}
if (type != null) {
styleText(type, match.group(0), builder);
}
else {
builder.add(Collections.emptyList(), match.end() - match.start());
}
last = match.end();

This can't be necessary. Can't Java do switch cases in this situation? There can't be a reason to have this many else if checks.
>>
>>60696500
>https://pixel.shodan.me
nice meme anon.
>>
File: 1495766556416.gif (3MB, 286x258px) Image search: [Google]
1495766556416.gif
3MB, 286x258px
>>60696530
>>
>>60696547
Going through this person's old code in and of itself is a trial in patience. Thank god they commented everything so I at least have some idea of what the fuck is going on, and notepad++ makes restructuring and rewriting less of a pain than it could be, but goddamn.
>>
>>60696249
I hear that java tends to be quite overencumbred in terms of code, is this true?
also: should such a simple java program be near 100 lines of code in length?

also: how do i determine the size of this?
>>
Can someone redbull me on smart pointers? Why wouldn't I just RAII my containers?
>>
>>60696656
smart pointers are a meme
>>
>>60696584
It can get wordy, but that code looks horribly excessive for what it's doing.
>>
>>60696656
Smart pointers are basically a way of doing RAII "silently", without the programmer having to worry about it themselves.
>>
>quit smoking
>head hurts like a bitch
>can't focus on my work
it will get better, right
>>
>>60696884
Of course it will you moron
>>
>>60689746
>tfw
can be used without quoting someone you mega nerd
>>
>>60696800
any way to streamline it?
>>
>>60696656
>meme
>>>/v/
>>
>>60689841
This is done a lot using shells, why don't you look up how it is done in bash and then try to map those commands into python code.
This is as far as I'm going to help suspicious home work beggars.
>>
>>60697216
Few things, but none of them are specific to java:

        //operators
int add;
int sub;
int div;
int mul;

could be compacted into a single var called, say, result.

You can call a/b = r.nextInt() before the switch statement.

Single-line if statements are almost always more readable as a single line including the if. Especially if the program isn't doing something it seems like it should be doing in allowing the user to retry in the event of an incorrect answer:


            if(I == add) {
System.out.println("correct");
} else {
System.out.println("retry");
}

could be:
System.out.println( (I == add ? "correct" : "retry"));


For program flow, you should be getting user input in the line following the prompt.

Don't mean to be too harsh, but good code is critical
>>
>>60697393
new thread though
>>
>>60697367
>//operators
> int add;
> int sub;
> int div;
> int mul;
>could be compacted into a single var called, say, result.
how though?

>System.out.println( (I == add ? "correct" : "retry"));
My book mentions this, apparently it is called the ternary operator.
is i understand it, the statement says:
if I = add is true, then use the string value "correct", elsewise use the string value "retry".
I think i will try that, be back with new code soon.
>"dont mean to be harsh, but..."
dont worry anon, im a beginner and expect beginner incompetence from myself.
>>
>>60694107
>it verifies the SHA1 fingerprint of the key that signed the .apk file.
So? Send them a different one, the real one.
>>
>>60697529
Rather than using a separate variable, use one variable in every function.

In the multiply function, result would be
result = a * b;
if (I == result){
//etc
}


and adding would be:
result = a + b;
if (I == result){
//etc
}


A good practice is to remember to not repeat yourself. It's not something that you should worry about too much as a beginner, but it's better later on.

Once you change all of the variables to be the same, think about how you can put as little code in each switch statement and have the same result.

Try it out, and come back if you need some help!
>>
>>60698251
good point.

btw, im having trouble implementing a scoring system but i will see if i can struggle though the challenge before i come here for help.

Thanks for all the help so far, btw.
>>
>>60698312
I would focus on what you have so far before adding a scoring system.
Thread posts: 363
Thread images: 49


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