[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: 353
Thread images: 39

File: hime c.png (1MB, 1280x720px) Image search: [Google]
hime c.png
1MB, 1280x720px
old thread: >>57739205

What are you working on, /g/?
>>
File: it's a trap.png (873KB, 1275x677px) Image search: [Google]
it's a trap.png
873KB, 1275x677px
Thank you for using an anime image
>>
Finding something to work on
>>
>>57745118
New to Pillow (Python). Can I use it to read metadata from .pngs?
>>
>>57745135

I need a bunch of data input for my project. u game?
>>
I'm trying to learn C and I need the insert function to return a pointer to the entire linked list (the head of the list), but I can't seem to figure out how to do it. Any advice /g/?

struct node {
struct node *next;
int num;
} Node;

Node *insert(int i) {
Node *head;
for (int c = 0; c < i; c++) {
head = malloc(sizeof(Node));
head.num = i;
head = head->next;
}
return [pointer to entire linked list]
}
>>
>>57745250
Well first of all you need a list to insert into.
>>
>make popular open source software
>one day introduce a bug
>break things for millions of people
>cause untold lost productivity
>face zero accountability for this
Is it time to regulate programming?
>>
pseudo code for a three interface scheme.

it mixes ( muxes? ) three template interfaces, whatever that might be called, and outputs to file as an image and to terminal.

Just trying to be creative for now, really. I tried reading my java book and couldn't do it. Tried that 'code' book again and couldnt do it. I need a new structure. I am so bored.
>>
cdecl> explain void ***(*const arr[][])()()()

declare arr as array of array of const pointer to function returning function
returning function returning pointer to pointer to pointer to void

>this is syntactically valid C
>>
File: wholikesit.png (82KB, 877x1005px) Image search: [Google]
wholikesit.png
82KB, 877x1005px
Is this code acceptable? I have no idea about bad coding practices.

I plan on creating a class just to deal with the coordinate system conversions, so the logic in pic related is much much simpler.
>>
>>57745268
I already told you to use matrices (and vectors by extension instead of treating X and Y separately everywhere).
>>
>>57745268
is this supposed to be a single function?
>>
>>57745268
>// ~ COMMENT ~
Why?
>>
>>57745262
I figure I could interlace the images with fraps and make a gif and have that act like a clever way of checking that my output and such are correct. Going from color text online to black and white text to my text editors color scheme is a bit much.
>>
>>57745262
I mean vdub not fraps. Im currently on auto pilot. I'm not good at auto pilot. lol.
>>
>>57745250
non-retarded syntax

struct node {
struct node *next;
int num;
} Node;

Node *insert(int i) {
Node *head;
for (int c = 0; c < i; c++) {
head = malloc(sizeof(Node));
head.num = i;
head = head->next;
}
}
>>
>>57745268
Your struct member names are too fucking long, it makes the code hard to read as you're reading the same thing over and over.

Your variable name length should correlate with the width of scope.
>>
Indent 2, 3, 4, 5, or 8 spaces?
>>
>>57745265
ita beautiful, but how do you figure in the three set of paren?
>>
>>57745118

boy qt;
girl hime = (girl) qt;
>>
>>57745259
Isn't it making a list in the function though?
>>
>>57745282
Don't lie, I haven't spoken to you before
But I will do this, thanks

>>57745288
It is. It was originally 2 functions, but they needed updating at the same time so I made it into one. I then added a bunch more code.

>>57745289
To make it easy to see

>>57745315
Half of it was written by someone else, I'm just calling it.
I agree with what you're saying, but I would get confused what is what, if it was all abbreviated
>>
>>57745326
Tabs with width of 2 in the editor.
>>
>>57745347
>boy qt
compiler error
>>
>>57745326
4. the higher your indent spaces is at, generally the more of a programming sage you are (cap is 8 though)
>>
>>57745347
girl *hime = (girl *) sizeof(boy);
>>
>>57745326
3 for headers and conditionals
and 4 for working expressions
>>
>>57745351
>>>/vg/161364001
>>
>>57745365
Why are you casting the return value of sizeof?
>>
>>57745351
>It is. It was originally 2 functions,
it's a clusterfuck. fix it
>>
>>57745382
>it's a clusterfuck. fix it
Will do. I'll post progress tomorrow

>>57745377
Ah, I stand corrected. I'll use Vector2's, but I don't see how matrices would make it easier
>>
File: Screenshot_20161128-220745.png (687KB, 1440x2560px) Image search: [Google]
Screenshot_20161128-220745.png
687KB, 1440x2560px
I'll pay someone $50 to do this by the end of tomorrow.

It's C# if you can't tell. Its not hard at all I just don't have any time to do it.
>>
>>57745365
girl *hime = (girl *) malloc(sizeof(boy));

Shame, anon.
>>
>>57745463
>I just don't have any time to do it.

Why not?
>>
>>57745471
It's finals week and I also work full time.
>>
File: strong typing haskell.png (33KB, 552x328px) Image search: [Google]
strong typing haskell.png
33KB, 552x328px
>>57745470
reminder
>>
>>57745470
i meant to post it without the malloc.
>>
File: 1462115856852.jpg (36KB, 362x478px) Image search: [Google]
1462115856852.jpg
36KB, 362x478px
>>57745485
>implying a girl is just a number
>pointing to a girl in the first place
ultimate rude
>>
>>57745463
I'll do it for $1k
>>
>>57745463
I need the money. Hit me up anon.
>>
File: aaa.png (266KB, 765x1045px) Image search: [Google]
aaa.png
266KB, 765x1045px
How do I learn JavaScript senpai?
>>
>>57745483
Is there a vim plugin for atom?
>>
>>57745436
Actually for this particular code matrices aren't all that useful since you're just translating. But in general they make going between coordinate systems really easy.

There's a lot of duplication in that code that can be resolved with vectors. You're essentially doing the same thing twice, once for X and once for Y. With vectors you can do it all at once. Also you're duplicating some stuff when clamping which you wouldn't have to if you used a clamping function, though that's not vector specific. You can also factor out those repeated things like mapSetUp.getMapPixel*() / LibPractice.PPM.

There are a lot of ways to improve that code, you need to look into reducing duplication.
>>
>>57745529
Trepanation
>>
>>57745531
https://atom.io/packages/vim-mode-plus
>>
>>57745562
cheers m8
>>
>>57745514
Email me at [email protected]

>>57745503
Too steep for me.
>>
File: 1413090181218.png (68KB, 1000x984px) Image search: [Google]
1413090181218.png
68KB, 1000x984px
>tfw i've been learning programming for months and i still can't code fizzbuzz

I'll get there eventually.
>>
So I have an object passed into a function, but I don't want to access it. I need to access it's base class instead.


class Derived : public Base {
//code goes here
}

void function(const Base& base) {
//code goes here
}



I know how to get to the base class if I'm working with a method function in a derived class of the base, but not if the function isn't.
>>
>>57745581
If you want to write FizzBuzz, you need to learn Haskell. Other languages are only good for actually useful applications.
>>
>>57745581

It's all about modulo with that one. You can be super advanced in other things but if you haven't bothered to learn how to use modulo then you're screwed (unless you're doing fizz buzz in some over complicated way I guess).
>>
>>57745581
Here's a C implementation for you:

int64_t f(uint8_t n)
{
if (n <= 1) return n;
if (n > 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

return d;
}
>>
File: output.webm (427KB, 640x480px) Image search: [Google]
output.webm
427KB, 640x480px
I'm working on cross-thread redirection for akari-bbs!
Should I precompute URLs in advance or should I just let redirects do their thing?
>>
>>57745547
workin on the remake?
ty
book was priceless
>>
>>57745177

i have done this quite a few times, most recently to read TEXT chunks from PNGs
>>
>>57745585
I think you're specifically not supposed to be able to do that ever, that's like, the entire point of overriding functions.

>>57745616
Nice log(n) fibonacci anon
>>
Ignoring all the SJW bullshit, is Rust worth learning?
>>
>>57745616
Does this function do everything?
>>
>>57745633
Yes, it's practically just a more sane version of C++.
>>
>>57745633
It's probably better to just skip it and go straight to ocaml or haskell and not some meme go-between
>>
My job is designing hybrid crypto algorithms and enterprise dynamic authentication and behavioural biometrics. My pet project is a semantic file system with an "AI" that tags files automatically with relevant data.
>>
>>57745637
Check the TempleOS commit log, it's used in the talk-to-god program.
>>
So I improved the physics a bit, it should work better on big threads now

http://korbo.ga/{board}/thread/{thread}
http://korbo.ga/g/thread/57745118
(Mousewheel to control the camera)
>>
File: 1452928617945.jpg (22KB, 225x225px) Image search: [Google]
1452928617945.jpg
22KB, 225x225px
>>57745604
kek
>>
>>57745654
Fascinating, anon
>>
>>57745609
Badbuzz is life.
>>
File: koo.png (180KB, 1920x1080px) Image search: [Google]
koo.png
180KB, 1920x1080px
>>57745662
Forgot pic
>>
>>57745662
This is fucking horrible but in the best way I love it anon
>>
>>57745666
Thanks, Satan.
>>
>>57745649
That's nonsense.
>>
File: 1461388282016.png (736KB, 1050x870px) Image search: [Google]
1461388282016.png
736KB, 1050x870px
>>57745666
Delete this post
>>
>>57745646
But, in saying this, you probably have to really appreciate what's wrong with C++ to be able to appreciate what's good about Rust. Without that it seems kinda like a meme language.
>>
>>57745604
>>57745581
Haskell implementation:

main = do
putStrLn "1"
putStrLn "2"
putStrLn "Fizz"
putStrLn "4"
putStrLn "Buzz"
putStrLn "Fizz"
putStrLn "7"
putStrLn "8"
putStrLn "Fizz"
putStrLn "Buzz"
putStrLn "11"
putStrLn "Fizz"
putStrLn "13"
putStrLn "14"
putStrLn "FizzBuzz"
putStrLn "16"
putStrLn "17"
putStrLn "Fizz"
putStrLn "19"
putStrLn "Buzz"
putStrLn "Fizz"
putStrLn "22"
putStrLn "23"
putStrLn "Fizz"
putStrLn "Buzz"
putStrLn "26"
putStrLn "Fizz"
putStrLn "28"
putStrLn "29"
putStrLn "FizzBuzz"
putStrLn "31"
putStrLn "32"
putStrLn "Fizz"
putStrLn "34"
putStrLn "Buzz"
putStrLn "Fizz"
putStrLn "37"
putStrLn "38"
putStrLn "Fizz"
putStrLn "Buzz"
putStrLn "41"
putStrLn "Fizz"
putStrLn "43"
putStrLn "44"
putStrLn "FizzBuzz"
putStrLn "46"
putStrLn "47"
putStrLn "Fizz"
putStrLn "49"
putStrLn "Buzz"
-- too many lines, but it continues similarly
>>
>>57745210
Depends but probably
>>
>>57745712
main = mapM_ putStrLn ["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz","16","17","Fizz","19","Buzz","Fizz","22","23","Fizz","Buzz","26","Fizz","28","29","FizzBuzz","31","32","Fizz","34","Buzz","Fizz","37","38","Fizz","Buzz","41","Fizz","43","44","FizzBuzz","46","47","Fizz","49","Buzz"]
>>
>>57745689
It's a clusterfuck, I know. I love how complex 4chan discussions can be unlike the simple tree approach of reddit.

The problem is there is no (expect in very few special cases) optimal graph that match the spacing around all nodes. Sooo
>>
>>57745745
Not stack safe if it happens to be implemented in terms of foldr

https://issues.scala-lang.org/browse/SI-2818
>>
>>57745767
use a genetic algorithm
>>
>>57745771
>stack-safe
what is this meme?
haskell is lazy
>>
>>57745771
>Scala
Why did you feel this was relevant?
>>
File: a.png (18KB, 519x325px) Image search: [Google]
a.png
18KB, 519x325px
>"Maybe I'll give atom a try!"
>5 minutes later it finally loads

What the fuck??
>>
>>57745873
Scala is the best functional programming language today.
>>
>>57745885
Regardless of whether that is true or not, Scala is not Haskell.
>>
>>57745873
>>57745885
I strongly believe we should either
(1) preferably, fix this issue as Paul C. proposed;
(2) deprecate the function and all other non-tail-recursive functions;
(3) issue a clear warning at compile time about stack overflow problems when the function is encountered;
(4) provide a "safeFoldRight" function that won't trigger stack overflows, and similarly for other dangerous functions.


OH BOY IM LAFFIN
SCALA LITERALLY IS THE WORST OF BOTH WORLDS (JAVA and Haskell)
>>
>>57745885
Scala is the worst
>>
>>57745617
Precomputing the url at posting time should be more efficient
>>
>>57745874
Sublime is the /dpt/ approved text editor.
>>
File: sss.png (32KB, 300x135px) Image search: [Google]
sss.png
32KB, 300x135px
Is this enough to host my own static website, lads?
>>
>>57745118
Please don't post anime next time. This is a tech related board
>>
>>57745997
It's enough to host 4chan.
>>
>>57745927
/dpt/ doesn't approve of anything
>>
>>57746040
I disagree.
>>
>>57745997
Depends on what type of content you're hosting and how much traffic you expect.
>>
>>57746027
Anime website
>>
>>57746027
Isnt this technically an anime website?
>>
>>57746040
Except Python.

Python is /dpt/'s favourite programming language.
>>
File: 1462517271416.png (32KB, 570x354px) Image search: [Google]
1462517271416.png
32KB, 570x354px
>>57745997
pussy. get rekt faggot

>united kingdom internet
>>
>>57745921
By doing that, I'd be hard-coding urls and html anchor links into the comment text itself, and if I ever make a change to site internals, all the old links will break.
>>
>>57745540
Once the coordinate systems are all the same, I'll do this.

Currently it has to all be duplicated, as the y axis is sometimes negative and sometimes positive, so it can't be copied over from x.
>>
>>57746069
>technically
clearly*
>>
>>57746112
Thank you
>>
>>57746108
Multiplying a vector componentwise by (1, -1) will sort that out.
>>
>>57746063
I guess if I have a 1Mb site it would it would be fine handling 18 requests a second? Is that a good way to gauge?

>>57746090
A-at least I win on download. ;_;
>>
>>57746093
You could still make the 404 page redirect to the new link if it happens
>>
>>57746150
That sounds like a dirty hack.
>>
>>57745585
That sounded weird so let me share something with you

If you have the derived class, you have the base class. If you want to access it as the base class then cast it before you access it.

Derived obj = new Derived();
(( Base )obj).functionInBase();
>>
>>57746064
>>57746069
It's an American offshoot of a Japanese discussion forum.

Anime belongs in /a/. Otherwise, if you suggest that this is an Anime website, then it'd be acceptable to post anime in /k/, /fit/, /sp/, /sci/, and /o/

I post on 3 out of the 5 I listed above, and very rarely do people post anime in those boards. /g/ is the only board I post in where people regularly post anime.
>>
>>57746108
>>57746125
Also you don't need to convert absolutely everything to using vectors when the componentwise is simpler. But there's a lot to gain from taking the million times you reference
mapSetUp.getMapPixel*() / LibPractice.PPM
and putting it in a much shorter variable. And using min/max/clamp instead of if (a <= b) { a = b; } if (a >= c) { a = c; } where b and c are long as fuck.
>>
>>57746192
>/k/, /fit/, /sp/
Literally containment boards for normies.
>>
>>57746027
Would you complain if someone used a picture from a TV show, Western cartoon, or video game?
>>
>>57746192
>WHY ARE YOU READING BOOKS IN THE COFFEE SHOP INSIDE THE BOOKSTORE???
>>
>>57746125
Will do, it will all be universal by tomorrow. Yay.

I have A grades in maths and physics at college, but I've never needed anything that difficult whilst programming.
Will it ever get harder, or will it always be things that can be known via intuition, rather than education, eg. multiplying a vector by (1, -1)
>>
>>57746192
Doesn't complaining about it cause more trouble than ignoring it?
>>
File: 1457290113088-1.png (72KB, 200x200px) Image search: [Google]
1457290113088-1.png
72KB, 200x200px
>>57746192
see >>57746220
the point is it's an anime community, and that the overwhelming majority should think favourably of anime

acknowledging that 4chan is a weeaboo website does not mean you have to start discussing keit-ai in /g/
>>
I'm not even an anime fag but I consider those that complain about anime posting on a (let's face it) anime image board like 4chan fucking idiots. Everything after anime/weeb culture on this second technically comes second.
>>
>>57746207
I would if they continuously spammed it while providing no substance to the discussion.

See: MLP, Doctor who fans, and literally any fanboy of any show in existence.

>>57746261
And as I've shown with numerous examples. /g/ is the exception, not the rule.

Non-anime watchers have overtaken anime watchers on 4chan. For a good while as well. 4chan is no longer a weeaboo website. It is a discussion website with a portion of the community being weeaboos.
>>
>>57746195
So I'll have a class with all the new variables in.
Should I have them all public, or use getters and setters?

I've also never used static before, but I would use it for this task, correct? eg.
private static float varX;

public static float getVarX() {
return var x;

}
>>
>>57746292
No, static means it's more like the class itself owns that variable rather than an individual instance. And you don't want to use a private like that.

All that said, you probably just want them as local variables in the function itself.
>>
>>57746027
Cry more lol
>>
>>57746292
>float varX
>getVarX
>setVarX
don't do this

>>57746290
There are no exceptions, otherwise it wouldn't be a rule

>4chan is no longer a weeaboo website
False. Even if the majority of 4chan visitors are not weeaboos, 4chan isn't defined simply by the traffic it generates.

When /pol/, /v/, /gif/ etc die down, the site will go back to normal.
>>
>>57745483

what IDE is this?
>>
>>57746307
I want them to be global, as I'll need them in a few dozen classes.

If my variables are in the class ClassExample, how do I access them without having to write

private ClassExample classExample

public Class(ClassExample classExample) {
this.classExample = classExample

}


In every class I want to access them from
If it's not static?
>>
>>57746361
editor atom/font firacode/theme one dark
>>
>>57746330
>False. Even if the majority of 4chan visitors are not weeaboos, 4chan isn't defined simply by the traffic it generates.
With what metric would you define what a website is or is not, then?

If 4chan had a burst of bronies everywhere, wouldn't that make 4chan a brony website? Since the culture of the website shifted to more MLP related content

>When /pol/, /v/, /gif/ etc die down, the site will go back to normal.
You mean if
>>
>>57746330
>float varX
>getVarX
>setVarX
don't do this

I wouldn't use the name varX, I'd call it something with meaning. Or is there another reason why this is bad?
>>
>>57746370
>I'll need them in a few dozen classes
That sounds like a big problem to me. If you're duplicating this code for going from world to screen space everywhere then I think you need to think about separating your logic from presentation. Do all your logic in world space (or local space) and have some "central" rendering system deal with going from there to screen space. Your input system would do the opposite.
>>
>>57746376
Popularity means shit here. That's the whole reason it's anonymous.

If cancer spreads on 4chan then it dies.
>>
>>57746374

thanks, wow nice
>>
>>57746376
>
Culture isn't something you can easily describe in a sentence, and it's about identity too. If a bunch of people raid a farm that doesn't make them farmers

>
No, I mean WHEN.

>>57746381
If you have a setter and a getter that do nothing else then you should just make it public
>>
>>57746370
Since there's always a main class, you can import it to the class or declare them in the main class and they will always be available since main is at the top of the runtime heirarchy.
>>
>>57746406
>If a bunch of people raid a farm that doesn't make them farmers
Right. but if people raid a farm, stick around for a few months, participate in country culture, but also bring in aspects of city life, that makes them farmers.

Why am I even describing this to you, you can't even greentext correctly.

>No, I mean WHEN.
No, you mean if.
>>
>>57746399
The physics engine uses a different coordinate system to the camera, which uses a different coordinate system to the Android device touch input.
I have no control over these, and separating the logic from the rendering system is meaningless, as there are a few different rendering systems.

But I think I know what to do to make it neat and tidy and readable.

Thanks for the help and the fast replies
>>
>>57745260
Their fault for not testing the software updates. Also depends on what the licence says.
>>
>>57746447
>you can import it to the main class
How would I do this, without making the main class all messy with 30 lines for 30 variables?
>>
>>57746451
>Right. but if people raid a farm, stick around for a few months, participate in country culture, but also bring in aspects of city life, that makes them farmers.
No it doesn't
If they don't farm they aren't farmers
It's not about who happens to be there currently
>>
>>57745265
>would want a language where you couldn't declare this
I want my static type checking thank you.

Imagine doing that in python..
>>
r8
module fizzbuzz();
logic fizz, buzz;
logic [6:0] cnt;

initial begin
fizz <= 0;
buzz <= 0;
cnt <= 1;
#500; $finish;
end

always begin
#5; #5;
fizz <= 1; $print("Fizz"); #5;
end

always begin
#5; #5; #5; #5;
buzz <= 1; #1; $print("Buzz"); #4;
end

always_comb begin
cnt <= cnt + 1;
if (fizz) fizz <= 0;
if (buzz) buzz <= 0;
if (!fizz && !buzz)
$print("%d", cnt);
$print("\n");
end
endmodule
>>
>>57746481
>If they don't farm they aren't farmers
What do you think I meant by
>participate in country culture
>>
>>57746486
Looks p. goddamn awful
>>
>>57746454
Canonicalizing your various coordinate systems isn't more than a few linear transformations.

Why write a bunch of classes n shit when all you need is 3 functions?
>>
>>57746481
I think what you are trying to say is if you don't have knowledge your opinion doesn't matter.
>>
>>57746495
Nobody's saying that if they start posting anime reaction images and discussing whether re:zero is secondary garbage that they aren't real 4chan users
>>
>>57746467
write a class file without the main function, stick it in tje same folder as the class with the class that handles yourbmain function and import the class file in your main class the same you'd import any other class. The difference is that your utility class with the static functions would not br packaged until you yourself declared a package.

A jar file, the literal exe for your java program, is just a zip file, ergo compressed directory, that can be executed by the java runtime

That is java, right? It might be C#, what do I know. If so, though, same thing applies just use 'using' or 'include'. I forget.
>>
>>57746501
It's more complex than you think, there's a bunch of features manipulating the coordinate systems making my life difficult, I would explain, but I'm going to bed.

Thanks again for the help

>>57746521
This is clever, thanks anon
>>
Ok, pascal is pretty neat and all.

But why
WHY
are variables declared with ":", but types with "="?
It's driving me fucking crazy.

So "=" is for comparison and not assignment. Except for when declaring types.
:= is for assignment.
: for declaring variables.

: never gets used anywhere else, so why not use := for variable declaration as well, since there's a separate, mandatory block for variable declarations. or "=", since type declarations also have their own block
so there wouldn't be any syntax confusion

why have :=, :, and =, when = already means a completely different thing and : is never used again?
>>
>>57746568
Maybe they were just stupid anon? Maybe they were concerned with how to parse the code effectively. It's an old language.
>>
Why are non-functional languages so lackluster?
I don't even mean them not being functional.
I just mean the lack of any kind of thought or basic principle behind their design.

Think of "OOP" languages for instance. Java, C#, maybe C++. All of them are just additions to other languages, with minor extra features, mostly the same semantics, different libraries.

Why bother?
There are some languages like D that are quite substantially different, you can at least tell that they're trying.
Rust and Go are sort of on the way, but they just end up seeming like they were poorly thought out. Go is just the minimalist meme, where people have avoided or actively dropped ideas just because. Rust is just the multi-paradigm meme, with some extra safety.

They're always so verbose for any kind of problem. The solutions are often hacks. People don't really enjoy using them. They aren't very composable, or re-usable, and I don't just mean brittle OOP heirarchies.

At the moment it seems like Ada is the only interesting language.

>>57746568
= indicates equality
:= indicates assignment
Types don't get mutated.
>>
>>57746586
I think "=" for type declarations is an ugly remnant of when OOP was being added on top of pascal by a bunch of literallywhos.

Niklaus Wirth wouldn't have fucked up like that.
>>
>>57746616
Because P=/=NP.
Abstraction is a meme.
>>
>>57746616
>Rust is just the multi-paradigm meme, with some extra safety.
Rust is basically OCaml with affine types and no GC.
>>
>>57746645
I can definitely see people using Rust over Ocaml, but does rust have implicit currying?
>>
>>57746660
No. Actually it's even less multi-paradigm (leaning more functional) then even OCaml aside from the no currying.
>>
just learning sam's regex language now. holy fuck it is useful. so easy to understand
>>
>>57746672
Could you do a macro for auto currying?
>>
>>57746616
Well the examples you mention have reasons for being crap:
C++ is a language made by someone with no idea of what makes a language good. He just wanted objects in his C. The committee that followed was just a mess.
Java has had commercial goals all along. It hasn't been about pleasing programmer it has been about pleasing management.
Similarly C# is just the windows specific of that.

A large part of why they're popular is the way you can move between them. They're all arguably C-like.

The thing about functional languages is that nobody used them seriously. Not to any major extent. So you didn't have to be just like the earlier languages. You could make your own thing.
If you're from an imperative programming background and you make a language you have reasons to stay with C-like. You deal with the issues you set out to deal with. If that conflicts with being similar to C? Well too bad I guess it's not happening then.
>>
>>57746679
>sams regex language
Link?
>>
>>57746722
http://doc.cat-v.org/bell_labs/sam_lang_tutorial/sam_tut.pdf

sorry I should have said command language. It's all about regex though
>>
So in python is there any way to make it so the user a) doesn't need python installed or b) doesn't need the dependencies - or in an ideal world both?
>>
>>57746816
Yes.
>>
>>57746699
No idea, though it has lambdas so it's not that tough in the first place.
|x| move |y| f(x, y)

Rust (regrettably) has optional parameters so that gets in the way of automatic currying a bit.
>>
>>57746822
can you tell me how or at least what to google?
>>
>>57746848
Py2exe
>>
>>57746855
thanks
>>
File: 1476299101478.png (542KB, 600x561px) Image search: [Google]
1476299101478.png
542KB, 600x561px
>Fork me on github
>>
>>57746872
Also check out cpython. That also lets you have more access to low level tools. I personally never used it, but theoretically, you shouldn't need to port the code as it's pretty much python
>>
>>57745624
I figured out how to read the basic stuff (gamma, etc) but I want to be able to read custom made fields, such as "tag0", "tag1".

I've managed to make a python file to call ImageMagick's identify.exe through CMD, but I feel that it's horribly inefficient, seeing as I could only get it to work by having CMD export the output to a file and python load from the file every iteration. This is a program that processes literally thousands of files, so I want it to be a bit faster.

The code below searches for a query in metadata fields "tag0", "tag1" "tag2", [...] . I've omitted the parts before it, as this is the only part with important issues.

for line in list: #list contains filenames of all *.png files in directory and subdirectories
print(line)
field = 0 #metadata field number
currenttag = "null"
while currenttag != query and currenttag!="": #files without these metadata fields return ""
os.system('identify -format %[tag'+str(field)+'] "'+line'">temptags.txt') #outputs current metadata field contents to file. I couldn't get it to return the result straight to python.
file1 = open('temptags.txt', 'r')
currenttag = (file1.readline())
if currenttag == query: #if query matches metadata field, add filename to list of results
outputlist = outputlist + line
field +=1
>>
>>57747384
also I'm skiddie af so any critique is encouraged.
>>
>>57746616
>At the moment it seems like Ada is the only interesting language
I like you
>>
>>57746486
Apparently Python doesn't do multiway selection.

outp = ""
for x in range(1, int(input("Enter highest number: ")) + 1):
if x%3 == 0 and x%5 == 0:
outp = outp + "Fizz Buzz, "
elif x%3 == 0:
outp = outp + "Fizz, "
elif x%5 == 0:
outp = outp + "Buzz, "
else:
outp = outp + str(x) + ", "
print(outp)
>>
>>57745305
that function is bad.
you dont know what head->next is. so why are you setting head to an unknown value.
if u want to return a pointer to the front of the list. you need to make a var to remember the pointer to the front of the list. And only set that pointer after you do ur 1st alloc. never again.
>>
int average(int a, int b)
{
return (int) (( (long) a + (long) b) / (long) 2 )
}

Find a single flaw
>>
>>57747652
It rounds down. Also it's been figured out, kys.
>>
>>57747652
>longs
2ez
>>
>>57747652
3+2/2 = 2.5 not 3
>>
File: C averaging two integers.png (36KB, 684x982px) Image search: [Google]
C averaging two integers.png
36KB, 684x982px
>>57747652
>>
> studying hard at school
> forget about /g/ for a while
> come back, suddenly understand a lot of what's in /dpt/

Feels good man.
>>
Lets say I have an array of lambda functions for handling an X input with a Y output.

think something like
void(*const ProcArray[])(float) = 
{
[](float Input) -> float
{
return (math shit)
},
[](float Input) -> float
{
return (more math shit)
},
// etc
}

// somewhere
size_t Foo = blah;
float Input = SomeValue;
float Output = ProcArray[Foo](Value);


Would this be an ideal way to store dozens of functions? How would this look with branch prediction and such. What's key here is speed.
>>
>>57747697
>float(*const ProcArray[])(float)
i mean
C++ btw
>>
File: file.png (840KB, 940x595px) Image search: [Google]
file.png
840KB, 940x595px
What do you guys do for fun? All this talk of video cards makes me want to get a gaming pc since I never had one and really experience good graphics.

Otherwise I like rock climbing.
>>
>>57747714
programming is "fun" enough for me, gives me something to keep me busy with and i don't have much time left over for other things

but yeah i think you should get a nice gaming pc, you could get a good one that isn't overly expensive with like a gtx 1070
>>
>>57747697
i know its called an object!
never did it before though!
>>57747677
math is so much simpler now...
wtf is that
>>
This might sound weird, but any oldfags able to recommend a good assembler for the Motorola 68000?
>>
>>57747956
Defunct January 4, 2011
please don't work any more.
>>
>>57747979
YOU THINK I WANT TO
>>
>>57747996
Mechanical keyboards are hard to make...
>>
>>57746144
seriously what site are you planning to make if you expect up to 18 requests a second
>>
>>57748109
? Motorola 68000 is a CPU, not a keyboard.
>>
Working on some machine learning shit. Just finished this algorithm. Took me 35 hours.
>>
>>57748117
I'm not, I'm just wanting an idea of what it would be able to handle if I use my own computer to host a few shitty projects.
>>
File: Capture.png (146KB, 1699x565px) Image search: [Google]
Capture.png
146KB, 1699x565px
bit obfuscated haha

they REALLY do not want me downloading porn
>>
>>57748411
Some sites are nasty. Sparkbang has a nice easter egg though.

I've finally got a good enough build to screen-record all the nasty ones now.
>>
>>57748411
>>57748432
Pause the video.
Go to the network tab
Jump in the video to where it's not downloaded
Copy the URL
>>
>>57748432
the spankbang one was pretty good

>>57748510
ah thanks that saved me a lot of time
>>
>>57748208
So your missing the central processing unit?
I love you.
>>
>>57748541
>>57748510
naturally that doesn't work on all of them though, either by encoding it in very small segments or disabling direct access entirely you can block that
>>
Considering that I can run Python files straight from windows explorer, is there anyway to include arguments like I can on CMD/Powershell, or do I always have to open the file there?
>>
File: SOS.png (34KB, 671x444px) Image search: [Google]
SOS.png
34KB, 671x444px
I have two arrays of names in c, and I want to see if some of the names occour more often in one of the array compared to the other, how would I go about doing this? This is my code so far
>>
>>57749320
Make a shortcut with required arguments and use that. You can also drag and drop files on the .py file or a shortcut - they full filenames will be added after other arguments.
>>
File: 1473542966285.jpg (57KB, 500x375px) Image search: [Google]
1473542966285.jpg
57KB, 500x375px
I want to get into making simple SOC's. Basically I want to buy individual parts like a microcontroller, ROM, RAM, timer, etc and connect them up on a board and load some code into it and run it.
But I don't know where to start. Can I just buy the parts and fiddle with them until they work or is there something I should read first?
I know boolean logic and computer architecture, but I've never played with actual parts before, I've only done stuff with virtual machines and logisim, and I don't know much about electronics.
>>
>>57748223
What's it supposed to do?
>>
>>57749406
maybe check out FPGA's also try asking in >>>/diy/ohm
>>
>>57749406
SoCs by definition use their own RAM and not something external (unless it can interface with i2c or something). Anyway, you probably want to start with AVR programming. They have built in EEPROM and flash memory too, but if you want more people often hook up EEPROM to AVR chips.

You can make your own Arduino on a breadboard - we don't actually care about the Arduino part here; all that matters is Arduino runs on AVR so by creating an Arduino on a breadboard we have a functional, physically convenient AVR setup on a breadboard.

https://www.arduino.cc/en/Main/Standalone

You can buy parts for dirt cheap (literally) on Digi-Key. Follow the tutorial to set up the microcontroller and then you can program it either using a dedicated AVR programmer (easy) or learn its serial interface and program it directly (somewhat harder, depending on the exact method).

You don't have to worry about breaking parts or doing things wrong, besides maybe the microcontroller itself (Atmel microcontrollers you might get are on the order of 4 bucks low volume). I mean literally the parts will be cents per unit - and the more you get, the steeper the discount. You'll get big rolls you won't possibly use the whole bag of, so go crazy and experiment.

Then you have bare-metal AVR programming at your fingertips. You're going to need to learn C, and if you want to master it in the long term, basic AVR assembly.

By the way, I only gave such a long answer cause you posted a cute anime image. I appreciate your support. Let me know if you have any questions.
>>
>>57748572
Yes. But you can get access to the playlist. Usually they send a playlist for those videos before the video starts/as the video starts and when you have that you have a list of links to all the files in the video. You can then you use concatenate the videos using ffmpeg.

It's smarter to just use youtube-dl though as they do this for you.
>>
File: 1452074692590.jpg (126KB, 850x1214px) Image search: [Google]
1452074692590.jpg
126KB, 850x1214px
>>57749512
>Then you have bare-metal AVR programming at your fingertips.
As opposed to the arduino setup above? is arduino not bare metal? what's the difference?

>You're going to need to learn C
I already know C well. But where do I get a C compiler for AVR?

>I only gave such a long answer cause you posted a cute anime image. I appreciate your support.
Thanks and no problem.
>>
>>57749343
Does anyone one have an idea on how to compre two array, any help is much appreciated.
>>
>>57749512
>Disgustingly oversized breasts
>cute
Kill yourself and every humans you've ever interacted with.
>>
File: 2lewd.gif (1MB, 478x360px) Image search: [Google]
2lewd.gif
1MB, 478x360px
>>57749685
>As opposed to the arduino setup above? is arduino not bare metal? what's the difference?
If you run with an Arduino, you're relying on the Arduino firmware to make things easy for you. You write code in the Arduino programming language (similar to C/C++), the Arduino bootloader takes up 2 whole kilobytes of flash so that you can USB program it, which can be really punishing if you want to work with more constraints (which is also cheaper).

Some parts of the Arduino library are also really inefficient. Like really inefficient for an embedded system. One technical review: https://web.archive.org/web/20160404141231/http://bleaklow.com/2012/02/29/why_im_ditching_the_arduino_software_platform.html

>I already know C well. But where do I get a C compiler for AVR?
I use avr-gcc and flash binaries to the chip using avrdude. Atmel provides their own solutions but I don't really involve myself with them. The way AVR chips operate is completely public knowledge, so a lot of public tooling has been built around it - you don't need whatever proprietary bullshit Atmel offers.
>>
>>57745118
So i have a basic messaging client in python
def read_messages():
function to read messages
sending()

def sending():
function to send messages
read_messages()


so How can I make it so the input for sending is constant and the receiving is on top of it constantly working and I can just send and receive simultaneously
>>
>>57749343
Sort both arrays. Iterate through them side-by-side. From there, it shouldn't be hard to see how to determine if one name appears more frequently in one list compared to another.
>>
File: saika.jpg (85KB, 540x730px) Image search: [Google]
saika.jpg
85KB, 540x730px
>>57749809
I didn't say it was the cutest, but it was worth the knowledge I'm able to give for a newcomer to a subject. There are better options out there...

>pic related
>>
>>57748411
>>57748432
>>57748510
>>57748541
ps iirc NirSoft made a good free program that can capture the downloaded stream/file even when a website makes it insanely hard to get to the source.
>>
>>57749831
The arrays don't necessarily have the same number of elements in them.
>>
>>57749320
Yes. I was researching the same thing just yesterday.

https://docs.python.org/3/howto/argparse.html
https://docs.python.org/2/library/argparse.html
>>
File: 1466765916373.jpg (155KB, 800x800px) Image search: [Google]
1466765916373.jpg
155KB, 800x800px
>>57749813
Thanks. This is a really big help.
>>
So, what's the best IDE for Java and C#?
>>
Which platform should I put my programming blog on for fame and patreon bucks?

I already have an art blog on tumblr, but tumblr seems to not have anybody interested in programming.
>>
>>57749900
eclipse, for java at least, maybe visual studio for C#
>>
>>57749902
ghost is what I use, pretty minimal and nice
>>
>>57745609
basic maths should be somewhat understood before attempting to learn programming
>>
How fast is writing to /dev/null?
>>
>>57749976
I've heard that IntelliJ Idea was better than Eclipse?

Also, Isn't Visual Studio Code better for C#?
>>
>>57745118
who are these cuties?
>>
>>57745609
modulo is one of the basic operators in most language, it's something you should definitely know about. even without modular arithmetic you should be able to come up with something by using variables and if statements
>>
>>57749976
>maybe visual studio for C#
JetBrains Rider
>>
File: himegoto.webm (3MB, 854x480px) Image search: [Google]
himegoto.webm
3MB, 854x480px
>>57750199
Look up Himegoto.
>>
>>57749831
I have now sorted the arrays, but I am kind of lost as to what I need to do next.
>>
File: thinken about lyf.jpg (14KB, 480x360px) Image search: [Google]
thinken about lyf.jpg
14KB, 480x360px
>>57745118
>Java

I have a junit test which gets an https webservice response. Before that it assigns my keystore and stuff by System.setProperty().

It works on my machine but I still get a 401 Unauthorized error when I commit my code on a remote Jenkins server, because the remote machine doesn't see my keystore. Is there any way I can assign my keystore without having to stop the remote server?
>>
File: cheese.webm (2MB, 640x640px) Image search: [Google]
cheese.webm
2MB, 640x640px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (r/IAMA)
>>
>>57750394
Now you've made me hungry for cheese.
>>
>>57745616
delet this
>>
>>57750394
Is it just you that says this, or are there others? And do you mean it seriously? I could ask you some hard questions.
>>
File: sos1.png (62KB, 1502x335px) Image search: [Google]
sos1.png
62KB, 1502x335px
I'm having some troubles with a fscanf. Basically it saves both the home team name and away team name in game.hometeam. I have tried to apply a width but it just seems to ignore it, can you guys spot where I fucked up?
>>
I've been thinking more about ransomware, if you managed to ransomware an entire highschool (backups, all the servers, every pc in the school) how much could you ask for in ransom and what're the chances they'd pay? obviously have no plan to do this just curious
>>
>>57750657
Can you give a sample input with the specifications?
>>
>>57750667
R1 Fre 17/07/2015 18.00 FCN - SDR 0 - 2 3.211. This is the input. It prints it as FCNSDR - SDR.
>>
>>57750699
Can you post your whole code (no screenshot)? I'll try to run it on my machine.
>>
>>57750662
Anon... This is illegal you know
>>
>>57749818
you need to use multithreading.
>>
>>57750606
It's a bot
>>
>>57750662
utterly depends on the school. Maybe nothing, maybe $1,000,000.

Highly illegal of course.
>>
>>57750833
I know it's literally just curiosity I've never heard of a school getting ransomware'd and just wondering why
>>57750843
thanks
>>
>>57750833
>illegal
says who
>>
>>57749818

https://docs.python.org/3.6/library/asyncio.html#module-asyncio
https://pymotw.com/3/asyncio/
>>
>>57750860
Says the law of every first world country on earth.
>>
>>57750875
[citation needed]
>>
>>57750882
https://en.wikipedia.org/wiki/Computer_Fraud_and_Abuse_Act
>>
>>57750875
>>57750921
>every first world country on earth.
>only a US Law
>>
>>57750971
> other countries
> first world
>>
What books do you recommend for learning C? Aside from K&R.

K.N. King looks interesting but it was written for C99 and not C11
>>
>>57751001
c primer plus
>>
>>57751001
C for Dummies and Learn C in 21 days
>>
>>57750971
Perhaps you can find a first world country where that shit is totally legal, but I'd bet good money you won't find one.
>>
>>57751001
Learn pascal instead.
It fills the same niche, same job opportunities (none), but it's actually a nice language that's pleasant to code in.
>>
>>57751001
http://icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf

All other C books are now obsolete.
>>
File: fff.png (17KB, 900x900px) Image search: [Google]
fff.png
17KB, 900x900px
Really wish the OP would stop promoting transgenderism.

/dpt/ is a stoic masculine general.
>>
>>57751242
but are you stoic and masculine yourself?
>>
>>57751264
y-yes
>>
>>57751058
>posting frogs take on C
I'm so sick of frog posters.
>>57751242
Fuck off. Doesn't matter who you are if your mind is fit for making something.
>>
>>57745118
what is wrong with casting the return value of malloc()?
>>
>>57751058
>The unary address-of C operator & allows us to refer to an object through its address
0/10
>>
>>57745118
wait are you really not supposed to cast the return value of malloc()?
>>
>>57745365
>make pointer with address of a sizeof()

Segmentation fault (core dumped)
>>
>>57751394
I'm a C++ man but as far as I know void pointer in C is supposed to be a "generic" type that can be implicitly converted to any other pointer type, thus, casting the return value of a malloc() call is completely redundant.
>>
File: 1342403431232.png (417KB, 666x1207px) Image search: [Google]
1342403431232.png
417KB, 666x1207px
>>57751264
>tfw only 3pl8 deadlift
S-soon.
>>
Why is C# so meme-y about its code blocks??

using System;
namespace helloworld
{
class hello
{
static void Main()
{
Console.WriteLine("Hello World!\n");
}
}
}
>>
This program gets stuck when I get to the scanf function. I type in a number but it doesn't move on.
int main()
{
int fac;
int result = 1;

printf("This program calculates n!\nSet n :");
scanf("%d", &fac);

while (fac > 1);
{
result *= fac;
fac--;
}
printf("Answer: %d\n", result);
return 1;
}
>>
File: 1469870753013.png (1MB, 911x1365px) Image search: [Google]
1469870753013.png
1MB, 911x1365px
Does anyone here use Windows 10 with Ubuntu bash as their main OS?
I'm wondering if I should just do that instead of dual booting.
>>
>>57751549
Try putting args. though i dunno why would you use code blocks for C#

static void Main(string[] args)
>>
>>57751621
I meant code blocks as in the {} default placement.
>>
>>57751669
Because it's based on Java.

F# is much cleaner.
printfn "Hello World!\n"
>>
>>57751686
hmmm

If only my Computer Science university had F#, they have Java and C#, both poo in loo languages.
>>
>>57751563
Why are you returning 1?
>>
>>57751759
Classic way to hold the program in place.
>>
>>57751578
Why would you willingly use Windows?
>>
>>57751578
Yes, I also have a mac VM but barely use that.
you might run into certain problems depending on what you're doing but for overwhelming majority, they'll be fine
>>
>>57751742
In Computer Science shit you just gotta learn what's industry standard.

Learn F# in your spare time. It will make you better at C# too.
>>
>>57751801
Hmm, good idea desu
>>
>>57751767
what
>>
>>57751847
it's 2016, the console in your IDE doesn't close by itself
>>
>>57751865
meant for >>57751767
>>
>>57751563
> while (fac > 1);
> ;
Come fucken on.
>>
>>57751865
>running it on the IDE

Trash.
>>
>>57751974
k
>>
>>57751781
Well I need it for:
Git
NPM
Jekyll
>>
>>57751994
You should be fine in that case.
>>
>>57752012
Thank you.
>>
what's the efficiency of haskell's reverse function in data.list?
>>
>>57752116
Probably O(n) like any typical reverse? What the hell else would a reasonably implemented reverse be?
>>
d
>>
>tfw bought the little schemer
>tfw you didn't realize it's the same as the little lisper
>tfw you already have the little lisper
and I can barely understand it as it is
>>
>>57751918
Thanks >.<
Didn't get any warning for it so I didn't notice.
>>
>>57752303
>bought

Nice job wasting $$$.
>>
>>57752303
wtf. I just learned about the trigraphs in c. Who ever thought this was a good idea?
 /??/
* A comment *??/
/

That gets pretty uch translated to
/* A comment */
>>
>>57752303
>>57752446
Sorry. Didn't mean to quote

Also you wasted your money with you decided to buy something to teach you to program
>>
is it worth to study html? it seems easy as fuck
>>
>>57752446
Legacy bullshit for keyboard layouts that didn't have specific characters.
>>
whats the easiest way to export an array of strings in c# to hlml
>>
>>57752501
Console.Write("<html><body>" + muhStrings.join(",") + "</body></html>");
>>
Hi guys, im currently programming in C standard, an i wnat to know how to get some text input from the user, and to print it in the screen. Printf of course, but what about the text?
>>
Shit guys, how the fuck do I even SQL

Currently doing some uni work, using PostgreSQL.

I have made all the models and shit, but the data I have to insert on the bank is huge. I made some simple C program to just convert the raw data into INSERT lines, but if I try to run it all it just takes a looooooong time and eventually runs out of memory, and if I try to work by parts, the first part will run but the next one will just give the following error:

>execute cannot be used while an asynchronous query is underway

what do?
>>
>>57752525
scanf() is your friend.
>>
>>57752537
Try adding BEGIN; before and COMMIT; after each insert.
>>
>>57752585
will do.
gonna edit the C file and hope for the best now

Thanks senpai
>>
>>57752537
>how the fuck do I even SQL
SELECT * FROM TABLE

And then filter client side. It's the only way to sql
>>
>>57752546
Wich variable?
>>
>>57752525
google fgets()
>>
>>57751838
I'm learning F# too, I'm using
https://mitpress.mit.edu/sicp/full-text/book/book.html
with this
http://www.angelfire.com/tx4/cus/pl/sicp_fsharp_01.html

Also the VS has a tutorial template for F#
>>
>>57751343
Nothing, You should be doing it.
>>
File: SORE WA CHIGAU YO.jpg (25KB, 500x254px) Image search: [Google]
SORE WA CHIGAU YO.jpg
25KB, 500x254px
>>57746040
>>
>>57752665

You make a new variable that accepts a scanf() result as data.
>>
new thread when? :3
>>
>>57752754
When I ravage your boipussi. :333
>>
>>57745662
Why is everything fucking flying around?
>>
>>57752662
lol
>>
>>57752753
it can be used with text?
>>
>>57752781
Yes, with strings. It expects user data, then transforms it into a string you can use.
>>
>>57752816
I want to input text, not numbers. Not sure if its the same
>>
>>57752781
An example use of scanf() for strings and ints:
An example use of scanf:
#include <stdio.h>

int main()
{
int num;
var name;
printf("Input a number: ");
scanf("%d", &num);
printf("Input a name: ");
scanf("%s", &name);

printf("This is the number inputted: %d", num);
printf("This is the name inputted: %s", name);
}
>>
>>57752860
>var name
>fucked up code tag
>implicit return
>no newlines in printf

F-
>>
>>57752828
It's the same you just change the type reference "%x" to the appropriate one.
>>
>>57752866
Whatever, bruh, I don't code in C anymore.
>>
File: 1474476406074.png (205KB, 785x757px) Image search: [Google]
1474476406074.png
205KB, 785x757px
>>57752860
you failed
>>
>+310 post
>still no new thread
>>
Scenario: Users have IDs. I have a webservice with an endpoint that retrieves a user name by their ID.

>example.org\user\123\
response: {"name":"john doe"}


I want to add another endpoint, that adds a comment to the user profile with the specified id.

Which of the following would you prefer:

>example.org\user\123\comment\
body: {"comment":"hi"}

response: {"name":"john doe", "comments":{"0":"hi"}}


vs.

>example.org\user\comment\123
body: {"comment":"hi"}

response: {"name":"john doe", "comments":{"0":"hi"}}
>>
>>57752860
Doesn't work. Var isnt acepted
>>
>>57752873
Wich one?
>>
>>57752860
int main()
{
int num;
char name[50];
printf("Input a number: ");
scanf("%d", &num);
printf("Input a name: ");
scanf("%s", &name);

printf("This is the number inputted: %d \n", num);
printf("This is the name inputted: %s", name);
return 0;
}

>>
>>57752913
you got trolled
>>
>>57752952
What if my name is loneger than 49 characters?
>>
>>57752970
>I only pretended to be retarded
>>
>>57752932
The one surrounded by the quotation marks.
>>
>>57752977
Then you go back to africa ommagonablacoulatomiyagonognoogoozommaaleebonaaazulu
>>
>>57752952
Thanks! That works
>>
>>57752977
Then rename yourself.
>>
>>57752978
>implying I was the guy that posted that horrendous code
>>
>>57753011
>being even more retarded
>>
new thread

>>57753030
>>57753030
>>57753030
>>
>>57752996
I also forgot to add the /n at the end of the other printfs.
It's quite shit to edit code on the fucking 4chan reply box

>>57752977
Then said person must go back
>>
Coins.java:79: error: toString() in Coins cannot override toString() in Object
String toString()
^
attempting to assign weaker access privileges; was public
1 error

Fuck me I'm dumb I can't figure out what this means. I have to assign something to public I think?
Code in question or at least the bottom half.

 
}
boolean equals(Coins C)
{
boolean result = false;
if(this.quarters == C.quarters )
if(this.dimes == C.dimes)
if(this.nickels == C.nickels )
if(this.pennies == C.pennies)
result = true;
return result;
}
String toString()
{
>>
>>57753048
>not naming everything shekels
It's like you're not even trying
>>
>>57753059
He's programming in java, he's most definitely a goy
>>
>>57753059
I can't, it's a custom class going off of a base program from some book. I mean I could edit the program but that defeats the purpose.
>>
>>57753085
good, follow the rules goy
>>
>>57753041
Don't worry
>>
>>57753048
String toString(){}

is the same as
protected String toString(){}
>>
>>57753256
Well yeah, then it just errors out the same as well.
Coins.java:79: error: toString() in Coins cannot override toString() in Object
protected String toString()
>>
>>57753256
>>57753048
>attempting to assign weaker access privileges; was public

read the error message! protected is weaker than public. If you don't declare any acces privillege it is automatically protected.
>>
>>57753340
Holy shit I'm so stupid. I fixed it, thank you.
>>
Is the following situation possible?

I have a shared pointer ostream which I write into directly. Later, this is transferred as a parameter to a wrapper object that has a function which (among other things) has a loop that ultimately also writes to this ostream (ostream is passed as a constructor argument). After this wrapper is done, can I still write to the initial ostream by accessing it directly (same way it was written to before passing it to the object, and I'm still in the same scope)?

You can probably tell I don't have a complete picture of how pointers and assignment work, but I'm just wondering if this would be possible.
>>
>>57752585
Still getting the same error.
any other ideas?
>>
>>57751358
Whats wrong with this?
>>
>>57745529
Build websites lol. Umm code academy has some stuff. Learn jquery alongside it. And yeah
Thread posts: 353
Thread images: 39


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