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

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: 360
Thread images: 16

File: timetocode.webm (2MB, 1152x648px) Image search: [Google]
timetocode.webm
2MB, 1152x648px
This is /dpt/, the best subreddit of /g/

Umaru-chan edition

In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

Filesharing and chat: https://volafile.io/r/kUFzLJ

code of conduct:
no racism
no insult
no sexual harassment
no gender discrimination

wat r u working on, anon-chan ?
>>
My programming language with dependent types, linear types, manual memory management, and FFI.
>>
first for C
first for tfw no trap programmer bf
>>
second for Go, the language of the memes
>>
3rd for Go.

>>51474126
how come you fags don't understand the most basic intrinsic rule of the internet? do NOT feed the trolls.
you fall too easy for their b8s. seriously, who, ever, uses Integer in Java? and yet you kept trying to convince the troll... this is, like, the definition of autism.
>>
I finally got my TCP server working in Go. I was struggling with broadcasting, but I got it working. What do you think? https://github.com/TeaGuy/euphonium/tree/dev (I'm rethinking my username).
>>
Cast your vote if you haven't done that yet.
https://strawpoll.me/6069029 (embed)

Make sure to read the question carefully.
>>
>>51474181
D is better
>>
>>51474126
dumb hamsterposter
>>
>>51474225
D is tryhard.
>>
>>51474282
>not trying hard D
>>
I am working on a type of static type checker in Scheme for my first compsci class, almost done, just need to do all the error messages. Comp sci is pretty fun senpai desu
t. Major in math, thinking of switching over
>>
int oddPos = 0;                

while (oddPos < evens.length)
{
if (evens [oddPos]%2 == 0)
{
oddPos++;
}
else
{
for (int i = oddPos + 1; i < evenMaxSize;i++)
{
evens[i - 1] = evens[i]; //only works when array ends with an even number
} //if i add oddPos++ to the for loop, the array will work and complete, but not to the intended function
evenMaxSize--;
}
}

Working on an assignment in java where you have to sort randomized numbers into odd/even arrays, i've managed to get the loops working but with one hitch, if the original generated array (values, which code snippet related is copied to evens with arrays.copyOf) ends with an uneven number, the program won't be able to complete the loop, is an end-specific condition on the else statement the way to go here?
>>
>>51474198
reminder, any language trying to replace C++ and Java is a meme language
>>
>>51474410
It better be bidirectional.
>>
>>51474212
>All those Javascript/Python - Employed
Spotted the students
>>
>>51474126

i'm programming an atmega328p and I can't figure out how to use the ADC to calculate a PWM signal with the max resistance from a potentiometer being 100% duty cylce, and minimum resistance 0% or off.

the trouble is the minimum and maximum resistance of my potentiometer is not read as exactly Vcc and 0 volts respectively by the ADC

how do I figure out the minimum and maximum resistance without having to calibrate it or something?
>>
>>51474210
>using clientLock instead of chan []*Client with bufsize = 1
you can lock things with channels too
in fact, the type enforces the user to safely acquire []*Client, it just doesn't force the user to release []*Client again.
with locks you enforce none of those - i can just grab your []*Client and fuck with it if i forget that there's a lock

also, your encapsulation is fucked. why are you encapsulating conn but not Out? in fact, why isn't the entire client type package private?
>>
>>51474474
>bidirectional
? ? ?
First compsci class so dunno what you are talking about, it works like this (check '(+ int (* real int))) -> real, should work for arbitrary depth and all operations are binary
>>
>>51474487
>http://benchmarksgame.alioth.debian.org/u64q/java.html
You knows those benchmarks are 100% arbitrary right? Some languages have very optimised versions of some tests, other languages don't.

Data processing is not faster in Java than it is in C. You've lost your marbles if you think that could possibly be true.

>you are the one who just said that java allocates everything on the heap
It allocates a lot of stuff on the heap that shouldn't need to be there yes. What has that got to do with arrays primitives fragmenting?

>https://en.wikipedia.org/wiki/Bounds-checking_elimination
What about it? That optimisation can't always be made genuis. Especially if the array length is in any way arbitrary.
>>
>>51474524
Spotted the unemployed
>>
File: 1342664478674.png (3KB, 210x230px) Image search: [Google]
1342664478674.png
3KB, 210x230px
>All projects at work being blocked by other team members
>Side projects at home being blocked by other project contributors
>Can't find anything to busy myself with
I don't care for this
Not one bit
>>
>>51474126
Thank you for using anime pic
>>
File: 126146619089.jpg (155KB, 550x700px) Image search: [Google]
126146619089.jpg
155KB, 550x700px
>>51474573
I work full time in a .NET factory
>>
>>51474419
I have no idea what you're doing here. You have an array called "evens", but are accessing the index with "oddPos". That seems contradictory to me.

>sort randomized numbers into odd/even arrays
I'd probably write something that looks more like...

int[] randomNumbers = new int[100] { ... };
int[] evenNumbers = new int[100];
int[] oddNumbers = new int[100];
int evenIndex = 0;
int oddIndex = 0;

for (int number : randomNumbers) {
if (number % 2 == 0) {
evenNumbers[evenIndex++] = number;
} else {
oddNumbers[oddIndex++] = number;
}
}
>>
I need to write a program in Java to generate a summary report on a store inventory using an input text file and outputting a text file.

The summary text file needs to determine the
1. Total value of the inventory
2. The cheapest item
3. The most expensive item

The first line of the input text file designates the number of records while each line represents a record in the format [ItemName, Quantity, Price]

Example:
2
Stove, 52, 540.90
Table, 78, 99.46

Any help is appreciated.
>>
>>51474526
do you have a way to read values from the mc via serial interface or a display or something?
>>
>>51474608
I work full time in a Java FactoryFactory
>>
In Prolog, what does this syntax mean?

f(g(X), g(Y)) :- something.


Does it just mean that f(X, Y) holds if g(X) holds, g(Y) holds, and something holds?
>>
>>51474652
First you need to invent the universe.
>>
>>51474676

Nah, I only have two shitty perfboards I built for running and flashing the data
>>
>>51474709
can you write to eeprom and read eeprom with your programmer?
>>
C# question.

I'm writing a command line application that's being used in a pipeline to feed file data to another application.

The problem is, if the other application is closed my program continues to run in the background.

I've seen other command line applications that quit once the same program is closed when used in similar fashion.

How can I do what other applications are doing?
>>
I have an idea for a small application, not something I think is marketable but just something I genuinely want on my phone for personal use.

It would be within my ability to code this if it were a WPF program on VS. I've never touched the Android SDK but I think it's going to be ez.

My question is, can I just straight copy this app onto my phone over a USB cable? Do I have to root my phone? Have any of you guys ever developed for Android and do you have any tips?
>>
>>51474557
this. use buffered channels and selects to lock things. channels are obviously THE solution for this kind of things...
>>
>>51474652
Read first number
Open file, read into string[] by line
iterate over the first number of times the array
Record each one into whatever, array, list, tuple, doesn't fuckin matter
iterate over that and check and each value against the other to see if it's less (or more, for the expense)
While doing that, also add each number into an int.

Ta-da, you have done everything in two loops.
You can probably get this into one.
>>
>>51474745
>It would be within my ability to code this if it were a WPF program on VS. I've never touched the Android SDK but I think it's going to be ez.

Oh boy, are you in for a rude awakening.
>>
>>51474737
Here's my simple code btw
static void Main()
{
string file = @"file.ts";
FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
byte[] buffer = new byte[65536];
Stream consoleStream = Console.OpenStandardOutput();
int fileLength = (int)fs.Length;
int writeLength;

while (fs.Position < fileLength)
{
writeLength = fs.Read(buffer, 0, 65536);
consoleStream.Write(buffer, 0, writeLength);
}

fs.Close();
consoleStream.Close();
}
>>
>>51474737
In order for this type of control to take place, one program has to launch the other. Then it can make intelligent decisions about when to close the launched program, or how to act upon the launched program's closing.
>>
>>51474769
Can it just continue running, and block until it receives more data from file.ts? Or does it need to close?
>>
>>51474652
What specifically are you having trouble with? Also, I could tell you a lot of ways to do it, but I know a lot of professors have restrictions on not allowing students to submit homework using things they haven't covered in class yet.

You will probably want to read the file using a buffered reader. Something like this:

BufferedReader inventoryReader = new BufferedReader(new FileReader("path/to/input.txt"));


You will want to read that first line with the number of expected items. After that you can use a loop to go through each line.

String line;
while ((line = inventoryReader.readLine()) != null) {
// do stuff
}
>>
>>51474765
I believe you... I'm super interested to hear why though
>>
>>51474745
To unlock dev mode on your phone, go to settings and tap your phone model number a bunch of times

After that you can do whatever
>>
Is there a quick and dirty guide to using -options in c, such as program --version.

I'm really not a programmer but I want to make a small program so I dont get tired.
>>
>>51474776
>>51474799

Well then what are other applications doing to close themselves when the pipeline breaks?

For example, the first application closes when the second is closed in this command line
cat file.ts file2.ts | ffplay -


I'm guessing 'cat' is written in C.

On the other hand my program (code here: >>51474769 ) continues to run. Considering it's a general case, the former one must be doing something.
>>
File: csharpcucks.jpg (129KB, 1024x997px) Image search: [Google]
csharpcucks.jpg
129KB, 1024x997px
>yfw C#keks will defend this
>>
>>51474557
I agree, the lock is a far from an ideal situation. I don't really follow you on using a channel instead of a mutex. I don't want to sound like a lazy nigger, but could you post an example? I found something in the Go docs, but I don't know if that's what you mean.
func handle(r *Request) {
sem <- 1 // Wait for active queue to drain.
process(r) // May take a long time.
<-sem // Done; enable next request to run.
}


I want to parse the read bytes from the client in a different package. The result is pushed into the clients Out channel. I don't want other packages to dick around with the conn field. That's why Out is exported and client not.
>>
>>51474879
I'm not that advanced to be able to defend this :^)
>>
>>51474840
int main(int argc, char** argv)

argc is the argument count, argv is an array of strings given as arguments, and argv[0] is the name of the program
for example program --version will result in argc=2 and argv = {"program","--version"}
>>
>>51474859
When the input's end has been reached, the EOF character is being sent. All you need to do is have your while loop run until it finds the EOF character.
>>
>>51474212
If my work involved programming in my favorite language I would hate my favorite language, because I am not in management. I'm not old and experienced enough to be in management, like an autist has to be if they want to get into any position like that.

Why does everyone act like that's the holy grail of programming? The holy grail isn't being employed as just any fucking code monkey so you can show up on a forum and say "I ACTUALLY HAVE A JOB PROGRAMMING PROFESSIONALLY YOUR OPINIONS ARE INVALID" whenever you're not writing generic proprietary bloatware for a corporation's internal uses.

It's independence combined with a salary, so not only are you a professional, but you can write whatever you want within the confines of "improving profits for the employer" (possibly yourself) and tell other people what to write. In your favorite langauge. Theirs can go suck it.

Heaven.
>>
>>51474763
>>51474815
Thank you so much. I think he just wants us to use normal arrays but I don't think he'll mind if I use a buffered reader.
>>
>>51474826
Visual Studio is an enterprise-directed software suite intended to provide a easy-to-use interface to make .NET applications.
WPF is an abstraction layer of the Windows API intended to be much more user friendly and powerful compared to WF.
Visual Studio includes a What-You-See-Is-What-You-Get editor for WPF in order to streamline the app development process even more.

The Android SDK, on the other hand, is a pile of steaming garbage loosely tied together by another steaming pile of garbage - only that second pile of garbage is being phased out in favor of a can of Fix-A-Flat, which solves absolutely none of the problems that the first garbage pile had.
Also, there's pretty much no useful IDE for Android, and you'll be fighting whatever GUI tool you end up using to do every little thing.

Not to mention that Android apps are Java while WPF is (usually) C#. Keep in mind that C# exists today specifically because Microsoft felt that Java was too garbage-quality to be saved (and believe me, they tried to save it).
>>
>>51474725

Yes

I use avrdude
>>
>>51474935
If he just wants you to use normal arrays then do the same thing, open the file and read it by line
Then for each line, split the values by comma and store them into an array.
>>
>>51474859
What happens is that cat runs, puts the output in a buffer, and terminates.
Then ffplay is launched and receives the buffer as input.
Ffplay runs and acts upon the data until it has run out of data to receive, and then terminates.

This guy >>51474815 has the solution I think. If you need to just use an array, you could cheat by making the first the first and last elements be "empty" and "full" signifiers, assuming you have flags that are outside the expected dataset.
>>
Which does \g/ prefer?

C
#define MAX(A, B)         (((A) > (B)) ? (A) : (B))
#define MAX3(A, B, C) (MAX(A, MAX(B, C)))
int main(void)
{
double z = MAX(200, 300);
double y = MAX3(z, 600, 1000);
return 0;
}


C++
template <typename T>
const T &max(const T &a, const T &b)
{
return a > b ? a : b;
}

template <typename T>
const T &max3(const T &a, const T &b, const T &c)
{
return max(a, max(b, c));
}

int main()
{
auto z = max(200, 300);
auto y = max3(z, 600, 1000);
return 0;
}
>>
>>51474951
Wow. Is there a counterargument? A school of thought that disagrees with you?

>Not to mention that Android apps are Java while WPF is (usually) C#. Keep in mind that C# exists today specifically because Microsoft felt that Java was too garbage-quality to be saved (and believe me, they tried to save it).

Right, but they are similar enough that coding a rudimentary app should be fairly easy right?
>>
>>51475013
No. ffplay isn't started only after cat terminates.
>>
>>51475020
Both languages are outdated.
>>
Could you guys help me figure out what's wrong with this function? It's supposed to check if a word is either less than 3 characters or if it matches a predefined blacklist.
int blacklist(char *word)
{
static const char *blist[] = {
"all",
"and",
/* ... */
"who",
"why"
};
if (strlen(word) < 3)
return 1;
else if (bsearch(word, blist, sizeof(blist)/sizeof(char *),
sizeof(char *), strcmp) != NULL)
return 1;
else
return 0;
}


The length test works, but the bsearch appears to return NULL every time and lets the word pass through. I'm guessing that I passed the arguments incorrectly?

       void *bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
>>
>>51474929
>tell other people what to write. In your favorite langauge. Theirs can go suck it.

This is precisely why you should never be a manager or in charge of any important project. You'd blow some project all to hell because you get a woody playing with software like it's a sex doll. Although the internet likes to circlejerk their favorite languages, most businesses have figured out that tooling and available libraries are far more important than what some autist thinks about Haskell or Lisp.

I'm writing an application for work using Spring Batch, a Java library. Java gets a lot of shit on /g/. But you know what? Because of things like Spring Batch and other tools, I'm getting this job done 100x faster than I ever could in a /g/ approved language.
>>
>>51474879
Why would you be serializing a reference?
>>
>>51475054
In many ways, yes.
In many other ways, no.

The two are syntaxically similar and share a lot of the same core design concepts, but Java is basically just a really shitty C#. You won't have any trouble reading or writing it, but the way a lot of functions behave and default for types will throw you off.

That and, really, the android sdk is trash.
>>
>>51475013
I strongly believe cat continues to feed data to ffplay as video files tend to be too large to pass with one read. It also remains in the process list as long as the file plays.
>>
>>51475020
C because you can understand what it's doing even if you don't know C

Ideally, the same syntax would be applied to a language with a more user-friendly type system

The C++ solution is a fucking kludge

User friendliness is what all language wars boil down to. "Elegance", "power", "sensibility" - these are all different ways programmers say "easy" while preserving their egos based on doing things other people consider hard.
>>
>>51475065
u fuckin wot
>>
>>51474894
that is exactly what I mean.
the point is that you CANNOT acquire the client slice without effectively locking it.
>>
>>51474212
How the fuck are more people not using Python at their job? Even if you are flipping burgers you should be able to figure out an occasional need to whip up a quick scrypt.
>>
>>51475123
>unironically using the snake language
>>
>>51475103
It does, run something like "cat - foo | grep bar" that let's cat run until you hit ctrl-d.
Both cat and grep will keep running.
>>
>>51474989
the simplest solution I could come up with is making a calibration that goes something like this:
>start with the pot somewhere in the middle
>have the mc keep track of the minimum and maximum value coming from the ADC
>turn pot all the way down and then all the way up
>have some trigger like a button or just after x minutes to make the mc write the min and max values to eeprom
>read eeprom with the programmer
Now you know the minimum and maximum value you get from your potmeter
you might have to adjust those down or up a bit
>>
>>51474935
>I think he just wants us to use normal arrays but I don't think he'll mind if I use a buffered reader.
Those two things are not in any way related. You can't use arrays to read from a file. I'm thinking you really should be talking to a TA instead of /g/.
>>
>>51475123
Because python is absolute shit.
In what situation are you using python scripts in place of powershell, bash, or javascript?
>>
Why the fuck is there still no superior alternative to ncurses in 2015, this shit is cancer.
>>
>strings are immutable
>`byte` datatype is 2 bytes
>implicit function calls

I love C# but damn is it stupid sometimes.
>>
>>51475092
Why do you think you're using java?

It's your manager's favorite language and he's forcing you to use it even though there is no scientific evidence proving that it makes employees more efficient. It's all his opinions.

Somewhere in brazil, someone doing programming for that one bank is using clojure and saying the same things about spring batch
Why is he using clojure? Because it's what his manager thinks is the shit, even though there's no real evidence for it.
>>
>>51475186
>`byte` datatype is 2 bytes
Go on
>>
can't find the libjcsl libraries for java. Anyone got a link?
>>
File: Capture.jpg (11KB, 146x112px) Image search: [Google]
Capture.jpg
11KB, 146x112px
>>51475186
>`byte` datatype is 2 bytes
What the actual fuck are you on about?
>>
>>51475221
char isn't byte right?
>>
>>51475165
anytime i want to process text, like if i get a list of personnel changes and i want to compare it to another list of personnel changes in various ways.

because i can write it much much faster in python, because i find it syntactically pleasurable

why am i wrong? my question was directed at people who say that python is their favorite language, but they are unemployed (which includes people who are employed, but don't use it (their favorite language))
>>
>>51475185
there is

it's called drawing an actual fucking GUI. if you want it to run in a terminal then those terminal faggots can get it via sixels.

>but muh remote apps!
terminals are not the only way to access a remote system. your display server probably provides similar features, or if you use wayland, weston has RDP.

since you don't give a flying fuck about aesthetics you can just write in pure xlib and tell people to tunnel X11 over ssh.
>>
>>51475221
"The System.Byte keyword denotes an unsigned 16-bit integral that stores values in range 0-65535."
-MSDN
>>
>>51474643

it was an internal logic thing, the main goal of the variable was to find the odd numbers to remove them from the array, I could easily change it around later.

On that note, I should also have mentioned that the length of the arrays are supposed to be the same as the amount of odd/even numbers in them. the total number of randomly generated integers are also bound to the users input.

Here's the general thought process while making it since I'd had some trouble wrapping my head around the array/ even/odd sorting thing:

>Create the initial array, values
>If I fuck around with values too much while sorting the even numbers, i might fuck up for when I'm supposed to count the odd ones, I'll make a copy of the array to be sure that I don't fuck something up.
>however, copy is too big, and you can't change the length after it's initialized, with how I've currently made the program, I'll have to make another
>cue the while-statement, leaving even numbers as is and removing the odd ones, aswell as using evenMaxSize to set up the length for the next one.
>>
>>51475286
https://msdn.microsoft.com/en-us/library/5bdb6693.aspx
>Size
>Unsigned 8-bit integer
?
>>
>>51475191
>It's your manager's favorite language
No it's not. My manager doesn't even make the decisions about what language to use.
>even though there is no scientific evidence proving that it makes employees more efficient
Programming efficiency is really fucking hard to measure. Go look up some of the academic literature published about it. About half the papers aren't worth the disk space used to store them and the other half restate shit known since the 70s.
>>
>>51475254
You're not wrong, but at a job there would be no realistic reason to use python over anything else.
It has very limited feature sets, it's unbelievably slow, and any business wouldn't want you writing that stuff in python instead of what everything else is being written in.
>>
I still dont fully understand the concept of OOP....
>>
>>51475367
...what don't you understand about it?
>>
>>51475380
The concept of objects. Is this why libraries exist? Do procedural languages use libraries?
>>
>>51475404
Libraries have nothing to do with OOP.
>>
>>51475165
>powershell
doesn't powershell use python? also, lol @ comparing powershell to bash, or even python...

>>51475185
patches are welcome
>>
>>51475404
Libraries have absolutely nothing to do with OOP.
>>
>>51475367
It's OK, you're better off not knowing. Unlearning years of OOP bullshit was one of the hardest parts of becoming a genuinely better programmer.
>>
>>51475428
>doesn't powershell use python?
No, retard, Powershell itself is a scripting language front-end for the .NET Framework, with some backwards compability to cmd.exe added in.

In terms of what it can do as a programming language it's far above Bash.
>>
>>51475367
The most important thing to understand about OOP is that it is a tool to be applied where necessary, not a religion to devote your code to.
>>
>>51475365
I'm using it for personal scripting, not for actual development.

Also I know people who work in forensics who use it when a bunch of datalogs get dumped on their laps and they have to parse them real quick. Lots of people in industry love python for this sort of stuff because it's arguably the fastest language to /write/.

It seems to me like you are considering a very limited sphere of the sorts of applications computer programming has.
>>
>>51475428
>patches are welcome
You can't patch something that's inherently broken without making a further mess.
>>
>>51475365
are you autistic? if you need speed and more features (what features is python missing??), then code a real program or pay someone else to do it
there is a reason python is a SCRIPTING language, just like other SCRIPTING languages

>>51475446
>In terms of what it can do as a programming language it's far above Bash.
HAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
I hope you are being ironic... do you even use bash? do you understand what bash is supposed to do?

what's with the retarded MS shills in /dpt/?
>>
>>51474212
>no common lisp
>no scheme
>no racket
>no dylan
>no F#
>no ocaml
I won't even bother responding. This is beyond retarded. It's pretty clear whoever made that poll is in middleschool.
>>
>>51475367
The goal of OOP is code reuse through class inheritance.
>>
>>51475485
>linkeks continue to be BTFO on a daily basis
>>
>>51475113
Monkey doesn't understand. The application gets stuck when addClient is called.
var clients = make(chan []*Client, 1)
func addClient(client *Client) {
//clientsLock.Lock()
//defer clientsLock.Unlock()
//clients = append(clients, client)
c := <-clients
c = append(c, client)
clients <- c
}
>>
>>51475485
>I hope you are being ironic... do you even use bash? do you understand what bash is supposed to do?
I use Zsh as my shell of choice. I dual boot W7 (which doesn't even have a functional package manager built in...W10's impl. does, though) and Arch Linux so yes I have quite a bit of hands on experience with both.

Because Powershell is yet another front end for .NET, you can theoretically write any program in PS that you could in C# or VB.NET or C++/CLI.

You can't really design GUI programs in Bash. You could actually design Microsoft Word in Powershell if you really wanted to, and you wouldn't need any external tools.
>>
>>51475516
I don't understand why just calling a function from another function isn't sufficient. Inheritance brings way more problems to the table than it solves.
>>
>>51475365
>unbelievably slow
I can't fathom a situation in which the speed differences between bash, PS and Py make any fucking difference. I'm not sure you understand what people are using scripting languages for senpai
>>
>>51475550
>GUI is all that matters
MS shills please just leave.
>>
>>51475560
Because eventually you have too many fucking functions just thrown into code to deal with them all.
>>
>>51475485
Write a linked list in bash. I'm waiting.
>>
>>51475527
What kind of autistic tongue is that?
>>
>>51475516
Ok so its mostly design?
>>
File: 48865091.jpg (12KB, 243x250px) Image search: [Google]
48865091.jpg
12KB, 243x250px
>>51474126
I'll wait for the next thread without the reddit nonsense
>>
>>51475568
Please remove the shit from your mouth and hands, and then re-read my post for comprehension.
>>
>>51475527
I'm fucking stupid. I forgot to add an empty array to the channel.
>>
>>51475568
Faqu'ils ont imposé leur logiciel privateur sur tout'la terre asti'!
>>
>>51475630
du bist ein dickes ei
>>
>>51475644
I'VE GOT A BIKE YOU CAN RIDE IT IF YOU LIKE
>>
>>51475550
ah, you are the edgy arch guy
tell me, kid, for how long have you been using windows, linux, computers in general? have you ever read the bash manpage? you'd be suprised at how much bash can do in its domain.

bash != python != powershell
powershell is the retarded copy of the other two scripting languages, and a massive abortion

>>51475575
>Write a linked list in an scripting language. I'm waiting.
are you reading your own stupid comments? I will assume you are autistic m8.
>>
>>51475550
>you can theoretically write any program in PS

If it's GUI, there is some likehood you may need additional libraries loaded.
With CLI yeah, PS can act as a C# replacement if you're not deeply concerned about performance impact.
>>
>>51475662
>are you reading your own stupid comments?
The fact that you had to change the wording of the comment you quoted is very telling.
>>
>>51475090
Anybody?
>>
>>51475739
see, I was right, you are retarded.
>>
>>51475186
>strings are immutable
isn't this the case for, let's see.... just about every commonly used language out there?

>'byte' datatype is 2 bytes
see replies above, not even going to bother quoting them

>implicit function calls
See, this isn't stupid - it's pretty cool. Instead of having a huge mass of boilerplate functions
public void SetMinutes(double value)
{
m_seconds = value * 60;
}
public double GetMinutes()
{
return m_seconds / 60;
}

you just have properties, which act as variables but are actually functions, making the code referencing these private members much more intuitive
public double Minutes
{
get { return m_seconds / 60; }
set { m_seconds = value * 60; }
}


What's really cool is being able to use these implicit functions to access immutable data types with anonymous functions
public double SomeMemberVariableImmutableValueOnlyReferencedByAFunction => memberVariable.thatFunction();


you can even do this with functions, as I have found out

public double SetSomeMemberVariableImmutableValue(double value) => memberVariable.setSomeValue(value);
>>
>>51475684
> libs for gui

This is Windows. Look at the name closely. The WM is in the kernel mind you
>>
>>51475786
>isn't this the case for, let's see.... just about every commonly used language out there?
No.
Not at all.
>>
>>51475786
>isn't this the case for, let's see.... just about every commonly used language out there?

No? Are strings immutable in C, the most commonly used language?
>>
>>51475835
> C, the most commonly used language

That's not how you spell Javascript.
>>
>>51475782
>laughs at someone for suggesting Python is more powerful than bash
>someone calls him out on it by posing a simple challenge to prove his point
>HURR DURR, UR RETARDED

I should mention that I'm not the poster who wrote about Python. I do however get paid to write Korn Shell for a living. Seeing your post with the million HAs, got me laughing because I knew how easy it would be to call you out on it.
>>
>>51475186
C# has mutable "strings". They are correctly called char arrays instead of strings.
>>
>>51475835
Based
const char*
>>
>>51475786
Properties are great. I was referring to constructors.
>>
File: 1447540131824.gif (439KB, 250x188px) Image search: [Google]
1447540131824.gif
439KB, 250x188px
Alright my C# skills are top class, EF skills are high, and LINQ to X is pretty great, albeit not very hard thing to do for any of these.

Webforms experience is great, but trying to actually come into the 21st century but am having trouble finding a good starting place for MVC.

The tutorials I find use MVC 4, however I'm told it's pointless and to find a tutorial that uses MVC 5 and Razor and to learn REST services. But for the life of me can't find full tutorials anywhere.

Any help from fellow she sharp devs on getting a good starting point down would be appreciated
>>
>>51475786
>>51475835
>>51475884
const char* SHALL NOT BE INFRINGED
>>
>>51475911
Bingo, sir.
>>
>>51475020
I like how you purposefully chose the most crufty examples of C and C++.
Nobody does shitty #define macros in C.
>>
>>51475846
>That's not how you spell Javascript.
That's not how you spell Chinese.
>>
File: 234234.jpg (87KB, 409x285px) Image search: [Google]
234234.jpg
87KB, 409x285px
>>51475846
>>
>tfw you mention that you wrote something in C
>everyone asks why you still use that shitty language
>you mention "m-muh performance"
>they sarcastically suggest you write in assembly instead
Why do all you faggots think the difference between writing C and writing ASM is basically nil? C, C++, Java, Python -- it's all still abstract, high-level programming, and I'd expect a programmer in any of these languages to be able to rewrite any program into any other language with some effort.

Assembly is not the same and it requires an entirely different skillset. Writing something in C is trivial. Writing the same thing in ASM will take much longer, period.

Writing the same thing in Python might be faster, it might not be, but it certainly won't execute faster.
>>
>>51475946
What? How do you do it in C, then? I use #define macros all the time.
>>
>>51475846
that's not how you spell node the only real dev language.
>>
>>51475974
>translating C++ to Java to C is easy
>translating C++ to C to assembly is hard
>>
File: 1446581256145.jpg (30KB, 461x373px) Image search: [Google]
1446581256145.jpg
30KB, 461x373px
This shit is driving me nuts

After reading an M * N array of ints, how can I print the maximum value for each row?

Like this: The maximum value on row 1 is :
The maximum value on row 2 is:
.....
and so on

C or Java.
>>
>>51475991
Why wouldn't you write MAX and MAX3 as their own functions?
Hell, you can even reuse them.

>>51475974
People have been brainwashed into thinking python/js/etc is the future and C is this ancient trainwreck on the same level as COBOL even though their fucking memory safe and sandboxed scripting languages are all implemented in C or C++.
>>
>>51476017
easy you calculate the maximum and then print for each row
>>
>>51476011
Yes, translating C++ to Java to C is pretty fucking simple. Translating C code to *optimized* assembly is a pain in the ass comparatively.
>>
>>51476017
Holy shit you're hopeless.
>>
>>51476017
so it's a 2d array or just a big 1d representing a 2d structure?
>>
>>51476027
>Why wouldn't you write MAX and MAX3 as their own functions?
They wouldn't be generic.
>>
>>51476017
Is the data sorted?
Do you want to sort the data?
Why the fuck isn't your data sorted?
>>
>>51476031
>this is what C programmers actually believe
>>
>>51476040

yeah?
it's not as easy as it seems
>>
>>51476027
Why would you write functions when you could use macros? You can reuse macros too. I have a .h full of helpful helper macros like this.

Macros have the advantage of being type-agnostic, and since C doesn't have function overloading, it's quite useful.
>>
>>51475864
I think it can be done. It's going to be an anti-idiomatic mess that leaks memory, isn't useful in real situation, in brief pointless and awfully stupid, but it JUST WERKS
>>
>>51476051

a 2d array of ints
>>
>>51476061
You can write them as generics.
Either way, you don't want to use #define for anything but magic numbers.
>>
>>51476096
>You can write them as generics.
Show me how you'd do this in C. I'll be waiting.
>>
>>51476031
translating Java to *optimized* C, you mean?
>>
>>51474126
>no racism
>no insult
>no sexual harassment
>no gender discrimination
Fuck you, you fucking nigger pussy cunt kike faggot
>>
>>51476110
The compiler can handle that.
>>
What language should I start learning? I have a talent for programming, but little experience. I have experience with Scratch, Java, Visual Basic, and Jeroo, so mostly just building blocks. I've also got a real nack for HTML. What's the best language to learn for general IT work?
>>
>>51476122
b&v&n&os
>>
>>51476027
If you wrote them as functions then you'd have to make a different function for int/real/signed etc.
Also macros are just guaranteed inline.
>>
>>51476106
>>51476154
>what is void types
I'm not going to spoonfeed you, good day.
>>
>>51476096
You know C doesn't have templates/true generics.
They introduced that weird _Generic thing in C11 but that's basically a type-based switch statement.
>>
>>51476173
Anything but C89 is heresy.
>>
>>51476164
>by-passing typing by passing void pointers
you fucking mongoloid cunt
>>
>>51476164
Alright, you've gotten the values into the function. Now compare them.

void *genericMax(void *x, void *y) {
// what goes here?
}


>I'm not going to spoonfeed you
Oh, right, because you can't.
>>
>>51476089
for(array a : array){
int max = 0;
for(int i : sub_array){
if(i > max) max = i;
}
System.out.println(max);
}

somethin like that idk i'm an amateur babeey
>>
>>51476188
Just cast them to doubles, anon. It's easy! And so fast! :^)
>>
>>51476188
return x > y ? x : y;
returns the largest pointer
>>
>>51476209
Kek, I should borrow that
>>
>>51476204
int main()
{
struct test { int value; };

struct test a { .value = 2 };
struct test b { .value = 3 };

void* max = genericMax(&a, &b);
}
>>
>>51476188
genericMax should have a 3rd argument that is a function pointer to a custom compar function that you specify.

The compar function would cast them to the type you want and then returns less than zero if less than, 0 if equal, and 1 if greater than.
>>
>>51476209
>>51476188
>ugg how does pointers work
are you fucking serious
return *x > *y ? *x : *y;
>>
>>51476245
>missing the joke
>dereferencing void pointers
>being retarded
>>
>>51476244
>going through all that trouble instead of just writing a fucking macro
Christ. It'll also be slower, because last I checked function pointers don't get inlined.
>>
>>51476244
All of this to avoid a harmless #define
People are literally so retardedly dogmatic sometimes, it's utter nonsense
>>
>>51474686
Been a while but it means f is a predicate defined as something. It is an equivalence between the two sides relating the parameters to something. The parameters are not themselves predicates (though predicates might appear on the right hand side)
>>
>>51476245
>dereferencing void pointers
>>
>>51476017
import numpy
numpy.maximum(data, axis=0)
>>
>>51475835
>Are strings immutable in C, the most commonly used language?
String literals are.
>>
>>51476188
>>51476187
>>51476164

What's more, passing void* is detrimental to the compiler's ability to optimise - since it's harder for it to work out wtf you're doing.

And in the worst case scenario - you're now having to go to the RAM just to do fucking min/max.
>>
>>51476283
>String literals are strings
OK... but string literals are "literally" useless in most programs.

User input can't be a string literal. Data read from the hard drive can't be a string literal. They're a tool to make your programming easier, but they're not really "strings".
>>
>>51476286
>>51476257
>>51476262
Why is this even an issue?
It's 2015.
>>
This seems like a good time to remind everyone that C strings aren't text.
>>
File: 1440102087068.png (74KB, 870x867px) Image search: [Google]
1440102087068.png
74KB, 870x867px
>>51476308
>>
>>51476308
#define current_year 2015
>>
>>51476286
But anon, macros are EEEEEEEEEEEVIL! :^) :^) :^) :^)
>>
>>51475454
>it's arguably the fastest language to /write/.
Except it's not. It many ways, it's much slower because of the lack of features and frameworks.

> datalogs get dumped on their laps and they have to parse them real quick
Python sure isn't the way to go with that one if you want quick
>>
>>51476334
>it's much slower because of the lack of features and frameworks

Have you even used python?
>>
>>51476308
A cpu cache miss can cost 500 cycles.
It doesn't matter how fast each cycle is - that's still ~200 times slower than it could've been.
>>
>>51476352
import shitpostbot

shitpostbot.shitpost()
>>
>>51476283
#include <stdio.h>

int main()
{
char s[] = "immutable, you say?";
s[0] = 'n';
puts(s);
return 0;
}
>>
>>51476357
>premature optimization
you people make me laugh, as if your fizzbuzzes need to run 200 times faster.
>>
>>51476388
What language is this? Looks hard to write
>>
>>51476388
>copying the string literal into a local array

Please try again.
>>
Reminder that Python is literally the worst language ever invented.
>>
>>51476388
>[]
That's not a string literal, idiot.
That's a char array you initialised with a string literal.
>>
>>51476399
Fucking this.
Absolute garbage tier language.
>>
ITT: Autism
>>
>>51476427
>>51476399
HAHAHAHAHAHA
>>
>>51476427
nice
>>
File: 1445311716435.jpg (95KB, 724x720px) Image search: [Google]
1445311716435.jpg
95KB, 724x720px
>>51476399
>>51476427
>>
>>51476399
Finally one thing everyone in this thread can agree on. If you disagree, gtfo to /wdg/
>>
hello senpai ily
>>
void qsort(void *base, size_t nmemb, size_t size, 
int (*compar)(const void *, const void *));


Friendly reminder that this is idiomatic C.
>>
Is Python really anything but a toy language?
>>
>>51476476
And?
>>
>>51476476
>tfw you wrote your own quicksort because you couldn't figure out how the C stdlib did it
>>
File: ahmeds-face-when.jpg (58KB, 634x422px) Image search: [Google]
ahmeds-face-when.jpg
58KB, 634x422px
>>51476427
>>51476399
>>
File: anime_gril_facepalm.jpg (53KB, 372x363px) Image search: [Google]
anime_gril_facepalm.jpg
53KB, 372x363px
>>51476427
>>
>>51476478
Nope.
This guys >>51476399 and >>51476427 have it right.
>>
>>51476476
Pretty concise looking.
I can see immediately that this thing takes a pointer, two sizes, and a function pointer (a function which itself takes two pointers).

What's the problem?
>>
im fresh graduated, c# and java based. And have a little knowledge about C. Accepted a c job which is embedded programming.

Do i gonna regret it ?
>>
>>51470662
not when it comes to the scope of a. and being forced to use a while loop instead of a normal for loop as you are in python is just cumbersome and pathetic
>>
>>51476524
>Do i gonna regret it ?
Maybe you should learn English first.
>>
>>51476524
Anon please give me your job. I am a professional NEET and I've been programming in C for the past 8 years.
>>
What's happening in Belgium?
>>
>>51476512
just stop
>>
>>51476548
That isn't me.
>>
>>51476394
W T F
T T
F T W
>>
>>51476565
use a different tripcode then
>>
>>51476394
RETARD

FUCK OFF TO STACKOVERFLOW/GITHUB/REDDIT FUCKING FAGGOT
>>
>>51476542
yeah have some problems with english, im not english origin mate. you dont need to be mad.

do i regret to accept the job?
>>
>>51476534
also, more subtly, for and while loops behave differently with regards to break and continue
>>
>>51476547
you tell me, i ain't following the news right now
>>
>>51476308
>>51476394
This is how you spot someone who's never worked on a VM or anything largely CPU bound before.
>>
>>51476396
it's erlang
>>
>>51476617
nah just roll with it, maybe try to learn some C before you start but really with java/C# you have the most basic parts down and learning the specifics of C shouldn't be that hard.
>>
Holy shit furry porn is the best.
>>
File: umaru2.jpg (1MB, 1700x2400px) Image search: [Google]
umaru2.jpg
1MB, 1700x2400px
>>51474126
>>
>>51476394
>>51476308
Can't tell if ignorant or just really really stupid
Either way you're a moron for having that kind of attitude

>>51476666
fucking best innit
>>
>>51476662
yea currently working on it mate, thanks for reply. its not so different from c#.

im currently reading "the c programming languages 2. edition"
>>
What's the best way to introduce someone to programming?
I'm adept at C now, but I don't actually remember how I got at this point because I just took bits and pieces from different tutorials over the course of 2 years.
>>
>>51476636
i dunno checking /pol/ you probably should too
>media blackout
>mximum terror threat level
>>
God I'm such a fucking faggot.
>>
>>51476636
Good news site I found:
http://www.reddit.com/
>>
>>51476476
Well, yeah, good luck implementing quicksort as a macro.
>>
>>51476725
c is hard to start with, try c# or java to introduce, high level languages better with start
>>
>>51476767
should be possible
>>
>>51476816
>c is hard to start with
No it's not. I learned C as my first language and I had no problems with it.
C is very intuitive, unlike the Java forced-OOP shit.
>>
>>51476816
If you've never malloc'd memory before, you have no business using the new operator in Java.
My first experience with programming was with java and I had no idea why things were written like String s = new String("string");

It wasn't until I looked at C++ that java started to make sense.
>>
>>51476869
>malloc
>C++
wut
>>
>>51476733
damn we're getting keked hard

at least if you look at it on the bright side, something is happening so that hopefully we'll be getting less mudslimes coming into europe
>>
>>51476879
sorry, meant C
>>
>>51476882
>another country will declare war on ISIS
>>
>>51476816
Fuck off. This meme needs to die. C isn't hard to start with. A "Hello World" in C is easier to understand than a "Hello World" in Java, for instance.

The difference is, in C, you have to build your own tools from scratch, and that's where a lot of the learning comes in. In Java you just call one of the thousands of standard library and never learn a goddamned thing.
>>
>>51476869
You don't need to understand malloc to understand Java's new.
You create a NEW object, instead of calling some static function, makes perfect sense.
>>
http://strawpoll.me/6075877
>>
>>51476879
I use malloc exclusively and I write in C++ every day. Is there a problem?
>>
>>51474726
> "unicode string" is meaningless
It usually has a very clear meaning, i.e. a sequence of wide characters whose values are unicode code points, e.g. wchar_t* in C or std::wstring() in C++ when __STDC_ISO_10646__ is defined, or Python's "unicode" type.

Note that this isn't the same thing as a UCS-2 or UTF-16 or UTF-32 string, even when it happens to have the same representation. UCS-2, UTF-16 and UTF-32 are encodings, which describe a sequence of *bytes*. A wide string is a sequence of wide characters, "wide" meaning that they're larger than a byte. The fact that a wide character is (like anything else) stored as some number of bytes isn't relevant here.

Files store bytes, hence they don't store "unicode strings", they store UTF-8, UTF-16, UTF-16-LE (or whatever) strings (also note: byte order matters here; "UTF-16" without qualification is big-endian; that's inconvenient for Microsoft, who a) historically developed for little-endian architectures and b) like to read/write chunks of memory directly from/to files without explicit serialisation, so they invented the UTF-16-LE encoding, which is little-endian).
>>
>>51476946
That's the thing I hate most about C++fags: they like to pretend that they're writing C and not writing C at the same time, and switch between them to better fit their shitty arguments.
If you're going to write C, write fucking C.
>>
>>51476974
I refuse. C++ is largely shit, but has features that I don't think should exist in C, but are also genuinely useful and make programming faster and easier. I'm not talking about templates (which are shit compared to real metaprogramming), I'm talking about stuff like default arguments, function overloading, and (limited) operator overloading. Besides those things, I write C... it's just compiled as C++.
>>
How would i go about doing somehting like this?
int main(int argc, char** argv){
if(/*argv contains hello world*/){
printf("Hello World!");
}}
[/code[
>>
>>51476869
CS101 Java tard here
why are things written like that?
>>
>>51476974
>I hate C++ users because they can execute C code
>>
>>51475090
Passing strcmp directly to bsearch is what's breaking it.
>>
I mostly have no idea what I'm talking about.
And I'm full of my self.
>>
>>51477010
why would you want to do that? jesus christ
just print the argument?
>>
>>51477016
Do you not even know the difference of a class and an object?
>>
>>51477016
String s = new String("string");

You're declaring a pointer s of type String and assigning it with the return value of a string constructor String("string");
or something

i don't even know
>>
>>51476944
>http://strawpoll.me/6075877
* myself
>>
>>51477016
you are saying make a String called string and you call the String constructor (new String( ) ) to make an instance of a String object, as Strings are objects in Java
>>
>>51475093
>>>51474879
>Why would you be serializing a reference?
Your my man! Hehe
>>
>>51477016
because you're creating new objects.

Nigger nig;

is just a variable in java.

new Nigger();

creates a Nigger

Nigger nig = new Nigger();

creates a Nigger and assigns it to nig.

Nigger nig = nog;

assigns the variable nog (which could be referencing an existing Nigger object) to nig without creating a new Nigger.
>>
whats up with typescript encapsulation, modules?
i wanted to pack everything into file modules, or external module in typescript

but because i cant use modules everywhere, there is some client code just laying in the global namespace without export

now it seems i cant access this code/definitions from the modules, even when referenced? why?
>>
>>51477010
Umm
int main(int argc, char **argv)
{
if (strcmp(argv[1], "Hello World!") == 0)
{
printf("%s", argv[1]);
}
}
>>
>>51477102
So these variables are just pointers, except you aren't allowed to do normal pointer stuff with them, is that right?
>>
>>51477017
I didn't say that at all.

>>51477003
>default arguments
Pointless and hides information.
>function overloading
Name mangling
>operator overloading
Hides information
>>
>>51474879
lmao C# strikes again
>>
I don't even know how to program at all.
I just regurgitate crap i hear on reddit and pretend to be smart.
>>
>>51477129
they're object references, kinda the same thing as pointers but they're called references. they reference objects that live on the heap. but yeah no pointer arithmetic except if you use sun.misc.Unsafe (which you shouldn't).
>>
>>51477102
Why have an explicit new though?
Wouldn't it still be unambigious without new?
It's not like you can have static constructors, or functions in Java.
>>
>>51477132
But they make code easier to write and look at. I don't think they belong in C but they aren't huge sacrifices. The downsides you list aren't an issue (for me, anyway).
>>
>>51476970
This is all 100% true.

Wide strings in many languages don't implement the string as an array of code points, instead using UTF-8 or some other encoding internally to save memory. They still let you operate on the string as a sequence of unicode code points, which is what makes them unicode strings. To store the strings in files or send them over the network, the string also provides "encode" and "decode" operations for converting the string to and from an array of bytes using a specified encoding.
>>
>>51477177
it's more readable that way. whenever you see a new, you know that an object is being created.

if it were like
Nigger nig = Nigger();

it wouldn't be as obvious if it's calling a constructor or a method named Nigger
>>
>>51477177
It helps let you know when you're creating a new object that will go on the heap. You don't need it for anything really.
>>
>>51477224
What sicko captializes method names?
>>
>>51477256
I capitalize the constructors
>>
>>51477102
>Nigger nig = new Nigger();

Why do you have to say Nigger twice? That seems like pointless repetition.
>>
>>51477293
auto nig = new Nigger();

Much better, right?
>>
>>51477274
calling the constructor in an instance again?
that just seems wrong
>>
>>51477293
Subtyping.
Nigger nig = new JohnBoyega();
>>
>>51474126
a very shitty file system just because
>>
>>51477293
Don't forget to comment your code:

Nigger nig = new Nigger();  // Create the Nigger
>>
Remember to express ownership using smart pointers.
auto nig = std::make_unique<Nigger>();
>>
>>51477256
regardless, with an explicit new you can tell at a glance and you can search for all object creations in the code by searching for "new "

>>51477293
this: >>51477323
>>
>>51477318
In C++
Nigger nig;
will call the default constructor.

You call non-default constructors like
Nigger nig(arg);
.
>>
>>51477376
>constructors
Literally why? Don't initialize values until they're necessary.
>>
>>51477376
What?
C++ automatically creates an object when you just create a new variable? That's retarded.
>>
>>51477410
Constructors can do more than just initialize.

>>51477413
What's the issue?
>>
>>51477323
Why would you ever need to do that, though? You know you have a JohnBoyega becaue you created it, so why would you obscure that by making the variable Nigger and not JohnBoyega?
>>
>>51477427
Maybe I want to fit an existing object into that variable later, so I want it to not have it create a new useless object?
>>
>>51477413
i believe C++ has separate references/pointers
>>
>>51477413
This is what C++ is all about: obfuscating shti from you, the programmer, pursuing the false ideal of "abstraction". It's the same retarded bullshit with references. In C++, you never know if you're passing a function a pointer or a value. At least in C you explicitly have to pass in the address.
>>
>>51477450
Program to an interface, not an implementation.

>>51477465
Then use placement new.
>>
>>51477478
>Program to an interface, not an implementation.
THIS IS WHAT OOPFAGS ACTUALLY BELIEVE
>>
>>51477413
Well most of the time. If it's a primitive they'll be left uninitialized.

>>51477410
Well it'd be nice if you could skip the constructor sometimes but at least you know you're never going to be using an uninitialized value. Compilers will usually optimize away the first constructor if you write it again without reading the initial value.
>>
>>51477450
So I don't have to cast it again when I want to put into a method that only takes Nigger?
>>
>>51477450
Motorcycle motorcycle;

if(massiveDouchebag) {
motorcycle = new HarleyDavidson();
}
>>
File: 1447381587340.gif (1MB, 260x173px) Image search: [Google]
1447381587340.gif
1MB, 260x173px
Is ASM supposed to make any sense?

>design a program that takes the following arguments and prints the number of positive, negative numbers, and the sum of positive, negative numbers
>123, -23, 17, 92, -1, 43
>>
>>51477508
What? Casting to parent classes is automatic. It's the other way around. If you declare a Nigger, you can't call JohnBoyega methods on it without explicitly casting.
>>
>>51477492
Interface vs. implementation is a generic dichotomy. Not specific to OOP.
>>
>>51477565
that problem has nothing to do with ASM. And yes ASM makes sense
>>
>>51477521
That's not the same as the one-liner though. You may as well call a function that returns a Motorcycle.
>>
>>51477565
It makes perfect sense
>>
>>51477591
The one-liner was just a vastly simplified example to show why you might want to specify the type separately from the constructor.
>>
>Higher inductive types (HITs) are a generalization of inductive types which allow the constructors to produce, not just points of the type being defined, but also elements of its iterated identity types.

>While HITs are already useful in extensional type theory, they are most useful and powerful in homotopy type theory, where they allow the construction of cell complexes, homotopy colimits, truncations, localizations, and many other objects from classical homotopy theory.

Help
>>
>>51477566
Except when I want to use my method that uses Nigger and not the overloaded method that takes JohnBoyega
>>
>>51477691
To be fair, if there's a functional difference that would lead you to do something like that, you shouldn't be overloading.
>>
File: first time i launch my script.gif (2MB, 460x273px) Image search: [Google]
first time i launch my script.gif
2MB, 460x273px
NEW THREAD AT >>51477701

NEW THREAD AT >>51477701
>>
>>51477591
take this for example:
List<Nigger> list = new ArrayList<Nigger>();

a class that uses the list will work the same whether it be an ArrayList, LinkedList or whatever, so you just have a List variable instead of having to specify the implementation further.
>>
>>51476334
Sorry but you have no idea what you are talking about buddy. You are thinking about a specific application of code-writing that indeed Python is ill-suited for. Even though numerous people have explained it to you, you haven't been able to grasp that there are other things you can use computer science for.
>>
>>51476869
>It wasn't until I looked at C++ that java started to make sense.
This. I think wouldn't really understand and/or appreciate half of the features of OOP languages without knowing C and Pascal.
>>
>>51477224
>it wouldn't be as obvious if it's calling a constructor or a method named Nigger
I don't find this that useful personally. You end up calling functions all the time that create object behind the scenes anyways. F# drops the need for the "new" keyword, and I like how it makes code that bit more concise. "new" adds more noise than it does useful information imo.
>>
>>51477750
Nigger, you still had to say "Nigger" twice.
>>
What should be my first language to learn if I have no prior programming experience?
>>
>>51477961
var nig = new nigger()
>>
>>51477961
big whoop. the "verbosity" of java is way exaggerated by neckbeards who cannot into IDEs
>>
>>51477985
C
>>
>>51477985
java

https://docs.oracle.com/javase/tutorial/
>>
>>51477992
The IDE doesn't stop it being verbose you idiot. It just makes typing all that redundant shit a little less painful.
>>
>>51478022
I wish the IDE would hide all of those lines that only have a { or a } on them.
>>
>>51478022
so it's too much to ask for you to specify that the list holds Niggers and not whatevertheflyingfucks. maybe you should stick to your coloring books
>>
>>51477961
You don't have to, you can do:
List<Nigger> list = new ArrayList<>();
>>
>>51478015
>https://docs.oracle.com/javase/tutorial/
Sorry I'm a noob, not even a noob, I haven't begun.

Is java the same as javascript?
>>
>>51478070
And now you said "list" three times.

Javafags, everyone.
>>
>>51478082
all three are different things, retard
>>
>>51478051
>so it's too much to ask for you to specify that the list holds Niggers and not whatevertheflyingfucks.
It's not too much no if I have to use a language that forces me to. But why would I choose to use a language like that over on that doesn't?
>>
>>51478082
literally retarded
>>
>>51478070
or you could use an actually good language and write
let list = List<Nigger>()

Oh, and with actually working generics too. Nice.
>>
>>51478079
no, java is more of a "serious" programming language for use on all sorts of applications. javascript is a mostly unrelated (except for the name) scripting language that is mostly used for web development for displaying websites and such.

the link should be a good start if you start with
>Trails Covering the Basics
>>
>>51478079
yeah
>>
>>51478137
list ain't the same thing as arraylist moron
>>
>>51478106
>>51478137
>what is strong typing
>what is performance
absolutely disgusting
>>
>>51478176
It's the equivalent in .NET anon. The .NET one is better though, since you can make a List of ints without having to box every single fucking one of them.

>>51478178
That code is actually just as strongly typed and performant as you're code. I don't know what makes you think otherwise.
>>
>>51478238
>you're
not funny
>>
>>51478079
>>51478154
May consider looking into this, is that link you gave me the best place to study it?

Any other sites I could potentially learn it, do I need to buy the books the site is recommending?
>>
>>51478400
you don't need to buy books unless you prefer physical books to reading on the computer. i suggest going through those trails and also looking things up on google if you want to read more about some specific subjects. stackoverflow often has good answers that can be found via a google search. you can also ask here about things you're wondering about. good luck anon
>>
>>51478480
Thanks anon, I'll try and put at least an hour a day into learning. Guess since it was recommenced I'll start learning Java first.
>>
>>51478675
>falling for the Java troll
>>
>>51478692
Am I being played? You're telling me I shouldn't learn Java?
>>
>>51477102
>>51477065
Ok, that makes sense - but what does this have to do with C++?
>>
>>51478774
Nah, just fucking with you.

Go ahead learn Java.
>>
>>51478774
There's no reason to learn Java these days. Just use C#. It's almost identical, except less fucked up. Less chronically depressed/self hating community too.
>>
>>51478822
>completely useless outside ms platforms
>almost identical to a language with a fuck of ton great truly cross-platform libraries and tools
>>
>>51478849
>completely useless outside ms platforms
It runs great on just about every platform I can think of. MS even have an IDE for OS X and Linux.
>almost identical to a language with a fuck of ton great truly cross-platform libraries and tools
So does C#. And it's not a shit language either.
>>
>>51478925
>So does C#. And it's not a shit language either.
No, it doesn't.
Only the core language is reasoably cross-platform.

You can't even run modern .Net application on XP, that's how shit it is at being cross-platform.
>>
>>51478968
>You can't even run modern .Net application on XP
You can still run C# on it just fine. Which is what I'm talking about. You can target .NET 3.5 at least and not have a problem.

Obviously I'm talking about the core language. What else would I be talking about. PCL assemblies will run on just about every platform without issue.
>>
>>51479039
>Obviously I'm talking about the core language. What else would I be talking about.
The ton of great cross-platform libraries and tools I talked about that you claimed C# has?
>>
>>51479069
Ah of course. Libraries: nuget.org
Visual Studio and Xamarin Studio are pretty great.
>>
>>51479098
What does that have to do with cross-platform?
>>
>>51479135
What do you mean? Everything. Most of the libraries are cross platform. XS is cross platform. VS isn't, but the code it compiles is cross platform of course.
>>
>>51479360
oh, i forgot Visual Studio Code, which runs on windows, os x and linux
>>
>>51479360
They're not though
>>
>>51479388
And is just an editor and has really nothing to do with VS, and also is fucking node app.
>>
>>51479393
find me some that aren't. The top 10 are all cross platform.
>>51479402
No, it's a full IDE with intellisense and full debugger support. The new version is at least.
>>
>>51479427
Most of the asp.net stuff for example?

>>51479427
>full debugger support.
Yeah, for fucking JavaScript.
VS Code is Atom-tier shit.
>>
>>51479477
>Most of the asp.net stuff for example?
Yes, mono supports ASP.NET last i checked.
ASP.NET 5 specifically supports microsofts core CLR on os x and linux. They have first class support now going forward.

>Yeah, for fucking JavaScript.
No, for C#, F#, Go and a bunch of fucking others, i dunno. It's fully extensible.

>Atom-tier shit.
Stay salty
Thread posts: 360
Thread images: 16


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

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.