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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 315
Thread images: 26

File: 1451751832808.png (17KB, 418x359px) Image search: [Google]
1451751832808.png
17KB, 418x359px
Virtual machines edition
>>
>>52422099
Can you not at least make the black transparent for your avatar, anon?
>>
>no anime
>no CoC
Shit thread
>>
>>52422099
Thank you for not using an anime image.
>>
>>52422099
Thank you for not using an anime image.
>>
>2016
>Not accessing arrays with the happy face operators

#include <stdio.h>

int main(void) {
char string[] = "I am a string";
printf("%c%c%c\n", string<:2:>, string<:2:>, string<:7:>);
return 0;
}


What, do you want your programs to be sad to look at?
>>
File: thank you based apple.jpg (54KB, 690x416px) Image search: [Google]
thank you based apple.jpg
54KB, 690x416px
>>52422160
>not using swift for maximum happiness
>>
#dpt on irc.rizon.net

JOIN NOW
>>
File: iu.png (588KB, 1280x905px) Image search: [Google]
iu.png
588KB, 1280x905px
>>52422354
Are anime posters welcome?
>>
>>52422367
no fuck off weeb
>>
>>52422397
this
>>
>>52422099
>C#
>Bitwise operators
>Bit shifting and smugglin'
>I have 12 problems to solve until tomorrow

And I know how to code, its just this bits and binaries are fucking with my mind, I get so easily confused when it comes to shifting and replacing and ect.
Any tips on how to learn them or how to avoid common mistakes ? I looked some sites with goo info, msdn too but idk.

The new boston has only 3 videos and its not much about it, and some paki guy had nice slideshow but his english was horrid, couldnt understand anything.
>>
>>52422414
what do you not understand abount bits
>>
File: 1452479864694.gif (414KB, 400x485px) Image search: [Google]
1452479864694.gif
414KB, 400x485px
>>52422397
>>52422408
ok, I won't be joining.
>>
>>52422099
dumb frogposter
>>
>>52422099
Digging into Boo, maybe it's a meme but it's like Python, I kinda love to look at that beautiful, clear code...
What do you think of Boo folks?
>>
>>52422414
read a quick intro to brainfuck
>>
File: opnot.jpg (10KB, 218x231px) Image search: [Google]
opnot.jpg
10KB, 218x231px
>>52422099
Thank you for the non-weaboulshit image.
>>
rollan
>>
>>52422414
what are you trying to do?

// test a bit
bits & (1 << bit_pos)

// set a bit
bits | (1 << bit_pos)

// clear a bit
bits & ~(1 << bit_pos)


working with ranges of bits is based on the same idea
if they aren't intuitive work them out on paper
>>
>>52422432
>>52422490

Well I get confused, really. I understand how they work and how to manipulate them but it seems I am too stupid.
>Bit Exchange (Advanced)
>Write a program thatexchanges bits{p, p+1, …, p+k-1}with bits{q, q+1, …, q+k-1}of a given 32-bit >unsigned integer. The first and the second sequence of bits may not overlap.

or..

>Check a Bit at Given Position
>Write a Boolean expression that returns if the bit at position p (counting from 0, starting from the right) in >given integer number n has value of 1. Examples:
>>
>>52422145
That's terrifying.
>>
>>52422670
You are suggesting that its easier if I get pen and paper while doing them ?
>>
>>52422414
bitwise becomes second nature really quickly anon

take your time
>>
>>52422708
just however you want to work through it step by step, if it's not intuitive
>>
What is the longest you ever dindt stop coding and programming ?
Ive been on the screen for one week now and I can feel how I get more dizzy as time passes
>>
>>52422729
a whole day maybe

not a whole week autist
>>
>>52422761
What you mean by that is merely an insult.
I have been on the screen for almost ~168 hours, however that doesn't mean I am awake for that long.

I presume that you are the actual autist in this very situation.
>>
http://pastebin.com/C5FZMbMN

Rate my shitty thread image downloading script, tell my why its shit and how to improve it.
>>
>>52423085
>http://pastebin.com/C5FZMbMN
>#!/bin/bash
dropped
>>
File: 1450463515813.png (583KB, 740x571px) Image search: [Google]
1450463515813.png
583KB, 740x571px
>decoupling as an end in itself rather than a means to an end
>>
>>52423085
>http://pastebin.com/C5FZMbMN
How can I run it, what language is that ?
I am new pelase be kind.
>>
>>52423150
It's perl
>>
Just been told I should make senior developer at work in the next 6 months.

Thing is, I know money is tight and I fully expect my pay rise next month to be shit, shit enough to justify jumping ship.

Is the senior developer position a carrot on a stick? Am i getting jewed?
>>
>>52423150
look at the shebang, it's bash.
save in file, run with 'sh blah.sh'
>>
I just got a job as a TA and worked my first shift explaining c++ recursion on linked lists to students.
Was actually super fun.
Too bad I'm a shit programmer.
This should help me though!
>>
>>52423170
It's a label that gives you more $$$. Oh, and it looks nice on your CV.
>>
>>52423189
Sounds cool, I've always wanted to run labs for IT professors and bully freshman for using Java
>>
>>52423195
Yeah but will it materialise or is it just an attempt to keep me in the company?
>>
>>52423230
Unless it's written down on paper, it's just a way to trap you. Never trust the word of a manager.
>>
>>52423230
It doesn't matter, it's on your CV, so if things take a turn for the deep end, you can get back in with good pay
>>
>>52423109
If a usable program is the end and programming is a mere means, you might as well use uncommented perl code
>>
>>52423302
Not using Perl nearly always improves code

Decoupling often improves code but often it does not
>>
>>52423189
>using O(n) recursion levels
>>
>>52423322
>Decoupling often improves code but often it does not

Which is why a focus on improving cohesion is equally important. Low coupling with high cohesion always improves code
>>
File: me right now.jpg (25KB, 576x432px) Image search: [Google]
me right now.jpg
25KB, 576x432px
>>52423334
>being a weeaboo
>>
give me something to code, /dpt/
dubs decide which language
>>
>>52423387
OS in Java
>>
>>52423387
OS in haskell
>>
>>52423387
4chan extension to detect anime images and automatically hide the post
>>
>>52423411
>>52423387
Ah shit, better start reading https://littleosbook.github.io
>>
>>52423378
The majority of us like anime here senpai, stop shitposting.
>>
>>52423387
>>52423430
OS in haskell is impossible, DO THIS ANON PLEASE
>>
>>52423411
I just said which language, not what to actually make

So Haskell it is. Luckily I was actually planning on using Haskell anyway.

Now I just need to figure out what to make...
>>
>>52423378
>>52423435

I don't like anime, the puking girl was just at the top of my images directory.
>>
>>52422099
wake me up
>>52422145
cant wake up
>>
>>52423435
>The majority of us like anime here senpai

Speak for yourself.
>>
Is there any real reason for passing parameters as const ref?
>>
Making a server. Should I use threads or select?
>>
>>52423471
Minority lover detected.
>>
>>52423334
Yeah, I think it's more of an intro to recursion since Linked Lists are the only data structures they've been exposed to.
Later the use recursion on binary trees.
>>
>>52423487
Cheaper than passing by value, with all the same protections
>>
>>52423496

Well, you got me there. Not like it was a secret.
>>
>>52423510
In most cases it will be, yes, but not necessarily. It's a sane default, though.
>>
shit, making gui programs in haskell is fucking weird
>>
>>52423585
F R P
R
P
>>
File: Pt83P86.jpg (98KB, 650x632px) Image search: [Google]
Pt83P86.jpg
98KB, 650x632px
>>52423510
>implying pass by value doesn't optimize nicely
>>
>>52422488
Meh, too little documentation...
>>
File: oS2sxeIK4Pc.jpg (58KB, 604x586px) Image search: [Google]
oS2sxeIK4Pc.jpg
58KB, 604x586px
>>52423637
>depending on unspecified compiler optimizations
>>
oh shit
https://wiki.haskell.org/Gtk2Hs/Demos/GtkGLext/hello.hs
>>
>>52423680
Gross
>>
File: 1451561072001.png (396KB, 960x576px) Image search: [Google]
1451561072001.png
396KB, 960x576px
>>52423669
>unspecified
Nah. Pass by value is codeword to the compiler to inline whenever fuck you want.
>>
>>52423680
>buttonNewWithLabel
Eww
>>
So I've been working on a basic TCP chat client/server program. I can connect to the server if I use localhost as the address, but when I try to recursively use my public IP or run the server on another IP, I can't connect. I've tried using unprivileged ports as well. (i.e. 2200)

I've written it in Java using this as a guide: http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html

My ISP may be blocking the connection, but I'm unsure how to check. Any help /g/?
>>
Gosh what a fucking shit thread, glad I dont come here anymore.

Anyone know R? What's a good book on R?
>>
I want to reverse this bit of math

int encryptedChar = c + keyInts[0] + keyInts[1] * keyInts[2] - keyInts[3] - keyInts[4];


Buit I'm not sure what the order of operations is, how would I go about it?
>>
>>52423734
kill yourself
>>
>>52423680
>not even attempting to make it functional
>>
>>52423739
https://en.wikipedia.org/wiki/Order_of_operations
>>
File: 1435987053713.jpg (850KB, 1600x1320px) Image search: [Google]
1435987053713.jpg
850KB, 1600x1320px
>capcode
>none, mod, admin, admin_highlight, developer, founder
https://github.com/4chan/4chan-API

>founder
Cool, moot has his own unique capcode. I wonder when he'll make a post with it.
>>
>>52423739
The multiplication takes precedence over everything else, and the addition and subtraction don't matter.
>>
>CHIP-8 opcodes left to implement
>CLS - clear screen
>DRW Vx, Vy, N - draw sprite pointed at by register I at position Vx, Vy with N lines drawn
>LD Vx, k - stop execution until a button is pressed, then store it into Vx

So 2 display commands, which are easily doable in the simplest of graphics libraries, and a keyboard command also easily doable. Outside of opcodes, I have to implement sound, storing whether a key is pressed or not for the other keyboard functions, as well as making it run 30/60fps. Shit's going smooth lads, also my program is coming along well too.
>>
>>52423819
You can write chip-8 emulator with graphics and key handling in a day with C.
What the fuck is are you doing that is taking so long?
>>
>>52423854
With work, gym and family, I don't have that long
>>
>>52423819
You may want to peep this thread on SA:
http://forums.somethingawful.com/showthread.php?threadid=3634812
>>
>>52423900
that's a sweet load of resources, cheers lad
>>
>>52423510
So then why isn't this the default? Why do I have to bloat ALL of my code with const & ?
>>
>>52423732
>My ISP may be blocking the connection, but I'm unsure how to check.
First check if you can use the public IP address from the same machine. If not, it's your own OS that's blocking stuff OR you've only bound the server socket to localhost (servers don't need to listen on all IP addresses that a machine has). Fix Those Things First.
>>
>>52423937
how would I go about changing the server socket's binding?
I've already disabled my OS' firewall.
>>
>>52423900
>SA
Get out.
>>
>>52423994
nice meme
>>
>>52424017
It's not a meme, anon.

SA is on par with Tumblr.
>>
>>52423411
haskell.os()


done
>>
>>52424061
(You)
>>
I finally got sbcl to work on my android phone after installing debian.

Theres no reason to write java apps anymore
>>
>making web application
>need to generate HTML+javascript
>tfw can't do it in a way that doesn't feel dirty
>>
>>52424125
can you make native gui on android with sbcl, pretty sure you can't.
If you want to develop android apps with common lisp your best bet is mocl, lispworks or ecl(maxima android is compiled with ecl).
>>
>>52424164
you need to *generate* JavaScript?
>>
>>52424125
>sbcl
>not Cppdroid
>>
>>52424164
Just remember the alternative is worse.
>>
File: 1452301394769.png (105KB, 500x701px) Image search: [Google]
1452301394769.png
105KB, 500x701px
>>52423734
>R
Run away from that shit anon. Easily the most shitty language in existence.

Use python with pandas.
>>
>>52424181
Kind of.

I have some simple stand-alone functions that are written in pure JS, but the HTML that I'm generating needs to call those functions in various places (onclick, document onload, etc).

It's incredibly easy to do but I don't like how it's just shoving a bunch of strings together with no guarantee that it's actually valid JS until runtime.
>>
Hey all, newfriend with a stupid question.
I'm working on a simple encryption/decryption program in C++.
The program works by going through a user-inputted string and shifting each character with a pseudorandom number.
I'm having a problem with implementing spaces. Any space input will cause the program to stop going through the string and spit out only what it has so far.

for(int x = 0; x < input_str.size(); x++){
output_str += encrypt(input_str[x]);
}

char encrypt(char input_char){
char output_char;
output_char = (input_char - 65 + rand())%26 + 65;
return output_char;
}


Example in: ABCD EFGH
Example out: WXYZ

Is it seeing the next word as another argument or something? That's the only thing I can think of.

I already tried putting an if (and accompanying else) statement in the original for block, to output a space if an input space was found, but it didn't change anything.

Thanks, and sorry if you guys hate this type of question I don't usually hang out in /dpt/
>>
>>52424230
>language is shit
>recommends even shittier language
>>
>>52423935
Because it is based on C which didn't have refs
>>
>>52424183
You are disgusting

>>52424176
if the headers and libraries are there then its possible via cffi. Its juat a matter of me reading up on it and writing the interface.

Until then i can still make graphical applications through X in my debian install.
>>
>>52424246
>but the HTML that I'm generating needs to call those functions in various places (onclick, document onload, etc).
So why do you need to generate the JS? Just reference the js files in the header.
>>
>>52424295
I need to actually call the JS functions.

Having an import cause side effects is fucking cancer.
>>
File: 0006_1306344155824.jpg (39KB, 500x357px) Image search: [Google]
0006_1306344155824.jpg
39KB, 500x357px
>>52424262
>python
>shit
>>
>>52424401
how is it not shit except that you're suffering from baby duck syndrome?
>>
>>52424401
>o,[;uomh

look at your keyboard if you don't get it faggot
>>
>>52424481
Wow, so clever
>>
>>52424230
What's wrong with R?
I thought it was good for statistical analysis.
>>
>>52424527
That's about all it's good for, and I'm pretty sure Matlab does it better.
>>
Goddamn awful method for encrypting stuff (as far as I know)

But it's pretty neat nonetheless.

        private static string DecryptMessage(string key, string encryptedmessage)
{
List<int> keyInts = new List<int>();
foreach (char k in key)
{
keyInts.Add(k);
}
Random rand = new Random(keyInts[0] + keyInts[1] + keyInts[2] - keyInts[3] * keyInts[4]);

StringBuilder sb = new StringBuilder();
char[] delimiterChars = { '_' };
List<int> messageCharValues = new List<int>();
foreach(var messageChars in encryptedmessage.Split(delimiterChars))
{
messageCharValues.Add(Int32.Parse(messageChars));
}

foreach(var c in messageCharValues)
{
int decryptedChar = c / rand.Next(1, 9999);
sb.Append((char)decryptedChar);
}
return sb.ToString();
}

private static string EncryptMessage(string key, string message)
{
List<int> keyInts = new List<int>();
foreach(char k in key)
{
keyInts.Add(k);
}

Random rand = new Random(keyInts[0] + keyInts[1] + keyInts[2] - keyInts[3] * keyInts[4]);

StringBuilder sb = new StringBuilder();
int messageLength=0;
foreach (char c in message)
{
messageLength++;
int encryptedChar = c * rand.Next(1, 9999);
if (messageLength == message.Length)
{
sb.Append(encryptedChar);
}
else
{
sb.Append(encryptedChar + "_");
}
}
return sb.ToString();
}
>>
>>52424342
>I need to actually call the JS functions.
yeah?
>Having an import cause side effects is fucking cancer.
?? huh?
>>
>>52424592
no. that's what source control is for.
>>
>>52424527
I love using R for statistics.

>>52424543
What does better mean?
>>
>you know what to do
http://codeshare.io/4chan
>>
>>52424251
Could it perhaps be changing the spaces to a nul terminator, ending the string?

Also, don't use rand() in C++, use the
<random>
library.
>>
>>52424673
As far as I know, no.
>>
>>52424543
Isn't that pretty much the only thing it was meant to be? I mean, it's project description is literally "The R Project for Statistical Computing". Seems like it does what it's supposed to do.
Also, Matlab is nice and all, but it's more suitable to matrix calculations than actual statistic analysis when you want the results fast.
Different tools for different jobs.
>>
>>52424673
Nope. Learn to use GIT. VS has built it support for git out of the box.
>>
>>52424701
>Could it perhaps be changing the spaces to a nul terminator, ending the string?
Yeah I think it's something like that
I searched a bit and I found something that says to use character arrays instead of a string?

char input[100];
cin.getline(input,sizeof(input));

rather than

cin >> input

>Also, don't use rand() in C++
Alright, thanks
>>
>>52424846
So, just make sure that the characters don't become 0.
>>
Is there any reason to not use only 64-bit signed integers and doubles in your code in 2016?
Unless, of course, you aren't dealing with a PC...
>>
>>52424963
They slower to compute and a lot of the time, the extra precision is not needed.
>>
>>52425004
Are you saying that 32 bit integers in a 64 bit computer are faster to process than 64 bit integers?
>>
>>52424963
>>52425043
If you care about number crunching performance at all, you'll be using SSE, and it's twice as fast to deal with numbers half the size.
>>
>>52424688
dank
>>
File: pp.png (13KB, 493x281px) Image search: [Google]
pp.png
13KB, 493x281px
Any ideas why this gives me a load of errors?

http://pastebin.com/vyGAK9BD

Pastebin because 4chan thinks my post is spam
>>
Hey /dpt/, have you given up on Rust yet?
>>
I'm >>52423085, I somehow improved my ugly script, it no longer requires tidyhtml or curl. Can be reduced into a one-liner, takes a link and downloads all images to current directory.

#!/bin/bash
wget $1 -O - | \
grep -o '<a class="fileThumb" href="[^"]*"' | \
sed 's/<a class="fileThumb" href="/https:/' | \
sed 's/.$//' | \
xargs wget


Can this me improved?
>>
>>52425143
O C A M L
C
A
M
L
>>
>>52425076
What version of SSE is it that all 64-bit comps have. Is it SSE2?
>>
>>52425143
yes
>>
rollan for future reference
>>
>>52423100
Why is this bad?
>>
>>52425177
What made you Give Up On Rust?
>>
>>52425167
Does it have multicore support yet?
>>
>>52425211
>Give Up On Rust

Sounds like a book title
>>
>>52425130
Nevermind.

I forgot:

if(catalog.status === 400) {
let json = JSON.parse(catalog.responseText);
}
>>
>>52425211
Rust is old and rusted :^)
>>
>>52425232
Yes.
>>
>>52422099
Are there any good and thorough tutorial/guide about machine learning with python?
>>
>>52425350
O C A M L
C
A
M
L
>>
>>52425211
Seeing it's made by Mozilla
>>
File: FluffyUnitedAlaskanhusky.webm (144KB, 320x238px) Image search: [Google]
FluffyUnitedAlaskanhusky.webm
144KB, 320x238px
>>
>>52425211
SJW community
mozilla
CoC
::
>>
>>52425211
Just like go, it's a one-trick pony that does everything else wrong. Thankfully, rust does things less wrong than go most of the time. It's still shit.
>>
>>52425487
>symmetric encryption for messaging
pretty useless desu
>>
>>52425612
I'm a beginner, I just slapped it together over an hour.

Decided to post it to make a change from the usual complete lack of programming related posts.
>>
>>52425699
fair enough
post code
>>
I'm trying calculate the nth digit of Pi, at this point I don't even care how I get the number, because I don't know what the fuck I'm doing.
What is wrong with my implementation of BBP? It gives numbers in the billions.

double pi(unsigned n)
{
unsigned i;
double pi = 0;
for (i = 0; i <= n; i++)
{
pi += ((4 / (8*n)+1) - (2 / (8*n)+4) - (1 / (8*n)+5) - (1 / (8*n)+6) * pow((1 / 10), n));
}
return pi;
}
>>
I'm making this applications that has desktop, server and mobile parts. I just started mobile part and I'm fucking clueless. So there is my question:
How does android handles event functions. There are listeners and other shit that gets called when something happens. Does android create new thread for each of this calls or does it wait in a queue?
>>
>>52425718
Can you not use the same names for functions and variables?
>>
>>52425716
Already did
>>52424566

It's pretty shit, but it works.
>>
test
>>
>>52425825
4chan.org/banned
>>
>>52425828
I wasn't testing if I was banned, retard.
>>
>>52425848
4chan.org/banned
>>
File: teaching the retarded.jpg (61KB, 416x620px) Image search: [Google]
teaching the retarded.jpg
61KB, 416x620px
>>52425848
yeah you were, retard
>>
>>52425848
4chan.org/banned
>>
>>52425273
why is it called rust anyway
>>
>>52425909
It was their favourite MW2 map.
>>
>>52425909

Think bare metal, but crippled.
>>
>>52425076
> it's twice as fast to deal with numbers half the size.
It can perform a given operation (add, multiply, etc) on a pair of "float"s in the same time as on a single "double".

Whether that actually means anything depends upon whether the calculation can be arranged to make use of this.

If you're doing whole-array operations (as is common with APL and NumPy), then SSE is typically going to be nearly twice as fast for floats as for doubles.

If it can't find ways to pair up variables, then it isn't going to make any difference.
>>
>>52425076
If you care about number crunching performance at all, you'll be using CUDA, and it's fiftytimes as fast to deal with numbers the same size.
>>
>>52425990
kek

>>52425909
stackoverflow has a few plausible explanations

http://stackoverflow.com/questions/16494822/why-is-it-called-rust
>>
how does this make you feel, /g/?
const char pi[] = "314159265358979323846...
>>
>>52426288
Gives me a nice warm boner
>>
How okay is programming C in Windows with Visual Studio? Last time I tried with mingw / Code Blocks it was very painful.
>>
in java, how do i make an empty string and then add other strings into it one by one? i've only ever programmed in C++.

the program is supposed to take a date in american form and print it in european form. my current psuedocode looks like this
String inputDate = keyboard.nextLine();
String month, day, year;
for(int x = 0; inputDate[x].isDigit(); x++)
{
month[x] = inputDate[x];
}
for(int y = 0; inputDate[x+y].isDigit(); y++)
{
month[y] = inputDate[x+y];
}
for(int z = 0; inputDate[x+y+z].isDigit(); z++)
{
year[z] = inputDate[x+y+z];
}
System.out.println("The date in European form is " +
day + "." + month + "." + year + ".");


i don't know to make it work in java though
>>
>>52426320
easily. What language pleb?
>>
>>52425990
Hi Ruby!

It's me again. Okay imma take a nap now.
>>
>>52425125

http://codeshare.io/4chan
>>
>>52426288
#define PI 3.14
>>
is mingw abandonware?

>http://www.mingw.org/wiki/GCCStatus
>GCC 4.4
>Recent comments
>4 years 51 weeks ago

i know mingw is actually on 4.9.3 on something like that but is there a way to update to GCC 5.2 or 5.3?
>>
>>52426373
what if it's the solution to this?
https://www.codeeval.com/open_challenges/228/
>>
Rate my function for generating pythagorean triplets.
def generatePythagoreanTriplets():
n = 1
m = 1
while True:
m = m + 1
if gcd(m, n) == 1:
a = m*m - n*n
b = 2*m*n
if a > b:
n += 1
m = n
else:
c = m*m + n*n
if (m - n) % 2 == 0:
a //= 2
b //= 2
c //= 2
yield (a, b, c)
>>
File: 1448971357405.jpg (85KB, 796x863px) Image search: [Google]
1448971357405.jpg
85KB, 796x863px
Why should I learn haskell?
What are the chances id ever use it?
>>
>>52426428
lol silly dog
>>
>>52426336
int hashLine = 20;
for(int i=0; i<hashLine; ++i){
cout << "#";
}
cout << endl;

// length of "#Error: " is 8
cout << "#Error: " << errorShit;

int spaces = hashLine - 8 - errorShit.length();
for(int i=0; i<spaces; ++i{
cout << " ";
}
cout << "#" << endl;

for(int i=0; i<hashLine; ++i){
cout << "#";
}
cout << endl;
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay


Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
>>52426389
Aside from compiling it yourself? Probably not yet. I'll bet their budget is really in the shitter.

>>52426428
Fun things are fun, anon.
>>
>>52426389
4.8.1 actually ;_;
>>
>>52426428
It'll be eye-opening for sure, even if you don't use Haskell itself in the end.
>>
>>52426428
Teaches you functional programming paradigms? A lot of languages are starting to use more functional paradigms. It's best you learned them.
>>
is calling gameHelper.onStart(this) necessary to implement the GameHelper class
>>
>>52426421
// 4chan.c
#include <dank/memes.h>
#include <reddit.h>
#define nigger "#000"
int checkem( int color ) { if( color != #FFF ) { activate.shed(); return privledge; } }
int main( int argc,char *argv[] ) {
if( !gentoo && checkem() ) { install_gentoo( "c:\\" ); return Error; }
return nigger;
}
>>
>>52426389
Don't know about you, but I'm running MSYS2 and the mingw64 gcc package is 5.3.
>>
>>52426452
>Aside from compiling it yourself? Probably not yet.
I came here for the first time in months and someone posts exactly the question I wanted to know before I even ask it.

This is why I love this shithole.
>>
>>52426556
>This is why I love this shithole.
do you suck dicks?
>>
>>52426389
Use MinGW-w64.
>>
>>52426421
That is probably the most poorly worded question I've ever seen.
>>
>>52426585
>>52426389
I would suggest MSYS2 just so you get pacman to keep shit up to date, as well as bash and git.
>>
>>52425147
You know, you could do this all with one call to wget.

Look p the arguments -nd and -A
>>
>>52426596
>>52426421
heh
    unsigned n;
while (fscanf(file, "%u", &n))
{
printf("%c\n", pi[n-1]);
if (feof(file))
break;
}
>>
does writing something in RPL feel much different than something in LISP?
>>
>>52423100
It's not strictly bad, I'm guessing that particular person just doesn't like bash scripts.

Also, #!/usr/bin/env bash will find bash if it's in a nonstandard location, but that's really more useful for python scripts or whatever.

Also, quote your strings please.

Also, this can all be done in one call to wget, but I like your thinking.
>>
>>52426683
Yes.
>>
>>52426545
>>52426585
>>52426638
apparently the android ndk uses some sort of android GCC compiler and it's the only compatible toolchain according to eclipse so i guess i'm stuck with that for my purposes
>>
i've spent about an hour coding in java coming from C++ and i've come to the opinion that java does everything it possibly can to make its user not understand absolutely anything about even the most basic underlying workings of a computer, even if it results in having to memorize a million different method names
>>
Java (JUST) assignment is asking for private fields with trivial get/set methods.

Should I just use public variables and explain the reasoning with a comment?
>>
>>52426783
You're writing code for a virtual machine, what do you expect?

Java is about as alienated from the machine you're running on as you can get without resorting to cushy sandboxed javascript garbage.
>>
>>52426801
no just follow the instructions of the assignment, don't get into an argument with the teacher
>>
>>52426801
No, they'll bitch and take points off. CS professors are like that, OOP cock suckers.
>>
>>52426783
i'm sure you'll love python then
>>
File: 1452408070475.jpg (418KB, 768x768px) Image search: [Google]
1452408070475.jpg
418KB, 768x768px
>>52426815
>>52426820
>>
>>52426801
Since the assignment is almost certainly to test that you know how to write getters and setters, and not because the professor actually needs that work done for something.. I suggest that you just write the getters and setters.
>>
>>52426820
it's not even proper OOP to have trivial getters and setters that break encapsulation and make the user of the object manage the logic of the member variables
>>
>>52426850
He does say that he gives marks for "going above and beyond what is expected". I'm just not sure if he'll accept that that's a good thing or not.
>>
>>52426857
Tell that to my profs.
>>
>>52426857
Not having getters or setters, trivial or not, is the definition of breaking encapsulation. Spout more buzzwords though, I'm sure people will think you're somehow right if you do.
>>
>>52426850
>>52426865
Also, this is an upper-year course, the assignment is more to make sure that we actually know Java from our previous courses.
>>
>>52426873
if you just have trivial getters and setters so that you have the equivalent of a public variable then you're breaking encapsulation. getters and setters should get and set values according to the interface, not the implementation.
>>
File: received_460524517459322.jpg (40KB, 910x651px) Image search: [Google]
received_460524517459322.jpg
40KB, 910x651px
>>52422367
Anime girls is what's wrong with 4chan. They always find a way to infect every board.

Bugger off you weeb.
>>
>>52426893
>I have no idea what encapsulation is and nobody can stop me!
>maintainability is for faggots!
>who cares about breaking the API with every release???
computer_science_graduate.jpg
>>
>>52426865
What's expected is proof you can write a getter and setter.

Making a public field is something different. Maybe write another property with just a public field and explain the differences for why you might use one over the other.
>>
>>52426472
can i get a job with haskell?
i know icant
>>
>>52426865
maybe write the getters and setters but include a comment about how you would improve the implementation, like if you think a public variable would be better or if it used a higher level of abstraction
>>
>>52426927
No probably not. But the next big meme is functional.
>>
>>52426910
>the moment I come up with an API, it has to be set in stone for the rest of the lifetime of the universe
>>
>>52426910
what are you on about nigger? the API should be designed the way i suggest so that it DOESN'T break when the implementation changes.
>>
>>52426958
>>52426958
Whatever you say, rajesh and pajeet.
>>
it's telling me "cannot find symbol" inside of the charAt(...)'s. this is my code

import java.io.*;
import java.util.Scanner;

public class USToEUDate
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter a date in the form of month/day/year.");
String inputDate = keyboard.nextLine();
String month, day, year;
for(int x = 0; Character.isDigit(inputDate.charAt(x)); x++)
{
month = month + inputDate.charAt(x);
}
for(int y = 0; Character.isDigit(inputDate.charAt(x+y)); y++)
{
day = day + inputDate.charAt(x+y);
}
for(int z = 0; Character.isDigit(inputDate.charAt(x+y+z)); z++)
{
year = year + inputDate.charAt(x+y+z);
}
System.out.println("The date in European form is " + day + "." + month + "." + year + ".");
}
}


i've never coded in java before. anyone can tell me what i'm doing wrong?
>>
>>52426952
The interface should not change when you update the implementation. That's the purpose behind data hiding.
>>
>>52427006
That's only one (ostensibly secondary) purpose, and it doesn't always apply because you're allowed to update the API with a major release (or when the API is accepted to be unstable in general, like before a 1.0 version).

Stop this cargo cult nonsense.
>>
File: 1440554302984-P-2977649.jpg (138KB, 700x700px) Image search: [Google]
1440554302984-P-2977649.jpg
138KB, 700x700px
>vm
>linux
>Ubuntu Server 14.04
>750 meg of ram
>ms azure
>has ssh
>ssg in from smartphone
>make font as small as screen res goes
>pic related
>tmux attach
>>
>>52427006
I can't tell who's in favour of what in these posts. Which of you is in favour of getters/setters?

Getters and setters are important to abstracting certain data types, as the logic required to set or get a field may change as the codebase evolves.

At least that's the theory. I think this is generally a pretty trashy aspect of Java in practice.
>>
>>52426927
>>52426947
Haskell is the new poo in loo language. Haskell Curry jokes coming soon.
>>
>>52427060
there's nothing wrong with OOP
it's java faggots who are taught to use it for EVERYTHING that ruin OOP for everyone else
>>
>>52427033
LOL what is that thing
>>
>>52427107
Agreed. People should really not be taught Java in college. Hey should have to start with C# and learn Java afterwards. Then they'll understand what's wrong with it.
>>
>>52427060
it's only trashy when implemented poorly as in the case of trivial getters and setters. most of the time the user shouldn't have to calculate some highly specific values and plug them into a bunch of setters, they should just plug a suitable value into a "non-trivial" setter that sorts out the internal logic of the implementation
>>
>>52427129
a waste of money
>>
>>52427150
C#'s approach to java is 1:1 as cancerous as java's.
>>
>>52427150
epin meme
>>
>>52427169
to OOP
>>
>>52427129
looks possibly like a screen magnifying lens
mite b cool

>>52427150
>not starting with an assembly language
>>
>>52427170
C# isn't nearly as OO as Java. And they way it implements it is far more sane. I'm not saying it's perfect, but it's better.
>>
>>52427190
There is no concept of standalone functions in C#. Everything is an object. That's literally as OOP as you can get.
>>
>>52427264
>There is no concept of standalone functions in C#
How is there not? C# has higher order functions.
>>
>>52427264
What are standalone functions?
>>
>>52427300
Closures are equivalent to objects :^)
>>
>>52427317
yeah?
>>
>tfw writing lazy, inefficient code
>>
>>52427359
I don't like C# and Simula-style OOP as much as the next guy, but any language with objects technically has first-class functions.
>>
does java substring method begin indexing at 0 or 1?
>>
>>52427060
Nobody is in favor of trivial getters and setters.
Even the Java API's Point2D object has an x and y integer that can be accessed directly and without being cockblocked by a getter and setter.
>>
>>52427389
0. All string indexing starts at 0 in Java.
>>
>>52427378
>but any language with objects technically has first-class functions.
I don't think you can call implementing the Runnable class and overriding onRun() using a first class function.
>>
>>52427425
It's equivalent in raw expressive power.

I don't even know why I'm defending it, I guess I just like playing devil's advocate sometimes.
>>
are you a fat client or a thin client?
>>
>>52427457
im a human bean
>>
>>52427448
It's nowhere near the same thing. There is no context chain and the performance is horrible so that heavy use of not-first-class functions is virtually impossible; which is a clear mark that they're not first-class.
>>
>>52427486
Again, they are equivalent in the programs they can be used to express.

Practically, that's a whole different story, and I agree with you.
>>
>>52427448
>It's equivalent in raw expressive power.
Sure, but still don't think you can call it the same thing. Saying Java 7 supports higher order functions would be false.
>>
>>52427410
>abstract double getY()
>abstract double getX()
>no getter or setter
>public x and y
>mfw even javatards can't into java
>>
>>52427472
public class HumanBean {
private boolean hero;

HumanBean() {
this.hero = true
}

public isHero() {
return this.hero
}
}
>>
>>52427507
by that logic, p = np because given infinite time you can solve either.
>>
>>52427537
No, that's by your logic and retarded interpretation of expressivity.
>>
>>52427537
>because given infinite time you can solve either.
But that's not true though.
>>
>>52427521
import HumanBean;

public class Faggot {

private HumanBean fag = null;

public Faggot() {
this.fag = new HumanBean();
this.fag.getRekt();
}

public void getRekt() {
System.out.println("AAAAAHH!!");
this.fag = null;
}
}
>>
Java a shit anyway
>>
>>52427644
*this.getRekt();
>>
File: don-draper.jpg (26KB, 291x284px) Image search: [Google]
don-draper.jpg
26KB, 291x284px
>>52427654
Cheers to that
>>
>>52427520
>hurrdurrhurr
http://docs.oracle.com/javase/7/docs/api/java/awt/geom/Point2D.Double.html#x
>>
>>52427654
Java is love
Java even runs in my toaster
>>
>>52427644
This is awful. You make a Faggot class, but it doesn't inherit from HumanBean. Then you make a fag variable, of type HumanBeing, instead of faggot. And you have that variable inside a class called Faggot anyways. Then you set fag to null for no reason.

10/10. 100% Triggered
>>
>string literals in C have array indexes

it's almost like C was designed for obfuscation, it just lets you get away with so many things
>>
>>52427764
It wouldn't be good for low-level shit if it didn't
>>
>>52427764
And what is a string?
>>
>>52427800
NULL-TERMINATED BYTE ARRAYS
>>
>>52427764
Wait, LITERALS have array indices?
>>
File: eyes.jpg (74KB, 400x387px) Image search: [Google]
eyes.jpg
74KB, 400x387px
>tfw writing programs to make my life easier at work


It's a good feel bros
>>
>>52427818
POST
CODE
>>
>>52427472
nice
>>
>>52427818
Good to see happy pepe again.
>>
can we have a comfy codeshare again?
I want to see some nim or something
>>
>>52427850
>using nim instead of python

Kill yourself
>>
>>52427835

The one I wrote recently looks at multiple spreadsheets located across our companies fily system and finds log entries that were submitted to us but not resubmitted to the client. It then takes those entries and dumps it into a log file specifying the entry name and submittal date.

It's pretty specific to my spreadsheets though so I'm not sure how useful it will be to you senpai
>>
Yo anons, check my new operating system:

int main(){
while(true){
exec();
waitpid();
fork();
}
return 0;
}
>>
>>52427850
I made one anyway
https://codeshare.io/xfBzA

>>52427859
yeah but I've never really looked into nim desu
>>
File: java success.png (9KB, 723x137px) Image search: [Google]
java success.png
9KB, 723x137px
successfully coding java on notepad and command prompt. are you mad, white boy?
>>
>>52427556
It is.
>>
>>52427872
It's almost like you hate productivity.
>>
>>52427687
>backpedaling
>>
>>52427874
>p = np
It's not. If something can't be solved in a finite amount of time, it can't be solved in an infinite amount of time.
>>
>>52427872
I'm more befuddled than anything
>>
>>52427872
>not coding exclusively using echo and sed
>>
>>52427886
IDE's actually make you less productive since they turn you into a faggot and you spend all day sucking off black men instead of programming
>>
>>52427872
That is absolutely terrible. Even for a beginner. I would be too embarrassed to post that at any experience level.
>>
>>52427924
IDEs are ideally for people who already know how to program and want convenient features.
Nobody should start with an IDE.

Also, good luck working with more than 3 source files at once with notepad.
>>
>>52427941
I already know how to program but i dont like IDE because when you are writing it alerts you "hey idiot there is something wrong in your code" and it's so annoying
>>
>>52427937
do you take your prestige on a programming thread on the technology board of a japanese-owned anime discussion forum that seriously?
>>
>>52427990
then you don't want an IDE
you want a riced out text editor with tons of plugins
consider vim and the top 10 plugins on vimawesome.com
>>
>>52427990
That doesn't mean you have to use fucking notepad.
>>
>>52428023
what if I use nano?
it's kinda like linux's notepad
>>
who can teach me how to use emacs, i need a quick guide
>>
>>52427990
This only a problem if you are an idiot though. If you don't make mistakes in your code, you don't see errors.
>>
File: stallman.jpg (36KB, 700x394px) Image search: [Google]
stallman.jpg
36KB, 700x394px
>>52428036
>quick
ahahahah
HAHAHAHAA
AHAHAHHAHAHAHAHA
>>
>>52428036
just follow the 4 tenants of emacs
D. O. N. T.

Don't.
>>
>>52428040
But when you are wrinting, for example if(somecondition...
the shits says error in line....
>>
>>52428036
Download and read the tutorial
>>52428056
Dumbass
>>
>>52428063
only if you type slow as shit
>>
>>52427908
>I'm retarded look at me!
>>
>>52428035
That's better.

>>52428036
C-h t for the tutorial.
>>
>>52428105
Just saying what's obvious anon.
>>
>>52428126
At least you know where you stand.
>>
>>52428146
This MUST be the work of an enemy Stand !!
>>
>>52428146
Yes, saying obviously correct things.
>>
>>52424481
i dont get it
>>
>>52424401
Python is what people point to when someone asks "what does a popular language that's absolute dogshit look like?"
Thread posts: 315
Thread images: 26


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.