[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: 331
Thread images: 37

File: 22645707.jpg (2MB, 1998x2048px) Image search: [Google]
22645707.jpg
2MB, 1998x2048px
Previous thread: >>52875250

What are you working on, /g/?
>>
FizzBuzz!!

#include <stdio.h>

int main(void)
{
for (unsigned long long i = 0; i < 4294967295; i++)
{
if (i % 3 == 0 && i % 5 == 0)
printf("FizzBuzz\n");
else if (i % 3 == 0)
printf("Fizz\n");
else if (i % 5 == 0)
printf("Buzz\n");
else
printf("Hitler didn't do anything wrong\n");
}
}
>>
What are my nimfriends working on?
>>
>>52881397
static void Main(string[] args)
{
for(int i = 0; i<=9999; i++)
{
if(i % 3 == 0 && i % 5 == 0) Console.Write("FizzBuzz");
else if(i % 3 == 0) Console.Write("Fizz");
else if(i % 5 == 0) Console.Write("Buzz");
else Console.Write(i);
Console.Write(", ");
}
Console.ReadKey();
}


Basically identical, here's one in LINQ for some flavour

static void Main(string[] args)
{
Enumerable.Range(1, 100).Select(
n =>
(n % 15 == 0) ? "FizzBuzz" :
(n % 3 == 0) ? "Fizz" :
(n % 5 == 0) ? "Buzz" :
n.ToString())
.ToList()
.ForEach(Console.WriteLine);
Console.ReadKey();
}
>>
do people who actually like lisp exist
i cant make changes to the functions i write because of all the parentheses and emacs' autoident
>>
>>52882029
of course there is you tard
>>
If I've I created a variable in the .bss section how do I null it?
>>
How do I go about getting my gitlab/github profile critiqued? currently getting into programming
>>
File: quite a ruff victory.jpg (46KB, 653x510px) Image search: [Google]
quite a ruff victory.jpg
46KB, 653x510px
>>52882704
Post it?
Or mention something about womyn in one of your projects, it'll get tons of attention.
>>
>>52882704
critiqued in what way? there are pretty clear heuristics that you can use to assess how your profile looks to others:
- do you have activity?
- do you have interesting projects?

stuff like that.

it's not quite like a resume/CV where you can make a lot of design choices.
>>
>>52882704
post it so we can tell you how shitty you are
>>
>>52882721
>>52882735
https://gitlab.com/u/ZippyWeb
>>52882727
thanks
>>
>>52882750
there's nothing to critique there
>>
>>52882843
meaning my codes good or I don't have enough projects to critique?
>>
>>52882750
This tells me you have a gitlab account because you heard it's cool. Like having a résumé that's a quarter of a page long because you've heard that you need one but you honest to god have no need for one.
>>
>>52882855
the latter
>>
>>52882858
I only just switched from github, but to be fair my github only had as few contributions
thanks for the feedback anon
>>
>>52882750
>all your programs are shell scripts
lel'd
>>
>>52882876
yeah but you don't really need me to tell you that caveating your profile with that is a sign of immense weakness, right?

You should be able to "red team" yourself at this level. Pretend you're a stranger coming to this profile and think about reasons that you would criticize this profile. You see like 2 days of *any* activity, and the first thought, reasonably, is that this is a nominal gitlab page. Even a generous viewer will see this and assume that your activity is somewhere else, but they can't reasonably assume how much or of what quality.

You shouldn't bother to publicize your github/gitlab page until there's something worth showing. Even if you don't have much activity, but you have a few projects that are sort of interesting and worth checking out, that would be enough.

But there's none of that here.
>>
File: c71.jpg (20KB, 334x393px) Image search: [Google]
c71.jpg
20KB, 334x393px
>>52882750
>Bunch of shit shell scripts
>>
>>52883070
Let's see yours.
>>
>>52883076
Sure.
https://github.com/sirdoombox

Enjoy
>>
>>52883050
I've privated all my repos for now, thanks for all the advice anon
>>52883070
:(
>>
>>52883088
>https://github.com/sirdoombox
Oh, hey. It's OntFgt.
>>
>>52883124
Nope.
I'm not a disgusting Canadian.
>>
>>52883169
No, idiot.. I'M OntFgt.
>>
>>52883183
Oh, hey OntFgt, you disgusting Canadian.
>>
>>52883200
'sup famjam.
>>
>>52882078
install npm
>>
>>52883215
Not much, procrastinating on my project and generally being a human vacuum for creativity, productivity and sanity.

What are you workin' on?
>>
Threadly reminder that for is a distinct construct with its own semantics, very different than while's.
This:
#include <iostream>
using std::cout;

int main() {
int i = 0;
while(i < 5) {
cout << i+1 << "\n";
continue;
i++;
}
cout << "done\n";
}

loops forever while this:
#include <iostream>
using std::cout;

int main() {
for(int i = 0; i < 5; i++) {
cout << i+1 << "\n";
continue;
cout << "never reached\n";
}
cout << "done\n";
}

is fine.
>>
>>52883232
I'm working on being sober for a week. It's pretty shit. Not working on anything programming related though, at work right now.
>>
>>52883243
Idiot.
>>
>>52883244
>Being sober
That's not very developer of you, hand in your developer card.

If you can't successfully maintain a crippling substance addiction, then you forfeit your right to call yourself a programmer, step it up.

All joking aside, good for you lad. Any plans for your next project?
>>
>>52883244
that's sad you made me sad and it's only 7am here. fuck you.
>>
>>52883260
A program that will fight opiate with alcohol constipation.
I don't know. I want to try to transition over to C++ kinda so I've been poking around here and there, but I can hardly sleep let alone focus on programming.

>>52883264
Why would that make you said?
>>
>>52883291
C++ is so confusing that it drove you to drinking?
>>
File: 1336768215191.png (76KB, 441x411px) Image search: [Google]
1336768215191.png
76KB, 441x411px
>>52883291
>Transition to C++
From one pointless addiction to another.
>>
i rate your github/bitbucket/anything on 10
>>
>>52883314
No, starting at a young age and women drove me to alcoholism. I've barely touched any C++, just been going over what's new to me.

>>52883319
Thanks for your input.
>>
File: 1319396458001.jpg (12KB, 177x278px) Image search: [Google]
1319396458001.jpg
12KB, 177x278px
>>52883325
>>
File: jcracket.png (514KB, 1680x1050px) Image search: [Google]
jcracket.png
514KB, 1680x1050px
>>52883291
>hasn't ditch c++ for racket
>still consider himself a programmer.

2016, Year of Racket.
>>
>>52883344
>can't read
>because my sentence had no brackets
How can I ditch something I haven't started?
>>
>>52883344

Carmack is such a fucking wiener.
>>
File: doyouevenlambda.png (29KB, 811x805px) Image search: [Google]
doyouevenlambda.png
29KB, 811x805px
>>52883344
imagine if occulus win the VR war over HTC, Sony, Microsoft, ... Hordes of lispers will come from everywhere to told /g/ that it's because of Lisp.
>>
File: 1454859392739.jpg (47KB, 460x464px) Image search: [Google]
1454859392739.jpg
47KB, 460x464px
>>52883344
>>
>>52883549
>Oculus
>Win

FIVE HUNDRED AND NINETY-NINE, NINETY-NINE.
>>
How do I find a project to do?
>>
int search (int array[10], int elem, int size) {
int i;
int pos;
for (i = 0; i < size; i++) {
if (array[i] == elem) {
pos = i;
return(pos);
}
}
return(-1);
}



hey guys, my search function returns -1 if there is no occurrence, and it returns the index if it is present. But how do I make it return all the indexes if there is more than one occurence?
>>
File: 1.jpg (752KB, 1920x1080px) Image search: [Google]
1.jpg
752KB, 1920x1080px
>>52883583
>>
File: FjhA208.png (302KB, 1920x1080px) Image search: [Google]
FjhA208.png
302KB, 1920x1080px
>>52883583
>>
>>52883610
Thanks

Needed the updated version of this.
>>52883594
>>
>>52883549
>to told /g/
Whatever you say, Pajeet.
>>
>>52883572
Don't forget
>Windows only
>>
>>52883594
>>52883610
thanks guys
>>
>>52883650
Once you price 99% of your market out it may as well run on an obscure linux distro that only runs on a certain brand of smart toaster.
>>
>>52883549
but racket is only used as a scripting language for simple VR stuff.
>>
>>52883610
meh
>>
File: 1435018143235.png (37KB, 638x399px) Image search: [Google]
1435018143235.png
37KB, 638x399px
>>52883718
>>
>>52883610
2ez
>>
>>52883589

Have it take another parameter called StartPos, and then you could do something like:

int i = 0;

while((i = search(arr, 25, 10, i) != -1)
{
//do a thing!
}
>>
>>52883746

Oops, that needs another paren right after the call to search, but you get me.
>>
>>52883739
he also wrote a bunch of stuff in racket to dump it for C++ because performance.
>>
>>52883778
>racket
>Performance

wat
>>
>>52883812
which why he would rewrite it for C++.
>>
>>52883589
int [] search (int array[10], int elem, int size) {
int i;
int pos;
int lel[10]= {0};
int count = 0;
for (i = 0; i < size; i++) {
if (array[i] == elem) {
lel[++count] = i
}
}
return lel;
}

>>
Any ideas how I can get the time out of the time I'm being handed by 4chan api?

My method of manually cutting it up and then convertiing it to a DateTime using DateTime.ParseExact doesn't seem to work for all boards because of the inconsistent way they handle it.
>>
>>52883865
Oh never mind, just read the documentation properly, some boards don't give you the seconds, I'll have to just write a method for handling it.
>>
>>52883850

Just because it says arr[10], there really is no requirement that it has 10 elements.
>>
Reposting. Feel free to ignore me if I'm being retarded, I am fairly new to programming.

Working on a page in ASP.NET, getting some error that "must be placed within a form tag with runat=server".
I've of course made sure that <form> has runat="server and I even tried adding so that the created textbox has runat="server" too. The basic function of the code is to add a textbox when clicking the button and increasing the number of the id with each textbox. Adding the first box, which is named spec0, works but clicking again produces the error. I am suspecting that the error comes from me fucking up the C# code.

Most of the code you see here comes from searching and adapting the code to the project.
protected int NumberOfControls
{
get { return (int)ViewState["NumControls"]; }
set { ViewState["NumControls"] = value; }
}

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
//Initiate the counter of dynamically added controls
this.NumberOfControls = 0;
else
//Controls must be repeatedly be created on postback
this.createControls();
}

private void createControls()
{
int count = this.NumberOfControls;

for (int i = 0; i < count; i++)
{
TextBox tx = new TextBox();
tx.ID = "spec" + i.ToString();
//Add the Controls to the container of your choice
Page.Controls.Add(tx);
}
}


protected void addnewtext_Click(object sender, EventArgs e)
{

TextBox tb = new TextBox();
tb.ID = "spec" + NumberOfControls.ToString();
tb.CssClass = "form-control" + " " + "span6";
PHbox.Controls.Add(tb);
tb.Attributes.Add("runat", "server");
this.NumberOfControls++;
}
>>
>>52883850

"int [] search"

you can't do that
>>
>>52883610
>>52883594
Has anybody ever done the dungeons and dragons with AI one?
Would like to play it.
>>
>>52883610
Roll
>>
File: 1432323884812-0.png (26KB, 431x499px) Image search: [Google]
1432323884812-0.png
26KB, 431x499px
>>52881397
#include <stdio.h>
#include <inttypes.h>

int main()
{
for (register uint_fast8_t i = 1; i <= 100; ++i)
printf("%" PRIuFAST8 " %s", i, (i % 15 == 0 ? "FizzBuzz\n" : (i % 5 == 0 ? "Buzz\n" : (i % 3 == 0 ? "Fizz\n" : "\n"))));
}


Compile with -O3.
>>
ternary conditional operators are shit for readability
>>
>>52883344
> ppl so hyped about PERL-descended Ruby and JS having builtin regexp literals
Lisp syntax is best syntax.

Racket lacks
general-car-cdr
tho. It's very important.

I just realised you can't create a circular list out of a plain list with quasiquotation
`#1=(,@foo . #1#)

just hangs on both SBCL and Emacs Lisp. It's logical tho
>>
>>52884117
bunch of useless things.
>>
>>52884275
Gotta write my own racket/lang that supports this. This means allowing circular data in the code, and making a cycle detecting quasiquote. Wish me luck!
>>
>>52884117
>multiple branching
>not using aligned ints
Pig disgusting

#include <stdio.h>
#include <inttypes.h>

int main()
{
const char* formats[] = {
"FizzBuzz\n",
"%" PRIuFAST16 "\n",
"%" PRIuFAST16 "\n",
"Fizz\n",
"%" PRIuFAST16 "\n",
"Buzz\n",
"Fizz\n",
"%" PRIuFAST16 "\n",
"%" PRIuFAST16 "\n",
"Fizz\n",
"Buzz\n",
"%" PRIuFAST16 "\n",
"Fizz\n",
"%" PRIuFAST16 "\n",
"%" PRIuFAST16 "\n"
};

for (register uint_fast16_t i = 1, j = 1; i < 101; ++i, ++j)
{
if (j == 15) j = 0;
printf(formats[j], i);
}

return 0;
}
>>
>>52884440
this is very disgusting and printf is the slowest part anyway, you should combine several lines into one printf call
>>
>>52884610
Or just don't use newlines, it will buffer up until you flush stdout.
>>
What's the difference between linking and binding?
>>
>>52884974
In what context?
>>
>>52884256
No they're not. You personally having trouble with them doesn't mean there's anything objectively wrong.
>>
>>52885097
I have a compiler, the help menu offers both binding and linking as separate options. I want to understand what that difference is.
>>
Why doesn't this work?
#define delLink(inNode)    inNode->previous->next=inNode->next; \
inNode->next->previous=inNode->previous;\
free(inNode);
>>
>>52885132
Click on them.
>>
>>52885175
Command line tool anon.
>>
>>52885197
ARE YOU FUCKING RETARDED? TRY THEM OUT FOR YOURSELF AND SEE WHAT THEY DO!
>>
>>52885171
You aren't checking whether inNode->previous or inNode->next are valid, so it will fail for the first or last elements of a list.
>>
>>52885171
try this
#define delLink(inNode)   ( inNode->previous->next=inNode->next; \
inNode->next->previous=inNode->previous;\
free(inNode);)
>>
>>52884440
>register
>>
>>52885171
See >>52885267

You should also wrap inNode in parentheses in case it is an expression.


#define delLink(inNode) \
do { \
if ( (inNode)->previous) (inNode)->previous->next = (inNode)->next; \
if ( (inNode)->next) (inNode)->next->previous = (inNode)->previous; \
free(inNode);
} while (0)
>>
>>52885267
I'm using a sentinel. Should have said that. I don't really store anything special for the sentinel so it could be freed but it's not a concern ATM.
>>52885279
That's a syntax error. I can try surrounding my innode's with parenthesis. Probably what you had in mind.

And I think I've figured out an issue if the node I'm trying to delete is expressed as sentinel->next or node->next then it will delete the wrong node. That's probably it.
>>
>>52885323
forgot a ; there
>>
>>52885351
No, but I did forget a \

You don't want the trailing ; because then this would be valid:

void foo(node_t* node)
{
delLink(node) // note the lack of ;
}
>>
>>52885338
That didn't work. Not sure I did what I had intended. I'm kinda tired.
#define delLink(inNode)    {node* tempnode_=inNode;(inNode)->previous->next=(inNode)->next; \
(inNode)->next->previous=(inNode)->previous;\
free((tempnode_));} //Braces here so tempnode_ is restricted to the macro scope
>>
https://strawpoll.me/6772039
>>
File: Tqt6bxs.jpg (40KB, 290x290px) Image search: [Google]
Tqt6bxs.jpg
40KB, 290x290px
>>52885590
>voting for 'fizz' or 'buzz' while you can have both
OHOHOHOHO
>>
File: 1454859140049.jpg (128KB, 550x550px) Image search: [Google]
1454859140049.jpg
128KB, 550x550px
>>52885616
>being a moderate pleb instead of choosing sides
>>
>>52885171
>>52885279
>>52885323
>>52885533
>unsafe macros
Ever heard about inline functions, tard?
>>
>>52885700
>he trusts C++ inline
>>
>>52885700
inline does literally nothing
>>
>>52885738
confirmed for not knowing jack shit about inline assembly
>>
>>52884117
>>52884440

You guys do know that the register keyword doesn't really do anything, right? If you have a ton of variables, it MIGHT make a hint to the compiler that you would like that variable to stay in a register over others, but this is not guaranteed. Given that adding is typically always done in a register, your loop counter would have been stored in one anyways.
>>
>>52885590
buzz army represent
>>
>>52885700
common practice in C.
>>
>>52885777

If you compile with -O3, the compiler will aggressively inline everything without you needing to tell it to.
>>
File: coinflip.png (25KB, 1076x727px) Image search: [Google]
coinflip.png
25KB, 1076x727px
If you can't do this, the language of your choice is shit
>>
>>52885815
__attribute__((noinline)) inline void foo() {
fizzbuzz();
}


what now, biyatch?
>>
>>52885838
print(random.choice([0, 1]))
>>
>>52885838
flipcoin();


done.
>>
>>52885838
>implying java isn't shit

import acm.program.*;
import acm.util.*;

public class CoinFlip extends Program {

public void run() {

String flip = rgen.nextBoolean() ? "Head" : "Tails";

println(flip);

}

private RandomGenerator rgen = RandomGenerator.getInstance();

}
>>
>>52885838
import java.util.Random;
class Foo {
public static void main(String args) {
System.out.println(new Random().nextInt(1));
}
}
>>
>>52885879
import acm.program.*;
import acm.util.*;

public class CoinFlip extends Program {
public void run() {
println(new RandomGenerator.getInstance().nextBoolean() ? "Head" : "Tails";);
}
}
>>
>>52885872
python is shit regardless

>>52885879
>>52885891
>>52885910
>>/loo/
>>
>>52885874
>>52885872
>>52885891
>>52885910
Stupid.

>>52885879
Yes, it is.
>>
>>52885782
>>52885296
>You guys do know that the register keyword doesn't really do anything, right?

You're wrong, pic related.
>>
>>52885891
>Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)
goddamnit change it to a 2

at least i'm not a codemonkey
>>
Would /g/ use it to generate a seed for a CSPRNG?
(from Four Lines of Javascript that Can’t Possibly Work So why do they? by Dan Kaminsky https://www.alchemistowl.org/pocorgtfo/pocorgtfo01.pdf )
>>
>>52885935
ok pahjeet
>>
>>52885815
>what is noinline
>what is volatile
>>
>>52885838
>tfw go has no ternary operator
package main

import (
"fmt"
"math/rand"
"time"
)

func main() {
rand.Seed(time.Now().UnixNano())
if rand.Int() % 2 == 0 {
fmt.Println("head")
} else {
fmt.Println("tail")
}
}
>>
>>52885972
TOP KEK
>>
File: Linus-Torvalds.jpg (162KB, 800x400px) Image search: [Google]
Linus-Torvalds.jpg
162KB, 800x400px
>>52885738
>>52885799
inline functions are like macro but type safe. there no reason to favor macro over inline functions except when you want a left value. using macros to inline code in C is an obsolete programming technique from the past.

>inline does literally nothing
void rev (unsigned int size, unsigned int buf[])
{
unsigned int i;
for (i = 0; i < size; ++i)
buf[i] = __builtin_bswap32(buf[i]);
}

void foo (unsigned int size, unsigned int buf[])
{
rev(size, buf);
}


gcc, rev not inline qualified
rev(unsigned int, unsigned int*):
test edi, edi
je .L1
mov rax, rsi
lea edx, [rdi-1]
lea rcx, [rsi+4+rdx*4]
.L3:
mov edx, DWORD PTR [rax]
bswap edx
mov DWORD PTR [rax], edx
add rax, 4
cmp rax, rcx
jne .L3
.L1:
rep ret

foo(unsigned int, unsigned int*):
call rev(unsigned int, unsigned int*)
rep ret



gcc, rev inline qualified
foo(unsigned int, unsigned int*):
test edi, edi
je .L1
mov rax, rsi
lea edx, [rdi-1]
lea rcx, [rsi+4+rdx*4]
.L3:
mov edx, DWORD PTR [rax]
bswap edx
mov DWORD PTR [rax], edx
add rax, 4
cmp rax, rcx
jne .L3
.L1:
rep ret


you said ?
>>
>>52885972
can't you do something like this in go?:

func main() {
rand.Seed(time.Now().UnixNano())
if rand.Int() & 1 {
fmt.Println("tail")
} else {
fmt.Println("head")
}
}
>>
>>52885993
-O3?
>>
>>52885838
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main() {
srand(time(NULL));
cout << rand()%2 << '\n';
return 0;
}
>>
Critique this shitty battleship game made in C++
Any tips senpais?

http://pastebin.com/DafzyULd

pls
>>
>>52885997
>inb4 this is a movement
>>
>>52885738
https://gcc.gnu.org/onlinedocs/gcc/Inline.html
>>
>>52886014
i'd be surprised if it has implicit cast from int to bool if it doesn't even have ternary
>>
>>52884440
>what is unsigned and %u
you're trying too hard and you look like an idiot m8
>>
>>52886014
./flip.go:11: non-bool rand.Int() & 1 (type int) used as if condition
>>
>>52886069
>>what is unsigned and %u
Slow
>>
seems like there are some smart people here.

what's the fastest tool to use to transfer a large file from one linux machine to another over a fast connection (>10 Gbps) but long distance?
>>
>>52886184
netcat
>>
>>52886024
#include <iostream>
#include <ctime>
#include <stdlib.h>
#include <math.h>

#define ROWS 10
#define ELEMENTS 10
int maxships = 10;
int matrix[ROWS][ELEMENTS];

void Clear(void) {
for (int i = 0; i < ROWS; i++)
for (int j = 0; j < ELEMENTS; j++)
matrix[i][j] = 0;
}
void Show(void) {
for (int i = 0; i < ROWS; i++) {
for (int j = 0; j < ELEMENTS; j++) {
std::cout << matrix[i][j] << " ";
}
std::cout << std::endl;
}
}

int NumOfShips(void) {
int c = 0;
for (int i = 0; i < ROWS; i++)
for (int j = 0; j < ELEMENTS; j++)
if (matrix[i][j] == 1)
c++;
return c;
}

void SetShips(void) {
int s = 0;
while (s < maxships) {
int x = rand() % ROWS;
int y = rand() % ELEMENTS;
if (matrix[x][y] != 1)
s++, matrix[x][y] = 1;
}

}

bool Attack(int x, int y) {
if (matrix[x][y] == 1) {
matrix[x][y] = 2;
return true;
}
return false;
}

int main(void)
{
srand(time(NULL));
Clear();
SetShips();
int pos1, pos2;
char prompt;
for (;;) {

std::cout << "Please input location: ";
std::cin >> pos1 >> pos2;
if (Attack(pos1, pos2))
std::cout << "You got me!" << std::endl;
else
std::cout << "You missed me!" << std::endl;
std::cout << "Number of ships left: " << NumOfShips() << std::endl;
//Surrender
std::cout << "Do you want to surrender? (y/n)?";
std::cin >> prompt;
if (prompt == 'y')
break;
}
std::cout << "GAME OVER" << std::endl;
Show();
return 0;
}
>>
>>52886024
Remove the
system("pause")
or I'm forced to rip your boypussy.
>>
>>52886184
a truck
>>
>>52885838
proc flip = bool: random < 0.5;
to 10 do printf(($b("heads", "tails")l$, flip)) od
>>
>>52886204
le plt face
>>
>>52886201
how, redirect stdin? i doubt it

>>52886206
i'm afraid this is true
>>
>>52881397
More FizzBuzz!
fn main() {
for i in 1..100 {
if i % 15 == 0 {
println!("FizzBuzz");
}else if i % 3 == 0 {
println!("Fizz");
}else if i % 5 == 0 {
println!("Buzz");
}else {
println!("{}", i);
}
}
}
>>
Top 5 most useful programming "skills": (please no meme answers)
>>
>trying to work with json in c++
>
>>
>>52885838
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int n, seed;
const char *coin[2];
coin[0] = "Heads\n";
coin[1] = "Tails\n";
seed = time(NULL);
srand(seed);
n = rand()%2;
printf(coin[n]);
}
>>
>>52886269
being non-retarded
not using python
using static typing
being able to come up with your own algorithms
optimize for data access patterns
>>
>>52886269
Hello world
FizzBuzz
Fibonacci
Factorial
Coin flip
>>
>>52886269
>taiwan #1
>japan #2
>korea #3
>china #4
>ur mum #5
>>
>>52886204
When I remove the
system("pause")
it doesn't quite work. For example when I surrender it immediately closes and when I hit a battleship it displays an infinite loop. How can I overcome this? What is widely agreed to be the best C++ Book out there?
>>
Find a flaw in my code

from os import makedirs, chdir, startfile
from urllib.request import URLopener, urlopen
from re import finditer
from os.path import expanduser

link = input("Copy paste the link of the thread: ")
request = "https://a.4cdn.org" + link[link.find("org")+3:] + ".json"
response = str(urlopen(request).read())
board = request[request.find("org")+3:request.rfind("/")-6]

id_list = [response[e.end()+1:e.end()+14] for e in finditer('"tim"', response)]

ext_list = [(response[s.end()+2:e.start()-2]) for s,e in zip(finditer('"ext"', response), finditer('"w"', response))]

img_list = ["https://i.4cdn.org" + board + ID + EXT for ID, EXT in zip(id_list, ext_list)]


download_dir = expanduser("~") + "\Downloads\\"
new_folder_name = input("Name the new folder: ")
download_folder = download_dir + new_folder_name
makedirs(download_folder)
chdir(download_folder)

print(len(id_list), "files")

for img, ids, ext in zip(img_list, id_list, ext_list):
URLopener().retrieve(img, ids+ext)

startfile(download_folder)


That's right you can't
>>
>>52886343
>For example when I surrender it immediately closes
That's what it should do. Otherwise, ask the user if he wants to restart.
>and when I hit a battleship it displays an infinite loop.
Fix it senpai.
>>
>>52886344
missing semicolons all over the place
>>
File: sadsfrogs.jpg (4KB, 212x119px) Image search: [Google]
sadsfrogs.jpg
4KB, 212x119px
>>52881368
I'm trying to write a program to analyze variance and covariance among basketball players. I'm then going to try to create optimized lineups.

The only issue is that all that I know is a little bit of python. So far, my script just turns the .csv into a series of dictionaries. It doesn't even do anything cool like scrape the .csv form draftkings.
>>
>>52886344
>python
>>
>>52886203
This works, except for when it's time to surrender. Then an infinite loop is displayed
>>
>>52885951
And what are you?
>>
>>52886108
looks like you're slow
>>
>>52886433
Come back when you know C, kiddo.
>>
>>52886344
>0/10 in pylint
http://pastebin.com/69Tf70mb
I see some flaws there.
>>
>>52886344
>\Downloads\\
>\D
retard
>>
>>52886461
>implying he can average 2 ints
back to memejs, pajeet
>>
>>52885958
You need to make sure the clock speed is fast enough for the coin to actually flip. Otherwise that's pretty clever. Getting different clock speeds to generate the randomness.
>>
>>52881368
String x = "op is a faggot";
String y = "op is not a faggot";
op = (op == fag) ? x : y;
println(op);
>>
>>52886108
>printf
>fast
pick one
>>
>>52885838
Enum.random([0, 1])
>>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
main(){srand(time(NULL));int i=rand()%2;printf("%s",i?"Heads":"Tails");}

just finished my cs degree.
>>
>>52886509
retarded.java:1: error: class, interface, or enum expected
String x = "op is a faggot";
^
retarded.java:2: error: class, interface, or enum expected
String y = "op is not a faggot";
^
retarded.java:3: error: class, interface, or enum expected
op = (op == fag) ? x : y;
^
retarded.java:4: error: class, interface, or enum expected
println(op);

>>
>>52886523
>write a program in 30 seconds
>lol ill outsmart him by writing a line of code instead
>>
>>52886533
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
main(){srand(time(0));printf("%s",rand()%2?"Heads":"Tails");}
>>
>>52886533
go flip some burgers, you're incompetent
>>
File: 1409008696388.png (13KB, 500x500px) Image search: [Google]
1409008696388.png
13KB, 500x500px
Is it worth learning libgdx
>>
>>52886545
Oh, shit my OP is a faggot program doesn't werk
>>
>>52886568
no
>>
>>52885838

import random

result = random.choice(["Heads", "Tails"])
print(result)

>>
>>52885838
>>52886523
Actually this is probably better to specification
["Heads", "Tails"] |> Enum.random() |> IO.puts()


>>52886559
Enum.random([0, 1]) |> IO.puts()
>>
>>52886583
Got any alternatives?
>>
>>52886559
>implying he can write more than 1 line of code in 30 seconds
>>
>>52886595
xD
>>
Scripting.

>>> re.split(" ", "えー, ええ ee interj. eh?, what?; well, yes", 1)
['えー,', 'ええ ee interj. eh?, what?; well, yes']
>>> re.split("[^,] ", "えー, ええ ee interj. eh?, what?; well, yes", 1)
['えー, え', 'ee interj. eh?, what?; well, yes']

How do I check for the nonpresence of the , without deleting the last character of the first half of the output? My desired output looks like this:

['えー, ええ',' ee interj. eh?, what?; well, yes']

This is a huge batched thing so I can't just do it by hand.
>>
File: confusedblackman.jpg (22KB, 575x323px) Image search: [Google]
confusedblackman.jpg
22KB, 575x323px
why are you all so goddamn bitter? aren't you all employed? what the fack?
>>
>>52886608
node.js
>>
>>52886564
Let's see a picture of your office, then, fuccboi.
>>
>>52886613
Here's the oneliner so you don't have to call result

import random

print(random.choice(["Heads", "Tails"]))
>>
>>52886629
Employment made me bitter
>>
>>52886629
>2016
>wage slave
ishyggydiggy
>>
>>52886629
You get bitter by being a wage slave.
>>
>>52886659
If you have a shit job maybe. Speak for yourself.
>>
>>52886630
I'm being serious
>>
>>52886613
And here's the one liner to execute from your shell
python3 -c 'import random; print(random.choice(["Heads", "Tails"]))'
>>
>>52886653
while(true):
goto reddit;
>>
File: helpme.gif (709KB, 477x270px) Image search: [Google]
helpme.gif
709KB, 477x270px
>>52886381
import csv, sys
from sys import argv
import numpy as np
import scipy as sp


filename = argv[1]

salary = 50000

roster = {
"pg": 1,
"sg": 1,
"pf": 1,
"sf": 1,
"c": 1,
"g": 1,
"f": 1,
"u": 1
},

players = []
#opens the draftkings csv, reads it, and appends every row as a list to players
with open(filename, 'rb') as f:
reader = csv.reader(f)
for row in reader:
players.append(row)

cost = {item[1]:float(item[2]) for item in players}

points = {item[1]:float(item[4]) for item in players}

position = {item[1]:item[0] for item in players}


pls no bully
>>
>>52886702
>goto
>undefined variable

Back to >>>/trash/
>>
>>52886658
>>52886659
Who the fuck works for a wage?

Aren't all programmers salaried?

>>52886498
int average(int a, int b)
{
return (a < b) ? a : b; // the median is an average too and nobody said anything about calculating the mean
}
>>
>>52886269
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<stuff you need to know>xml parsing</stuff you need to know>
<stuff you need to know>love</stuff you need to know>
<stuff you need to know>knowing few programming languages</stuff you need to know>
<stuff you need to know>having fun from programming</stuff you need to know>
<stuff you need to know>having big cock</stuff you need to know>
</data>

>>
>>52886680
>oh boy what's on the menu for today!
>more bugfixes :DDDDDDDDD
>>
>>52886690
me too: node.js knowledge is worth more than libgdx knowledge
>>
>>52886712
mind posting the csv file? what's the methodology behind this?
>>
>>52886733
I don't make a living as a programmer.
I'll let you keep shitposting, and living at home with the parents though.
>>
>>52886740
I'm looking to program for mobile, can't do that with node.js

>inb4 hurr mobile development
There's a fuckload of money in it.
>>
>>52886694
you know you are importing a lib which makes your shit much much bigger
>>
>>52886680
>implying you aren't bitter af
>>
>>52885838
int coinflip(void)
{
return (rand() % 2);
}
>>
>>52886780
easy

from random import choice


now im just importing a function
>>
>>52886628
Eh?
>>
>>52886728
>nobody said anything
>desperately searching for a loophole
and this is how you know you're shit; you can't do it because you're not a programmer; back to css
>>
Proper solution coming through.

#include <cstdio>
#include <random>

static std::random_device &GetRandomDevice()
{
static std::random_device Device{};
return Device;
}

static std::mt19937 &GetRandomEngine()
{
static std::mt19937 Engine{GetRandomDevice()()};
return Engine;
}

static bool GetRandomBool()
{
static std::bernoulli_distribution Dist{0.5};
return Dist(GetRandomEngine());
}

int main(int, char **)
{
fprintf(stdout, "%s\n", GetRandomBool() ? "Head" : "Tails");
return 0;
}
>>
File: a ruff victory.jpg (65KB, 500x368px) Image search: [Google]
a ruff victory.jpg
65KB, 500x368px
>>52886789
I'm sitting in my office right now, shitposting heads/trails, talking to actual bitter people while about to take a 2nd lunch and go for a smoke.
So bitter.
>>
>>52886775
yes, you can, web applications work on mobile too; also there's more money in web development
>>
>>52886801
>desperately
>loophole
implying implications

If you knew anything about C, you would know that averaging two ints is implementation defined and thus I'm correct and you can choke on some unspecified behaviour.

I'm a big dick C playa, you're a webcuck.
>>
>>52886755
>I don't make a living as a programmer.
Like I expected otherwise. Go optimize your fizzbuzz program.
>and living at home with the parents though
This way I can save up a lot of $$$.
>>
>>52886821
Tails*
>>
>>52886832
>Admitting to being a NEET.
I said I don't work as a programmer. I don't want to risk ending up hating my hobby. If you can't see that what I posted was a joke, it's time for you to grab your blankie and have your afternoon nap, sport.
>>
>>52886829
>If you know anything about C
I know everything about C
>averaging two ints is implementation defined
no, it's not; oh, you mean YOU don't know how to do it in C without triggering implementation defined behavior? tough luck
>you can choke on some unspecified behaviour.
nah, I know C properly
>I'm a big dick C playa, you're a webcuck
you got that the other way around :)
>>
>>52886847
Fuck you burger.
>>
r8 my sorting algorithm dpt :^)

# My simple and efficent sorting algorithm
from sys import setrecursionlimit; setrecursionlimit(999999999)
import random
import collections

def is_sorted(array, unsorted):
# Check if list is in order
for i in range(len(array)-1):
if array[i] > array[i+1]:
return False
# Check if list has same elements as old list
return collections.Counter(array) == collections.Counter(unsorted)

def my_sort(not_sorted):
possibly_sorted = [random.randint(min(not_sorted), max(not_sorted)) for xD in range(len(not_sorted))] # :^)
if is_sorted(possibly_sorted, not_sorted):
return possibly_sorted
else:
return my_sort(not_sorted)
>>
>>52886903
it's shit
>>
File: yeb.jpg (3KB, 166x90px) Image search: [Google]
yeb.jpg
3KB, 166x90px
>>52886750
It's too big to post the whole thing, but I'll include a few lines.
"PG","Russell Westbrook",10600,"OKC@Por 09:00PM ET",53.216,"OKC"
"SF","Kevin Durant",10100,"OKC@Por 09:00PM ET",47.567,"OKC"
"SG","James Harden",9900,"Ind@Hou 07:00PM ET",49.669,"Hou"
"SF","LeBron James",9800,"Cle@Phi 06:00PM ET",47.371,"Cle"
"SF","Paul George",9100,"Ind@Hou 07:00PM ET",43.549,"Ind"
"PG","Damian Lillard",8800,"OKC@Por 09:00PM ET",43.273,"Por"
"PG","Kemba Walker",8400,"Cha@Den 08:00PM ET",36.893,"Cha"
"SF","Carmelo Anthony",8200,"Mil@NY 07:30PM ET",38.595,"NY"
"PG","Isaiah Thomas",7500,"Bos@Mem 06:00PM ET",36.979,"Bos"
"SF","Nicolas Batum",7400,"Cha@Den 08:00PM ET",35.339,"Cha"


I want to be able to iterate through the values in the dictionaries, and maximize points subject to the constraint of a $50000 salary cap. I need to use some sort of linear programming module to do this.

I also want to add a function to scrape relevant historical player data from a site like numberfire so that I can find player variance and covariance and factor that into my lineup generator.

My only stumbling block is that I have no idea what I'm doing.
>>
>>52886887
>"I know C"
>can't even average two ints in standard C without using floating points or jquery-esque third party non-standard libraries
Back to work, praheet. Those CSS classes don't write themselves.
>>
>>52886899
I'm also not American.
Tons of assumptions, keep at 'er; making serious progress here.
>>
>>52886728
The correct way to calculate the median of an even number of values is to average the central two.
>>
>>52886947
>floating points
>jquery
>the points are floating
>CSS classes
well now, if your points are floating you should study some more css, webape ;)
>>
File: top_ebin.png (54KB, 507x464px) Image search: [Google]
top_ebin.png
54KB, 507x464px
>>52886953
>making serious progress here
on ur mum :DDDDDDDDD
>>
File: avginput.png (29KB, 1076x727px) Image search: [Google]
avginput.png
29KB, 1076x727px
>>
>>52886972
>The correct way to calculate the median of an even number of values is to average the central two.
1) You mean calculate the arithmetic mean between the two values
2) That's only ONE way. In fact any value in the inclusive range [a, b] is a valid median of a and b.

https://en.wikipedia.org/wiki/Median
>>
>>52886947
>floating points
don't forget to clearfix-it, pajeet!
>>
>>52886824
source? All node.js to mobile ports are in their early stages right now.
>>
>>52886910
you cant comprehend its beauty
it could create the sorted result in 1 iteration
>>
>>52886995
not doing your homework you dipshit.
>>
>>52887002
can't
>>
>>52886995
>2 minutes
if that takes you more than 40 seconds you should leave

>>52887007
not even cs grads have hw this easy
>>
>>52886568
no it's shit

node.js is also shit but not as shit as libgdx

>>52887000
i think he's talking about in-browser shit
>>
>>52886984
This is an 18+ website.
>>
>>52887000
>node.js to mobile ports
it's called a website, you fucking monkey
>>
>>52886996
It's exclusive range, not inclusive range.
>a median is the number separating the higher half of a data sample, a population, or a probability distribution, from the lower half
Inclusive range disqualifies this.

If it ways inclusive range is valid anywhere else, it is certainly contradicting itself.
>>
>>52887016
I had a friend that wanted to make videogames and this is literally one of the assignments he got on first year.
>>
>>52886995
import acm.program.*;

public class AvgInp extends Program {

public void run() {
int sum = 0;
int i = 0;
int x = 1;
while (x != 0) {
x = readInt("Enter an integer number, once you're finished press 0: ");
if (x != 0) {
sum += x;
i++;
} else {
break;
}
}
if ( i!=0 )
println((double)sum/i);
}

}


it's disgusting i know but i get nervous with time limits
>>
>>52887020
At least explain WHY it's shit.

>>52887026
I'm making $100 a day from in app purchases from normies a day, you can't do that shit with a fucking website mongoloid
>>
What language do I learn first and what books/websites do I use?
>>
>>52887055
it's a bare minimum cross-platform wrapper with some trivial helper libraries that restrict you more than they help you

just work directly with the android API, it will still be easy to port your game to other platforms
>>
>>52886995
package main

import (
"fmt"
)

func main() {
var vals []int
var in int
for {
_, err := fmt.Scanf("%d", &in)
if err != nil {
panic(err)
}
if in == 0 {
break
}
vals = append(vals, in)
}
var total int
for _, i := range vals {
total += i
}
avg := total / len(vals)
fmt.Println(avg)
}
>>
>>52887083
Could've skipped the array part and just added in to total. Oh well...
>>
>>52886995
i did your homework for you
nums, put = [], ""
while put != 0:
put = int(input(":^) "))
nums.append(put)
nums.remove(0)
print(sum(nums)/len(nums))
>>
File: 1452194572678.jpg (634KB, 2943x2155px) Image search: [Google]
1452194572678.jpg
634KB, 2943x2155px
>>52887083
>Go
>writing more than 2 lines
>>
>>52887078
Thanks mate.
>>
>>52887083
looks almost as disgusting as python
>>
>>52887055
>you can't do that shit with a fucking website mongoloid

I have 10 sites that are basically Clickbait filled with ads. I place them in clicking rotations and send out tons of spam email

guess how much I make from views alone?
$1200 per website per month
>>
>>52886468
>pylint
topkek you're retarded buddy
>>
>>52887127
What did you expect? It's made by the same type of people...
>Google employees
>>
And yet Google usually uses the most secure software...
Meanwhile, you fags are here discussing about
>hurr durr muh python is bad
>>
>>52886344
So I was right, my code is flawless ;)
>>
File: dpt.png (550KB, 1500x1800px) Image search: [Google]
dpt.png
550KB, 1500x1800px
>>52881368
PSA:
REMINDER to ignore TROLL posts that contain:
> gcc compiles this wrong code!!! (posts some retarded shit, compiles with g++)
> java can't compare these Integers with ==
> average of two ints in C
> fizzbuzz
> buzzwords
> go has no generics
> haskell is useless
> lisp brackets are unreadable
> GC is shit, use a real language
> programming literate
> anime ops
> non-anime ops
> posting new thread to early
> anime is gay
> trap ops
> non-trap ops
> osgtp anarchy politics
> osgtp black women
> tripfags in general

also, don't forget to post this in the next thread.
thanks.
>>
let mk_url length =
Printf.sprintf
"http://www.opensubtitles.org/en/search/sublanguageid-eng,fre/\
moviebytesize-%d" length
;;

let file_length file = (Unix.stat file).Unix.st_size;;

let url_of_file file = mk_url (file_length file);;

let rec waitpid pid =
let kpid, _ = Unix.waitpid [] pid in
if kpid = pid then
()
else
waitpid pid
;;

let daemon f =
match Unix.fork () with
| 0 ->
begin
match Unix.fork () with
| 0 -> f ()
| _ -> exit 0
end
| pid -> waitpid pid
;;

let search file =
let dev_zero = Unix.openfile "/dev/zero" [ Unix.O_RDONLY; ] 0o400 in
let dev_null = Unix.openfile "/dev/null" [ Unix.O_WRONLY; ] 0o200 in
Unix.dup2 dev_zero Unix.stdin;
Unix.dup2 dev_null Unix.stdout;
Unix.dup2 dev_null Unix.stderr;
Unix.close dev_zero;
Unix.close dev_null;
Unix.execvp "firefox" [|"firefox"; url_of_file file; |]
;;

let main () =
let rec loop n =
if Array.length Sys.argv <= n then
()
else
begin
daemon (fun () -> search Sys.argv.(n));
loop (succ n)
end in
loop 1
;;

let () = main ();;
>>
>>52887007
>>52887107
It isn't homework, smartasses, I just thought I'd liven things up since it was getting dead
>>
<html>
ur a faggot<br>
</html>
>>
>>52887386
I know you spent a lot of time on this and I'm sure it means a lot to you, but it's really not all that funny or clever

maybe someday you'll make something funny and worth reposting
>>
Hey guys, very very new to programming.
Learning python at the moment.
I need to write a script that finds the common
factors of two numbers input by the user. And then it will go on to display all of the common factors.

I'm having a bit of a brain fart about how to go at it, I'm not asking for anybody to do it for me, but I would like some direction. So far this is all I have.


num = eval(input("Enter first number: "))
num2 = eval(input("Enter second number: "))


Not that much lol, I'm just very new to this so I'm coming to you guys, not sure if I need to use a loop. Thanks a bunch.
>>
>>52887624
iterate up to half the largest inputted number, and check if the current iteration goes evenly into both numbers with no remainder. (hint: use modulo).
>>
File: cpp-one-chart.png (173KB, 790x449px) Image search: [Google]
cpp-one-chart.png
173KB, 790x449px
Can anyone recommend a good intermediate/advanced book, guide or something about modern C++?

I used to program a lot in C++ before C++11, but then I moved to Rust and other languages and lost some skills.
Modern features like smart pointers, auto etc look great and are fairly straightforward, but I would like to learn them in-deep and learn how to use all new features and practices in efficient way.
>>
>>52881397
if we print FizzBuzz (and not Fizzbuzz, note the lowercase b), you don't need to treat the case of both 3 and 5 specially:

#include<stdio.h>

int main(void)
{
for (int i = 0; i < 100; i++)
{
printf("%i: ", i);
if (i % 3 == 0)
printf("Fizz");
if (i % 5 == 0)
printf("Buzz");
printf("\n");
}
}


This actually prints FizzBuzz for i=0 though.
>>
>>52887693
>Can anyone recommend a good intermediate/advanced book, guide or something about modern C++?
Effective Modern C++
More Effective Modern C++
>>
>>52887693
Effective Modern C++ by Meyers
>>
>>52887745
>More Effective Modern C++
Don't think this book exists.
>>
>>52887727
It also prints the number even if it is fizz/buzz/fizzbuzz, which it isn't supposed to.
>>
>>52887760
>>52887745
Thanks, it looks pretty good.
>>
>>52887616
>I know you spent a lot of time on this
no, I didn't, other people did, I just compiled the list and downloaded that image.
>>
>>52887693
>lost some skills
you never had any if you lost them
>>
>>52887834
Scott Meyers is based, even though he looks like the tip of a penis.
>>
>>52881397
More fizzzbuzz
import FizzBuzz
>>
>>52881397
>>52886262

Now with Iterators!

fn main() {
(1..).map(|i| match (i%3, i%5) {
(0, 0) => println!("FizzBuzz"),
(0, _) => println!("Fizz"),
(_, 0) => println!("Buzz"),
_ => println!("{}", i),
}).take(100).count();
}
>>
>fizzbuzz
don't you people ever do anything useful
>>
>>52887025
false, you must be new
>>
I'm reading over some user's solutions to a problem.
They are traversing through a 2D matrix, but at the end of the array they always set the last value to infinity. The problem is trying to find the minimum distance of values from top to bottom.

def minimumTotal(triangle):
if not triangle:
return 0

cur = triangle[0] + [float("inf")]
for i in xrange(1, len(triangle)):
test = []
test.append(triangle[i][0] + cur[0])
for j in xrange(1, i + 1):
test.append(triangle[i][j] + min(cur[j - 1], cur[j]))
cur = test + [float("inf")]

return reduce(min, cur)
>>
>>52887859
You can't keep remembering standard library and language's quirks forever, especially when you don't use it and keep switching thought many others.
Of course I'm talking about language-based skills, not general programming skills.
>>
>>52887928
>useful
>posting on 4chink
>>
>>52887928
We can also average two ints in C!
>>
>>52887973
>You can't keep remembering standard library and language's quirks forever
programming is not for you m8
>>
>>52888006
>can't
ftfy
>>
What should I program to actually make a lot of money?
>>
>>52888096
C+=
>>
>>52888035
I beg to disagree.
>>
>>52888104
No meme answers please
>>
>>52888108
you can't beg all you want, you can't change the facts
>>
>>52888096
javascript
>>
File: opm_ok.jpg (29KB, 375x305px) Image search: [Google]
opm_ok.jpg
29KB, 375x305px
>>52888141
>>
>>52888141
>>52888175
Programming in multiple different languages shows you actually really know how to program. Sure, we all forget differences of syntax sometimes but you should be able to figure out the logic very easily if you can program well
>>
>>52888203
>we all forget differences of syntax sometimes
not true for C++
>>
>>52888096
To make really lot of money out of programming, you need combination of skill, luck, connections and mind of a genius. Eg. Notch had only luck and become rick as fuck.
To get stable, less risky job, you could become java enterprise developer or someone like that with normal skills and knowledge.
Game dev and startups are actually more fun, but usually pay significantly less.
Web dev is easier but has lower pay as well.
>>
Gonna try out non-ide programming just in case it's not just a meme
Which one do I use?
>>
>>52888606
Vim
>>
Reminder that if your language isn't statically typed, it's hot garbage
>>
>>52888606
emacs
>>
>>52888635
oops, meant to type "vim". pardon my error.
>>
>>52888096
Learn a language that's still used but is old as fuck

Those nuclear plants still running FORTRAN have no choice but to pay you up the ass
>>
>>52888620
>muh types
>I can't into
end yourself
>>
>>52888675
But you're not me
>>
>>52885796
An army of one you faggot. FizzBuzz master race.
>>
>>52888696
but I am
>>
>>52888695
>end yourself
Because you can't into types?

Dynamic typing is objectively bad and will soon be going away
>>
File: typing2.png (99KB, 589x596px) Image search: [Google]
typing2.png
99KB, 589x596px
>>52888733
>>
>>52888733
JS isn't going away any time soon
>>
>>52888709
but you're not me >>52888675
>>
>>52888606
Default text editor + compiler + debugger + console
>>
>>52888733
>soon be going away
bwahahahahaha
>>
>>52888749
Everybody uses TypeScript these days, anon

>>52888745
>people who get shitty poo-in-loo tier python scripts done
>>
NEW THREAD!!

>>52888792
>>52888792
>>
>>52888733

>Will soon be going away
I'm sorry, did you miss the proliferation of JavaScript and Python?
>>
>>52888795
>>people who get shitty poo-in-loo tier python scripts done
Friendly reminder that there are people coding in Python right now thus being more productive than shitposters on 4chan.
>>
>>52888795
>Everybody uses TypeScript
well memed
>>
>>52888800
Absolute dumbass
>>
>>52888821
Those and Ruby are about the only popular "modern" languages out there that use dynamic typing

JS is used in spite of shit type system, Python is relatively well suited for dynamic typing if you keep your programs short
>>
>pleb users of non-functional languages don't know how to invert a binary tree
LOL
>>
On windows, is there a way to create a "file" that executes a program when accessed?
Kind of like a linux kernel module.
>>
>>52886995
defmodule Thing do
def sum_input(total, count) do
case IO.gets("Number: ") |> Integer.parse() do
{0, _} -> {total, count}
{x, _} -> sum_input(total + x, count + 1)
end
end
end

{total, count} = Thing.sum_input(0, 0)
IO.puts(total / count)
>>
>>52888902

>Python is relatively well suited for dynamic typing if you keep your programs short

Ruby is the same. Also, don't know if/how this can be done in Python, but a Ruby programmer can force type checking very easy.

raise TypeError unless arg.is_a? MyType
>>
>>52889047
x = "something"
if isinstance(x, str):
print("It's a fucking string")
>>
>>52889076

Fair enough. Figures Python and Ruby have a lot of features in common. I just can't be fucked to write Python without either a paycheck or a good motivation.
>>
>>52889120
Python's a big ol' mess, which is why I'm trying to
force myself to learn more about Ruby since I'm starting to like Ruby's syntax a lot more.
>>
>>52889047
 if not isinstance(arg, str): raise TypeError
>>
>>52889229

If there is one thing Ruby has going for it, it's syntax... and flexibility.
>>
if (typeof x !== "string") {
throw new TypeError("x must be a string");
}
>>
Anybody else forth or j here?

Enough of this pleb talk.
>>
File: what the fuck ruby grammar.jpg (165KB, 1024x593px) Image search: [Google]
what the fuck ruby grammar.jpg
165KB, 1024x593px
>>
File: python grammar.jpg (145KB, 766x1024px) Image search: [Google]
python grammar.jpg
145KB, 766x1024px
>>
File: not4plebz.jpg (316KB, 1646x589px) Image search: [Google]
not4plebz.jpg
316KB, 1646x589px
>>
File: APL is easy.jpg (260KB, 730x1297px) Image search: [Google]
APL is easy.jpg
260KB, 730x1297px
>>
File: Boot the machine.jpg (96KB, 755x977px) Image search: [Google]
Boot the machine.jpg
96KB, 755x977px
IBM System 360 boot sequence in APL. The entire computer and its facilities were specified in APL before anything was actually built hardware-wise.

This was back in the days when things were ***FULLY*** engineered, not just "engineered" in the sense that somebody with a degree that said engineer in it somewhere drew up the PCB and then handed it off to China.
>>
>>52889356
basically just some random shit cobbled together by an amateur
>>
>>52883344
Its because of my lack of macbook. I must be too poor and like IBM & lower level code too much to understand more 'go' programming and other C based languages.
>>
>>52890525
What happened to new thread? Is it a conspiracy?
Thread posts: 331
Thread images: 37


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