[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 29
File: timetocode.webm (2 MB, 1152x648) Image search: [Google]
timetocode.webm
2 MB, 1152x648
This is /dpt/, the best subreddit of /g/

Umaru-chan edition, the best of all editions.

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

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

wat r u working on, anon-chan ?
>>
>>53805279
What even happened to the last thread?

Did it just get buried under the April Fools shenanigans?
>>
File: CPP functional.png (22 KB, 528x536) Image search: [Google]
CPP functional.png
22 KB, 528x536
>>53805291
It got nuked
No idea why
>>
>>53805291
it was deleted, maybe because of shitposting, maybe to force people who hadn't refreshed the page to see the april fools cancer
>>
reminder that google is cheap as fuck and prioritizes quantity over quality, and they push material design as a cheap cargo cult copy of apple's design
>>
>>53805291
Last thread was not umaru aproved.
>>
>>53805372
>material design
I really want to like some parts of it, but overall it feels too kitschy.
>>
I wrote this for some anon's homework yesterday.

I'd like to know if there's any glaringly retarded things in here:

static void GetLinesOfInputAndReturnLetterCountsOfWords()
{
int lineCount;
var lines = new List<List<string>>();
var counts = new int[10];

WriteLine("How many lines of text are you going to write? (Max 10 lines)");

if (int.TryParse(ReadLine(), out lineCount) && lineCount <= 10)
{
WriteLine($"Input {lineCount} " + (lineCount > 1 ? "lines" : "line" ) + " of text now. Strike the return key after each line.");
foreach(var x in Enumerable.Range(1,lineCount))
{
lines.Add(Regex.Replace(ReadLine(), @"[^\w\s]", "").Split(' ').ToList());
}

foreach(var line in lines)
{
var tempLineCounts = line.Select(x => x.Count());
foreach(var word in tempLineCounts)
{
if(word <= 10) counts[word - 1] += 1;
}
}

WriteLine("--------------------");
WriteLine("Word length counts: ");
for(int i = 0; i < counts.Length; i++)
{
var x = counts[i];

if (x != 0) WriteLine($"{i + 1} " + (x > 1 ? "letters: " : "letter: ") + x);
}
}
else
{
WriteLine("Input invalid. Please try again.");
test();
}
}
>>
File: 1442620447676.jpg (41 KB, 500x404) Image search: [Google]
1442620447676.jpg
41 KB, 500x404
>Tfw my calculator is 4000+ lines and I haven't even started implementing vector math yet.
Should I just give up?
>>
Does anyone with experience in networking know how to check if a UDP datagram was sent by a client to a server in C? I can currently receive datagrams from clients with recvfrom (), but what I really want to do is check if a message was sent on the UDP socket, and if a message was not sent then I want my program to continue running instead of waiting. I tried using the MSG_PEEK flag as a way to check I'd there were any messages on the socket, but this isn't really working for me. I've done a lot of googling for the past 8 hours and I cannot find anything which can help me, and stackoverflow posts aren't helping me with the question I have.
Does anyone here know what I should try next?
>>
Oh jesus, gook moot has gone and done a thing.
>>
If any /dpt/ friends need to block the faggotry, try blocking this URL in Adblock Plus.

Not sure if there's a uBlock alternative:

https://s.4cdn.org/css/md2016.*.css
>>
>>53805479
4 KLOC is nothing for a serious project, especially if it has a GUI
>>
>>53805513
fuck yeah thanks based anon

it works in ublock
>>
>>53805479
refactor
>>
>>53805535
How did you get it to work in uBlock?
>>
>>53805479
Never give up, anon
>>
>>53805547
copy and paste

https://s.4cdn.org/css/md2016.*.css


into "my filters"
>>
>>53805627
Oh, I see.

Still breaks my AppChan X slightly.

Damn it.
>>
>>53805342
>main1
>main2
Yep, in the trash.
>>
>>53805342
The first time I read 'currying' I thought it was an insult to Indians.
>>
File: CPP functional 2.png (12 KB, 454x286) Image search: [Google]
CPP functional 2.png
12 KB, 454x286
>>53805674
>>
Anyone taking cs50 course on edx.com?
>>
>>53805627

For some reason, that does nothing for me.
>>
Xth for null coalescing operators are cute!

CUTE!
>>
>>53805724
same here
>>
>>53805731
>>53805724
Are you using http instead of https?
>>
>>53805725

Not cute, but useful.

>>53805731

I just fixed mine -- not using https, so remove the "s" and it works just fine.
>>
>>53805750
>>53805745
right, had to remove the s.
Still looks pretty fucked on appchan though.
>>
>>53805762
Appchan must be pretty shit. I'm using mayhems 4chanX and got it almost the same as before.
>>
>>53805750
>null coalescing operators
>Not cute

Look at this little slutty minx right here:

int? ayy = null;
int lmao;
lmao = ayy ?? 0;
>>
Hi /dpt/ I'm an aspiring systems programmer
Would it be generally good practice to put my comments in another script, such as Hebrew, Persian, or Russian? Because the code is already in English, so my logic is that only non-english speakers would really need the comments. Or am I totally off base here?
>>
File: fam.png (190 KB, 1370x754) Image search: [Google]
fam.png
190 KB, 1370x754
>>53805780
>how it looks like after filtering the css
>>
>>53805466
I think your version severely lacks LINQ memes
var counts = 
lines.SelectMany(line => line.Select(w => w.Length))
.Where(x => x <= 10)
.Aggregate(new int[10], (acc, val) => { acc[val - 1]++; return acc; });

Like this one.
>>
File: fam.png (130 KB, 1370x754) Image search: [Google]
fam.png
130 KB, 1370x754
>>53805780
>>53805794
>How it's supposed to look like
>>
What the fuck is this layout? You think this is a game, goot?
>>
>>53805279
Trying to work on my printerclass as my very first Java programming task after doing the Oracle tutorial on classes and I get the feeling I am chewing on more than I can handle for now.
FUCK!

any pointers?
Would be nice.

The (commented) abomination is here:
Printerdemo: http://pastebin.com/QtQtYRyj

Printerclass: http://pastebin.com/vr2QqQyN
>>
>>53805794
Do you have greasemonkey?

// ==UserScript==
// @name tomorrow
// @namespace wha
// @include https://boards.4chan.org/*
// @version 1
// @grant none
// ==/UserScript==

//https://s.4cdn.org/css/tomorrow.css

function addStyle(style) {
var head = document.getElementsByTagName("HEAD")[0];
var ele = head.appendChild(window.document.createElement( 'style' ));
ele.innerHTML = style;
return ele;
}

addStyle('@import "https://s.4cdn.org/css/tomorrow.css"');


Change the url to whatever garbage appchan uses.
>>
>>53805627
This worked for me but all the real themes are gone, I'm stuck on fucking Yatsuba. Help
>>
>>53805822
probably as good as you're going to get today without fiddling with the CSS yourself
>>
>>53805819
THANK YOU
>>
File: ss (2016-04-01 at 02.48.59).png (62 KB, 1211x624) Image search: [Google]
ss (2016-04-01 at 02.48.59).png
62 KB, 1211x624
>>53805819
>Change the url to whatever garbage appchan uses.

I thought appchans's themes were built in
>>
File: 1455129061410.png (2 MB, 707x1000) Image search: [Google]
1455129061410.png
2 MB, 707x1000
Here's how to disable the theme using uBlock (which you should be using instead of ADB):
>right click on uBlock icon
>options
>my filters
>paste "s.4cdn.org/css/md2016$stylesheet,domain=4chan.org" without quotations
You're welcome.
>>
>>53805803
although fairly sure it won't optimize the lambda in Aggregate and will copy the accumulator array around N times, where N - number of words shorter than 10 letters.
>>
>>53805843
>uBlock (which you should be using instead of ADB)
this
>>
>>53805841
They exist somewhere. The url can also be within the local folder.

This is /dpt/ you should be able to do this yourself.
>>
>>53805861
well I tried it with tomorrow and it seemed to make no difference.
>>
>>53805843
>You're welcome
this
>>
>>53805803
>>53805850
Thanks.

Problem is, this is one of the few times where I don't think I'd want to LINQ it up, as your LINQ only replaces the one foreach statement.

In this case, I think it's much easier to read the non-LINQ:
foreach (var line in lines)
{
var tempLineCounts = line.Select(x => x.Count());
foreach (var word in tempLineCounts)
{
if (word <= 10) counts[word - 1] += 1;
}
}


vs

var counts = 
lines.SelectMany(line => line.Select(w => w.Length))
.Where(x => x <= 10)
.Aggregate(new int[10], (acc, val) => { acc[val - 1]++; return acc; });
>>
>>53805881
Nested loops will NEVER be more readable than nonnested code.
>>
>>53805868
I actually installed appchan and I don't see a problem.
>>
How often do you guys, outside of your job, write down a pseudocode of your algorithm and then implement it the language you are working in.

Today I have the attention span of a toddler, so I wrote down on a piece of paper what I want to do. I don't make programs on my own volition often, but it's the first time I did something like this.
>>
>>53806066
I have a dry erase board that I sketch out basic class design and interactions between GUI and logic.

It's usually simple stuff, but just enough to have a 10,000 foot view of what I'm about to do so I can see if it's retarded.
>>
>>53805850
wrong, it obviously just passes the reference to the array around
>>
>>53805818
What are you trying to do here and what are you having difficulty with?
>>
>>53806066
Literally never. Pseudocode is for plebs.
Sometimes I'll sketch out the logic for a program/algorithm in basic terms of the language before going back and redoing verbose portions in more detail, but if I was going to write pseudocode I'd just use Python instead.
>>
C++ question from a self-taught C n00b:

I have a class I've written that I want to be able to read into from a stream. The stream will be text, and the data for the object will be fairly simple. I can think of a fairly easy solution using scanf, but I want this to work with streams.

My current approach to simple parsing is to first store the position, then attempt to parse one or more desired values, e.g.
// semi-pseudo code
bool successfulRead = false;
String openV = "<";
String closeV = ">";
String sepV = ",";

float fVal;
int iVal;

while( readWS() ); // readWS() returns true and advances the position when it reads a whitespace character

if( !readMatch(openV) ) // readMatch(openV) returns true if opening string was found
return FAILURE;

while( readWS() ); // discard possible whitespace before first value

if( readFloat(fVal) || readInt(iVal) )
successfulRead = true;
else
return FAILURE;

if( !readMatch(sepV) ) // read for separator for other (optional) members
.
.
.
(etc)


The idea being that I can easily deal with optional items because the read functions would advance the stream pointer if they succeeded, or leave it untouched if they failed. I am not sure how to fit that with C++ streams that will work with any stream.

I am more than willing to admit that I know little about parsing, but the task is really simple and I'd rather keep the hassle to a minimum (preferred no libraries or std library, but willing to do what it takes).

Background data:
I am reading vectors (math) from a text file. The vectors can have anywhere from 1 to 4 elements, and the opening, closing, and separator characters may vary, and white-space is ignored. Examples:
<1,2,3> // valid
< 1 , 2 , 3 > // identical to above
[[1, 2, 3]]
[(1, 2, 3, 4 )]
(etc)


The open/close/sep/WS strings are consistent within the file, and known beforehand. For the super-curious, this is for POV-ray Mesh2 objects.
>>
>>53806066
>>53806121
Is it bad practice to just throw code at the wall until it works?
>>
>>53806140
I prefer to type my code into an IDE until it works.
>>
>>53806140
Depends on your school of thought. There are entire disciplines of programming that believe that you shouldn't write a single line of code until you have every aspect of the entire program planned out in minute detail. There are other disciplines that say you should start with a vague idea of what you're doing and just code until it works.
>>
>>53806147
HE DID IT AGAIN

CAPTAIN LITERAL DID IT AGAIN

EVERYBODY WATCH YOUR PROSE, HE'S OUT FOR BLOOD
>>
>>53806147
>IDE
Found the winfag! REAL programmers use GNU Emacs.
>>
>>53806163
I'm not a captain.

I've never served, nor do I own a ship.
>>
>>53806133
std::istream& stream
>>
File: 1234567890.jpg (26 KB, 640x480) Image search: [Google]
1234567890.jpg
26 KB, 640x480
>>53806171
You're one cheeky cunt you know that.
>>
>>53806140
That's more or less what I wanted to ask. Maybe not write the whole pseudocode, but an outline as someone above said.
>>
>>53806190
I prefer to figure it out as I'm going along. I find it easier when treating it like a sculpture, ie you start with an ill defined blob of nothing and gradually carve out the intricate details until you have code that works. Problem is I am really shit at optimization so my code usually ends up being an enormous pile of if statements, but it works which I suppose is the main thing.
>>
>>53806184
I love you anon.

Here, have a ternary operator assignment:
string freeBeer = DateTime.Now.DayOfWeek == DayOfWeek.Friday ? "Free beer!" : "No beer today :(";
>>
>>53806213
Do you work as a programmer? How do they do things in your company?
>>
>>53806237
Thank you. I will be sure to drink it before midnight.
>>
>>53806237
What kind of a business model that is to give out free beer on Friday of all days? Sounds retarded
>>
>>53806246
I would think my lack of structure would make it fairly evident that I don't code professionally. Not yet anyway.
>>
>>53806257
I work at a small IT company.

We get free beer on Fridays. It's pretty nice.

Incidentally, we call them No-Change Fridays as well, as we only maintain, and try not to fuck anything up with changes.
>>
I'm trying to make an little program to calculate the mean deviation of values in a array. I got stuck in the variance as it return values near what they are suposed to be but not exact. FOr Example variance=4,33 it gives =4.7. Can you take a look and try to help me? Needless to day I'm new to coding.


#include <stdio.h>
#include <math.h>
int avr(int a[],int siz){
int i;
int sum = 0;
float mean;
float vari=0; /*variance*/

for(i=0;i<siz;++i){ /*calculates the mean value*/
sum= sum +a[i];
printf("%d\n", sum);
}
mean=sum/siz;

for(i=0;i<siz;++i){ /* calculates (given values)-(mean), squares that result and stores them in a array*/
double dif[siz];
dif[i]= pow(a[i]-mean,2);

for(i=0;i<siz;++i){ /* adds the squared values and assign variance to be them/siz */
double temp=temp+dif[i];
vari=temp/siz;
}
}

printf("The mean distance (variance) of the given values to %0.2f is %f\n", mean, vari);


}

>>
>>53806173
Yes, thank you dear.

But, the problem is that the tell and seek function do not work with all streams, especially with cin or cout. I was hoping for guidance with examples when it comes to parsing stream input. Insight involving strings and streams, possibly including string-streams or the like would be appreciated, but my main problem is how to do things in the "proper C++ way" when it comes to using C functions like scanf and strtok.
>>
>>53806091
I thought all the states and behaviour of a printer belongs in a class, but right now I am "programming" a clusterfuck of behaviours in the main class and made even a mainmenu in it.

But I am disgressing:
I am trying to make the printing steps work and make program go back to the mainmenu.
Either after the user doesn't want anymore, or the maintenance counter I placed in class reached 15 and informs the user of the problem, leading him back to the main menu.

Also Shouldn't the mainmenu be in the printer class and shouldn't the mainfile just create the objects and make it run?

Sorry again, this is my first time after a veeeeeeeery looong time of dabbling.
>>
>>53806140
honestly depends on your goal and time frame, but most of the time I feel I waste less time if I spend a little time planning the structure of what I'm going to write
>>
>>53806397
For the most part, classes shouldn't ever have user interaction like with menus and input. They should simply have functionality.

The setup you have now is fine.

You'll need a while loop around the main logic of your program to do that.
>>
>>53806213
Premature optimization is bad anyway. What you should do is learn some design patterns and techniques for abstraction.

I start a project by just banging out code, and if I start noticing any code smells like repeated code or nested ifs, I'll refactor before I get too far. If you get quick at refactoring, just banging it out isn't a terrible way to start.
>>
>>53806394
if you can't seek then just extract chars or use read
>>
what math library except math.h can i use in C without compiling with -lm?
>>
What is the future of Java? Microsoft shills at my uni keep saying that C# is the best, etc. What is /g/ opinion?
>>
>>53806574
Java is fine.

C# is more comfy to write in, and has a great outlook considering the //build/ conference going on.
>>
>>53806574
There seems to be a significant number of java/scala spring jobs out there.
>>
https://www.kickstarter.com/projects/520965826/basil-the-comprehensive-programming-language thoughts?
>>
>>53806654
fuck off Caolan
>>
>>53806654
>5k euros
>irish faggot who looks 12
>>
>>53806654
>>53806682
>>53806685
holy shit, read his twitter
>>
>>53806654
There's not enough to see. And from what I've seen it probably doesn't do much better than python or Processing at introducing people to programming.
>>
>>53806654
It's an April Fools Joke right?
>>
so a few months ago i was looking for websites which have programming challenges so i could work in python some more. i forgot what the site was, but one of the challenges was cellular automata, and now that's one of my assignments for class but i forget the website to get the code off of that i submitted. all i can really remember is that the code editor was blue-themed with editor on the left, the challenge on the right, and on the bottom left there was the test cases/console. i could ask for hints on each of the problems and the editor was also able to process test cases with one button. does anyone know what site this is?
>>
>>53806654
Not convinced at all. If one want to program, he need to have a good grasp of logic and abstraction. For that you already have top notch materials like sicp htdp or csforall. There already pl suited for total beginners: scheme, scratch (code.org). The code example is shit.
>>
File: haskell-fb-industry.png (1 MB, 1128x1080) Image search: [Google]
haskell-fb-industry.png
1 MB, 1128x1080
>>53806554

come join us in /fpg/ - functional programming general
>>
>>53806815
lame
>>
>>53806321
pls /dpt/
>>
How do you target fragment positions with GLSL?
>>
>>53806321
Fix that dumbass bracket style.

Google "double imprecision".

Doubles are not precise, and doing math with them leads to odd results if you're not careful.

You're dividing by an integer, 'siz', which I believe is going to do integer division, but I'm not a C++ programmer, so I'm not certain.
>>
File: 1459187089725.png (44 KB, 240x240) Image search: [Google]
1459187089725.png
44 KB, 240x240
>>53806237
>>53806321
>>53806394
Don't even know why I come to /g/

You guys make me feel stupid.
>>
i just did this
(instance.*(condition ? class::func : class::otherfunc))(param)
>>
>>53807010
Why?
>>
>>53806901
What do you mean by dumbass brackets? And it's C. Thanks
>>53806968
What do you mean? I'm started learning C a week ago and never had any pratice and decided this was a good exercise.
>>
>>53806901
doubles have pretty good precision, the result probably won't be exact but he's doing something wrong if he's getting 4.7 instead of 4.33
>>
>>53807042
i had something like this

if (condition)
instance.func(param);
else
instance.otherfunc(param);
>>
I need books/resources/tutorials anything related to fundamental Java understanding. Not practical examples, just theory.
I asked this exact same question in the previous thread but someone decided to show me why Java can't be fundametally understood. So I ask again.
>>
>>53807010
whoops, *
&class::func
&class:otherfunc
>>
Anyone here has experience with Free Pascal LCL?
>>
>>53807096
https://docs.oracle.com/javase/specs/
>>
>>53807139
no
>>
>>53806890
gl_FragCoord is available in fragment shaders. X and Y are window coordinates (Y is upside-down), Z is the depth unless you change it.
>>
There is literally nothing wrong with putting ads and micro transactions in all your programs
>>
>>53807175
We know
>>
>>53806321
double temp=temp+dif[i];

You are using temp uninitialized. you would know that if you turned on warnings. Honestly, I'm surprise it even compiled.
>>
>>53805792
If they make programs, they should know Engrish.
>>
>>53805792
Use Hindi, the official language of programmers.
>>
>>53805792

Comments are there to explain parts of the program which may be unintuitive, as well as to document the role of various functions, types, etc... They should be in English, just as the variable names and function names should be in English.

You may think this would make it difficult for non-English speakers. But consider that there are a myriad of other languages you could use, for this purpose, and choosing any one of them would still be difficult for people who don't speak that language. English is more or less a standard for software development -- at least within the open source community -- and those who don't speak it can more or less get lost.
>>
>>53807324
>not Gujarati
>>
>>53807324
True all the best programmers are of Hindi descent
>>
I don't understand
Haskell is the best programming language but Indians are the best programmers, crossdressing improves programming skill but females are better coders. How come most Haskell programmers are white cis males?
>>
>>53805484
Look into async IO, select/poll, possibly multithreading
>>
>>53807513
Here put on this dress
>>
they should make git easier to use
>>
>>53807599
easier to write codes of conduct?
>>
>>53807513
The thing here is that MOST programmers are white cis males, while the best ones are indian female crossdressers. Quite the newbie mistake you made there, but don't worry.
>>53807533
>>
>>53807599
I don't understand how to use it either. I wish someone would help me to show me how to upload all my projects and code to put on it
>>
>>53807599
>>53807619
>i lack the physical capacity of googling for a git tutorial
There, https://git-scm.com/docs/gittutorial
>>
>>53807599
Just read through the tutorial to get the basics. Whenever you come across an issue you don't know how to fix Stack Overflow that bitch.
>>
File: 1443878595513s.jpg (5 KB, 125x125) Image search: [Google]
1443878595513s.jpg
5 KB, 125x125
>>53807599
At least it's better than svn, but I agree that the CL interface is cumbersome and error-prone if you're doing simple basic commits. I use Magit (https://magit.vc/), it's really nice and quick and powerful.

Speaking of CL, although Common Lisp itself is a disgusting mess, it's still better than most "general purpose" domain-specific languages we see those days.

Ask your beloved programming literate anything!
>>
>>53807646
Thanks bro! I love you guys at /dpt/ you guys are so helpful

plus one upvote
>>
>>53807683
Why didn't you use a .webm?
Are you sure you're illiterate?
>>
>>53807683
>general purpose domain-specific
>>
>>53807740
It's voluntary you dumb curry
>>
>>53807740
t. relative of inventor of Haskell
>>
>>53807740
>Curry
>doesn't understand the simple idea of a general purpose domain-specific language
no surprise here
>>
>actually hating this theme
i unironically like it :^)
>>
>>53807683
he most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages.

Unlike most languages today, which are focused on defining specialized data types, Lisp provides a few data types which are general. Instead of defining specific types, you build structures from these types. Thus, rather than offering a way to define a list-of-this type and a list-of-that type, Lisp has one type of lists which can hold any sort of data.

Where other languages allow you to define a function to search a list-of-this, and sometimes a way to define a generic list-search function that you can instantiate for list-of-this, Lisp makes it easy to write a function that will search any list — and provides a range of such functions.

In addition, functions and expressions in Lisp are represented as data in a way that makes it easy to operate on them.

When you start a Lisp system, it enters a read-eval-print loop. Most other languages have nothing comparable to `read', nothing comparable to `eval', and nothing comparable to `print'. What gaping deficiencies!

Lisp is no harder to understand than other languages. So if you have never learned to program, and you want to start, start with Lisp. If you learn to edit with Emacs, you can learn Lisp by writing editing commands for Emacs. You can use the Introduction to Programming in Emacs Lisp to learn with: it is free as in freedom, and you can order printed copies from the FSF.

You can learn Scheme (and a lot of deep ideas about programming) from Structure and Interpretation of Computer Programs by Abelson and Sussman. That book is now free/libre although the printed copies do not say so.

Please don't buy books (or anything) from Amazon!
>>
>>53805803
More like it severely lacks Array.fold and |>
>>
Just wanna hop into programming and learn, maybe make some dinky stupid little programs. SHould I start with Python, Java, or C++/C#? I just went through that programming language site and they made it seem like for any kind of remotely successful job you need to know C++.
>>
>>53807851
>most powerful
>Lisp
kekk
>>
>>53807863
Not Python
Not Java
>>
>>53807851
Java is the most superior and you are all plebs if you disagree of Java and all of it's cross dressing glory
>>
>>53807863
Start with C++ and ignore the memesters who tell you otherwise.

Java will make you hate programming, python is for webfags, and you won't be able to understand why C# is good until you know a lot of C++.
>>
>>53807863
java, C++, or java first and then C++

https://docs.oracle.com/javase/tutorial/
>>
>>53807914
Are you retarded?
>>
>>53807863
Learn Java, it's one of the fastest, most used and comfy languages out there.
>>
>>53807929
epic meme smug hipster fag
>>
>>53807914
>>53807930
Samefag
>>
>>53807863
>>53807896
second for c++. It's a clusterfuck of features but very rewarding to learn.
>>
>>53807947
who is >>53807943 then

delusional fag

java and C++ are literally the best programming languages, and best for learning programming
>>
>>53807960
>java
you fell for the meme
>>
>>53807930
There no reason to use it over C# these days
>>
Is this tail recursive?
    def backtrack(self):

moves = []
# make a deep copy to stop any referencing isues.
node = copy.deepcopy(self)

if node.isRootNode():
# The initial state is the final state
return moves


p = self.parent
return moves + [self.transition] + p.backtrack()
>>
>>53807960
Java
1 Is not a good programming language
2 Is not a good language for learning
2 Has some of the worst design decisions
>>
kill yourself retarded memers

java is better than fucking python at the very fucking least
>>
>>53807984
no
>>
no matter what your opinion is about java, you're retarded if you don't think C# is worse than java.

C# is literally a cargo-cult clone of java with massive feature-creep due to a load of dunning-kruger pythonesque "features" tacked onto it that you aren't even supposed to uses

>many of the drawbacks of java
>many of the drawbacks of C++
>few of the benefits of java
>few of the benefits of C++

java is good for its simplicity and ability to scale to large applications. if you don't need simplicity you may as well use C++ instead. the "low level features" in C# still give you shit performance.
>>
>>53807990
Agreed. But there's no reason to use Java over C#.
>>
How to modulo in glsl?
>>
>>53807990
Sure, congratulations on your paralympics win
>>
>>53808007
mod(a, b)
>>
>>53808007
mod(x,y)

>>53808003
get suicided
>>
>>53808021
butthurt Cshart CRUDmonkey weenie detected
>>
>>53807947
really?

>>53807977
There are multiple reasons
>frameworks (see my screenshot above, c# doesn't even come close)
>libraries
>cross platformness (mono fucking sucks and is slow btw)
>speed (jvm is faster than clr)
>reliability
C# is a Java clone anyway
>>
>>53808006
Isn't Meme# mainly used only for Windows apps?
>>
>anything but C
>good
>>
>>53805803
Using Count() on a string is the dumbest shit. Also, it crashes when you start or end a line with whitespace.
>>
>>53808006
The best reason to use Java over C++ is all the jobs these days are all in Java and if you want a better chance of making good money you should learn Java
>>
>>53808042
>i'm too stupid to understand anything but fizzbuzz-tier C
>>
Reminder that ANY company that wants high performance will not let you use Java

Reminder that ANY company that wants security will not let you use Java

Reminder that ANY company that wants good code will not let you use Java

Reminder that ANY company that wants quicker development will not let you use Java
>>
in C you use structs and functions which operate on structs. languages with OOP are basically the same thing but with much cleaner syntax
>>
>>53808034
There are only three operating system that are used by non-autistic people: Windows, ios, android. c# works great on all of these.
>>
>>53808075
>java is too hard for me to learn :'(
>>
>>53807863
Ignore language recommendations. It doesn't really matter what you start with. Any of the big ones (for which there is plenty of learning material) will do. Essentially you want to learn to program, to think about problems in a certain way and come up with solutions for them, rather than learn the syntax of some language. That is the skill that gets you hired.
>>
>>53808083
>ios
>non-autistic
>>
>>53808083
java works great on all of them
>>
>>53808094
iPhone iPod iPad
>>
>>53808092
>>53807863
it DOES matter. at the very least it should be a statically typed language. this means NOT python. python is SHIT
>>
File: Dm5F4ko.webm (229 KB, 720x404) Image search: [Google]
Dm5F4ko.webm
229 KB, 720x404
>>53808101
>>
>>53808094
gay and autism are two different diseases

btw google captchas with disappearing pictures is the worst meme of the century
>>
>>53808075
Java is very popular for a good reason.

Even NASA uses Java
>>
>>53808112
Better than an android device.
>>
>>53808034
What? No. Not remotely.
C# with ASP.NET is one of the larger web frameworks around.
There's also GTK# which can be used to make Linux apps, and Mono which works on Android as well as Linux.
And then there's that one operating system that's being written in managed C#.
>>
>>53805279

what's better: matlab or any of the alternatives mentioned on wikipedia? (GNU Octave, Scilab, FreeMat, Julia, or Sage)


I'm going to do some tests on algorithms for controlling stepper motors
>>
>>53808031
>Frameworks/libraries
true, depending on what you want to do. I've never come across anything i wanted a Java lib for in .NET. It's math and database stuff Java has the edge on right? I do a lot of UI on desktop and mobile. .NET is hard to match for that.

>mono fucking sucks and is slow btw
True. There's also coreclr now.

>speed
depends what you're doing. CLR supports pointers, SIMD and easy native code interaction. There's a lot of ways to make up the raw performance gap.

>reliability
hmm?

Generally I find the advantages of C# far outweigh those downsides. It's nice that coreclr and mono are both MIT licenced. Xamarin is awesome. Working generics is nice. Properties. SIMD. Structs. Good native interop. ASP.NET. MonoGame. Unity. Async functions.

Just as a raw language though, it's hard to say Java is better than C#. C# is basically a clone of Java that fixed all the problems in Java and added a few other nice things.
>>
>>53808075
Then why are all the jobs and most corporations all use Java? Checkmate this Java is not good meme it seriously needs to stop
>>
>>53808090
samefag
>>
>>53808138
They don't.
>>
>>53808138
>Then why are all the jobs and most corporations all use Java?
You need to practice your english more Prajeet.
>>
>>53808127
For me personally Sage was enough (I was doing some basic shit with graphs and calculus)
But it seems that most of more math-heavy oriented people shit on all oss math software and prefer matlab
>>
>>53808107
How does static typing help you learn programming better? It doesn't. Fuck off with your autist advice.
>>
>>53808128
>depends what you're doing. CLR supports pointers, SIMD and easy native code interaction. There's a lot of ways to make up the raw performance gap.
it's still fucking slow even with these things (which require a lot more effort for no gain). use C++ if you want performance.
>>
>>53808178
easier to go from static to dynamic than vice versa
>>
>>53807683
>>53807740
>>53807851
>>53807866
Only Lisps are truly general purpose because only Lisps have macros. If your language doesn't have macros, it's not programming at all, just code monkeying.
>>
>>53808178
KILL YOURSELF FUCKING RETARDED SHITTER
>>
>>53808180
>it's still fucking slow even with these things
It's not though. Even structs alone make a huge performance difference. And they are not difficult to use by any means.

>use C++ if you want performance.
C++ is more difficult to work with and less productive compared to C#.
>>
>>53808208
>only Lisps have macros
nice bait
>>
>>53808178
it intercepts a subset of your inevitable mistakes earlier in the testing process, depending on a compiler - with a sane error message that'll help you fix them.
>>
>>53808221
yeah you're gonna do SIMD as if it's easier to work with and more productive compared to C++ and as if it even makes your C#shit as fast LMFAO KILL YOURSELF IDIOT
>>
>>53808231
>subset
shitty programmer detected
>>
>>53808128
Well maybe C# isn't unreliable but Windows Server is. Basically the entire server stack at our company crashed because of Windows update at work and the company lost some clients because of it. I guess you could say Linux is also unreliable in some other areas but meh.
>>
>>53808258
we're talking about a beginner who has never programmed before of course he's going to be a shitty programmer at least in the beginning fucking idiot
>>
>>53808156
I am a white man but my english sucks this is true you caught me
>>
>>53808238
Calm down dude, even I am a Java dev and you're acting unreasonable.
>>
>>53808262
>Basically the entire server stack at our company crashed because of Windows update at work and the company lost some clients because of it.
ahahahahahahaha Csharts BTFO
>>
>>53808262
lol, that's why people test updates before installing them on production machines
>>
>>53808307
Windows is still superior to Linux and Apple please
>>
>>53808315
it's not Windows it's GNU/Windows
>>
>>53808262
>I guess you could say Linux is also unreliable in some other areas but meh.
well yeah.. i can. Specifically in installing updates like that.
>>
Hi guys my name Pajeet and I wondering why you guys call other my name?
>>
>>53808315
not for servers
>>
>>53808386
nice try Bill
>>
>>53808357
Windows server updates automatically, no distro would do that.
>>
>>53808396
True you got me all my networking courses and Linux courses for servers we all used Linux GG no rematch Still SUPERIOR Java and Windows master race
>>
>>53808199
No evidence to support that. Many CS courses start out with languages like Python and they don't produce handicapped graduates. If there is any difference, it is insignificant.

These are the ramblings of a bunch of pedantic NEETs.
>>
>>53808386
>Pajeet
>Bill

you dun goofd
>>
>>53808418
>Many CS courses start out with languages like Python and they don't produce handicapped graduates
cedric...
>>
>>53808403
>what is wsus
>>
>>53805466
No need to thank me.
let rec calculateShit () =
printfn "How many lines of text are you going to write?"

match Console.ReadLine () |> Int32.TryParse with
| false, _ -> printfn "Input invalid. Please try again."; calculateShit ()
| true, lineCount ->
printfn "Input %d %s of text now. Strike the return key after each line." lineCount (if lineCount = 1 then "line" else "lines")

let processedInput =
[1 .. lineCount]
|> List.map (fun _ -> Console.ReadLine ())
|> String.concat " "
|> fun str -> Regex.Replace (str, """[^\w\s]""", " ")

printfn "-------------------"
printfn "Word length counts:"

processedInput.Split ([|" "|], StringSplitOptions.RemoveEmptyEntries)
|> Array.groupBy (fun w -> w.Length)
|> Array.sortBy fst
|> Array.iter (fun (len, words) -> printfn "%d %s: %d" len (if len = 1 then "letter" else "letters") words.Length)
>>
>>53808557
I think that fucks up if lineCount is 1
>>
>>53808557
>List.
>String.
>Array.
The compiler knows what type these are. Why do you have to specify it over and over again?
>>
>>53808636
based on ocaml
>>
>>53808636
You're not specifying the type, your choosing which module to use a function from. He could ask use Seq. in most of those instances, but that would do something different.
>>
>>53808624
Why would it? (No, it does not)

>>53808636
Those are modules, not types.
>>
File: 1459461823017.jpg (515 KB, 1000x1414) Image search: [Google]
1459461823017.jpg
515 KB, 1000x1414
Working on my file server with torrent support.
I'm currently fixing minor bugs and refactoring some code. Next up is adding torrent support.
>>
>>53808673
>Why would it?
I recall doing that before and it would return an empty list if you have [1 .. 1]. Maybe i'm mistaken.
>>
File: 2016-04-01_18-22-36.png (5 KB, 334x215) Image search: [Google]
2016-04-01_18-22-36.png
5 KB, 334x215
>>53808689
>>
>>53808719
I see. Not sure what happened to me before then... neat
>>
>>53805279
>no racism
nigger
>>
>>53808823
saying nigger isn't racist
>>
>>53805513
based
>>
>>53808636
MLs don't have type classes. Hopefully modular implicits will come soon to OCaml so we can leave all these out
>>
>>53808403
>Windows server updates automatically
You can pick and choose exactly which patches are applied, when they apply, and you can also test these patches on non-production systems first.

If your shit crashed due to Windows patching, the most likely culprit is the applications that the server is being used for, not the interaction with the OS itself.
>>
>>53808922
In F# at least Seq.map and List.map will do different things. So doubt F# will be dropping this stuff soon.
>>
>>53809026
The way that modular implicits work would not stop that from being a possibility, so it's possible that F# could adopt that system, but there are two things currently stopping that:
1) Some functions are overloaded in weird ways that aren't available to user-defined functions (like +, -, *, /)
2) F# doesn't have an ML module system still, and you can't do modular implicits without module types/signatures
For F#, I think Haskell-style typeclasses would actually be a more likely solution in the long-run
>>
>>53809089
A lot of the stuff F# doesn't have is done to make it work better with .NET and C# code based, and be familiar to C# programmers. I wouldn't expect them to make any breaking changes like changing the module system going forward.
>>
Polling Ruby
>>
File: 005.jpg (582 KB, 1870x1280) Image search: [Google]
005.jpg
582 KB, 1870x1280
Anons, I'm new to programming but really good at math. Basically, autism personified, on meds for ADHD, some other crap. Point being, I have 30 days to get a new job or end up in the homeless shelter.

A friend of mine recommended I hire an Indian to make some android apps for me, and sell the apps on the Android market.

Realistically speaking, could I dish out lets say 10 shitty apps like a season count down, a clock, a music player, etc. within 30 days, and learn all the basics of Java programming to do this, within 30 days as well? 30 days guys. I downloaded the gentoomen library but some of the Java books are outdated and need IDE's like galileo, there are also dependency issues with the android downloads and java SDK, basically its very hard to follow or get the older versions working like the book wants me to.

So any help? Point in the right direction? Steam friend sent me a PDF of Java A Beginners Guide, 6th edition. Just start there?
>>
>>53809146
good luck
>>
>>53805513
Holy shit Thank you so much you pretty much saved me from leaving 4chan for a few days until it died down.

>Tfw web dev fags have finally become useful
>>
>>53809146
>Just start there?
sounds as good a place as any
>>
>>53809146
>Realistically speaking, could I dish out lets say 10 shitty apps like a season count down, a clock, a music player, etc. within 30 days, and learn all the basics of Java programming to do this, within 30 days as well?
Nope.
>>
Is this a fucking google productforum
>>
>>53809214
>moot joins google
>4chan got material cancer
>>
Hey guys I am really good at programming logic but I suck at math. I understand what I need to put together but I can't figure out the math to do it.

What it do?
>>
>>53809214
There is plenty of software/hardware discussion of Google, Apple, Microsoft, and Linux, or as I've taken to calling it, Windows+Linux.

Why are you asking this in /dpt/ of all places?
>>
>>53809146
You should spend these 30 days saving/packing stuff, learning about how to apply for whatever monetary help your government provides, visiting homeless shelters to see what you're gonna be dealing with - when to get there/what to have on you - stuff like that; looking for unskilled jobs, places with the cheapest rent, roommates. Learning a skill in a very competitive market + getting a job in 30 days is impossible
>>
>>53809146
>could I dish out lets say 10 shitty apps
No. You might be able to put one app together with heavy copy paste form Stackoverflow but it's going to take you at least a couple of months to understand what you're doing at all.
>>
>>53809146
Don't use old ass books, use internet tutorials if you want to get shit done
>>
File: DS14wallpaper.jpg (138 KB, 1920x1080) Image search: [Google]
DS14wallpaper.jpg
138 KB, 1920x1080
>tfw spill coffee on my copy of the D Programming LanguageTM
>>
Does anyone have that image with the 100 programming projects that gets posted sometimes? I can't find it.
>>
>>53809312
>andnothingofvaluewaslost.wav
>>
>>53809315
just google "dpt roll"
>>
>>53809315
http://better-dpt-roll.github.io/

It shits up the thread when it gets posted.
>>
>>53809315
https://better-dpt-roll.github.io/
>>53809322
I have soiled Andrei's holy writings
I must seek forgiveness
>>
Is GTP here? Do we need a seyonce?
>>
>>53809333
>>53809341
>>53809343
Thanks anons.
>>
>>53809353
Séance

Do you need C# help or what?
Thread replies: 255
Thread images: 29

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.