[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: 323
Thread images: 32

File: DPG.png (389KB, 934x1000px) Image search: [Google]
DPG.png
389KB, 934x1000px
What are you working on, /g/?

>>57346388
>>
File: 1454648049697.jpg (481KB, 966x700px) Image search: [Google]
1454648049697.jpg
481KB, 966x700px
>What are you working on, /g/?

Doing hackerrank challenges so I can git gud

Most of these seem really hard unless you watch a video that gives you the solution
>>
>>57352851
2/10 pic
>>
Who /hyped for CoD4 remastered/ here?
>>
Looking at internship positions this summer, and this company is saying

"The ideal candidate should have some experience with C/C++, ADA, Python or similar programming languages."

I've already learned C and a little C++. Should I go into ADA or python next?
>>
Burn
>>
Are there any rust coders? What is an idiomatic way to chain Options or Results? Haskell has do-notation, what about Rust?
>>
Why is the forEach meme so popular in JavaScript, /dpt/?

We have 'let' now, we don't need to worry about scope anymore. Stop using forEach and go back to using a traditional for loop. REEEE
>>
File: 1454519011125.png (693KB, 742x1000px) Image search: [Google]
1454519011125.png
693KB, 742x1000px
>>57352881
Ada has a very small job market, you'd be better served with Python. I also hear Ada has a lot of boilerplate to it.

here's a leddit poast about it: http://cowlark.com/2014-04-27-ada/index.html
>>
>>57352872
it costs money and i'm a CS student so no.
>>
>>57352881
Learn Python. It is easy and useful.
And stay away from those who want you to learn Ada. Do you want to work for DoD?
>>
>>57352905
As much as I hate Javascript, functional/lambda programming has good sides
>>
>>57352872
>Paying $80 for a nostalgia trip
>Expecting to have fun in a game filled with whiny middle schoolers

L A D
A
D

The 3 MWs were the best CoDs (in chronological order), but 2bh senpai I don't think remastered is going to be as fun as OG CoD 4. The environment and the community as a whole is different. And also fuck paying for the new shitty cod just to get the remastered one.
>>
I have to color part of some letters. Is this not feasible unless I draw the letters. Before hand. Because I was hoping to make it not bound to a certain language.
>>
>>57352910
Thanks for user.post.isAnime() ===== 1
>>57352916
Thanks. Any good books or online resources for learning python?
>>
File: cia necker.gif (124KB, 95x79px) Image search: [Google]
cia necker.gif
124KB, 95x79px
>>57352344
>CIA niggers think they're people
>>
First for animay is not programming.
>>
Second for anime is programming and definitely NOT gay
>>
>>57352945
>tfw all those comfy HC SnD memories of noob tubing from spawn, spamming x3 nades over houses, and firing rockets down corridors

I just have to buy it, anon.
>>
>>57352905
>a traditional for loop
As a C# dev, I don't remember the last time I used one of these.

I literally haven't typed a "for" control statement in many months.
>>
if( op.image.isAnime() )
reply("Fuck you guys. Are you happy now? Would you also like me to put in the curly braces you faggots\n>>>/a/");
>>
File: 1454531188660.jpg (214KB, 600x620px) Image search: [Google]
1454531188660.jpg
214KB, 600x620px
Someone give me a C# project to work on today. I have some vyvanse

>>57352979
>Thanks for user.post.isAnime() ===== 1
>>
>>57353182
tic tac toe.
Its all youre good for
>>
File: intensifies.gif (133KB, 311x366px) Image search: [Google]
intensifies.gif
133KB, 311x366px
if(op.image.isAnime()==true)
op.thread.post(anime);
else if(op.image.isAnime==false)
op.thread.post(anime);
>>
>>57353182
A GUI that presents the user with 5 randomly selected posts from /pol/.

The user selects the most offensive.

Store the selected posts with their selection count in a database.

Present the top 100 most offensive posts on /pol/ within the last X time period.

This will require:
>usage of the 4chan API
>GUI in either web or desktop application
>communication from the client to a server
>storage of persistent data for measuring

I'd be willing to work on it with you if you get on Discord
>>
>>57353211
I like this idea.

I'd be willing to put my new React front end skills to the test.
>>
File: 1332048634947.jpg (24KB, 331x331px) Image search: [Google]
1332048634947.jpg
24KB, 331x331px
I am pulling this JSON file into my android app: https://localbitcoins.com/bitcoinaverage/ticker-all-currencies/

I want to get the value of GPB>rates>last as a double.
How can I access it using, for example, JSONObject?
https://developer.android.com/reference/org/json/JSONObject.html
>>
>>57353211
>Discord
Wish Hiro would fucking filter this already.
>>
How do I into programming? Im trying codecademy but I feel like it doesnt stick
>>
>>57353326
learn as you go,
Look up Louis Rossmann videos on Youtube, he has a great philosophy that you should only be learning that you need at the time.

https://www.youtube.com/watch?v=vAVbrm2lV_4
>>
>>57353272
Use Gson nigga.
>>
>>57353211

No, this will require:
>wget
>grep
>cat

Prove me wrong, faggot.
>>
>>57353326
READ A BOOK. Do exercises in the book. Then start making things.

CodeAcademy is godawful for everything but HTML/CSS (which is 100% just syntax) and its brief introduction to SQL. Pick a language. There are so many fucking languages where you can start from; just pick one. Hell, you can even go to plebbit and I'm pretty sure they have a long-ass list of actual non-meme resources outside of the usual listing of Zed Shaw's garbage.
>>
>>57353354
how are you going to select the most offensive post if you cant render images with wget.
>>
guys I almost got this string reversed, but it won't compile. It says "invalid conversion from char to char*". Also I'm aware that I suck. :>


int main()
{
//string someWord;
//cout << "Enter a Word" << endl;
//cin >> someWord;
//int n = someWord.size();

char *word = "hello";
int n = sizeof.word;

//strcpy(word, someWord.c_str());

reverse(word, n);
cout << word << endl;

//delete [] word;
return 0;
}

void reverse(char *str, int n)
{
if(n==0 || n==1)
{
return; //acts as quit
}
else
{
char i = str[0]; //1st position of string
char j = str[n-1]; //Last position of string
char temp = str[i];
str[i] = str[j]; //Swap
str[j] = temp;
reverse(str[i+1],n-1); //*str++ ????????????????????????

}
}

>>
>>57353400
>
reverse(str[i+1],n-1);
>>
>>57353400
>reverse(str[i + 1], n - 1);
str[i + 1] is a char, reverse's first argument is a char*
>>
>>57353365
ill start with this.

http://openbookproject.net/thinkcs/python/english3e/
>>
>>57353446
>>57353441
so I just change it to *str[i+1]? Or would it be *str(i+1) instead?
>>
>>57353463
Downey's a shitty teacher but at least you're off CodeAcademy
>>
>>57353374

Damn, that's an issue..

Maybe 50% the number of answers + 50% a score of words on a blacklist?
>>
>>57353468
I now get invalid type argument of unary ‘*’ (have ‘char’) reverse(*str[i+1],n-1); //*str++

-So I need it to take a pointer, but when I feed it one it then says '*' is invalid.
>>
>>57353400
>>57353468
str[i+1] is a char. You're pulling an element for an array of characters.

Also this is why you should stick with imperative programming faggot.

The algorithm is simple. No need to make it complex by using shitty tail call recursion

void reverse(char *str, int n)
{
for (int a=0; a<n/2; a++)
{
char temp = str[n-1];
str[a] = str[n-1];
str[n-1] = str[a];
}
}
>>
>>57353481
you didn't feed it a pointer. if you want a pointer to x you write &x
>>
>>57353492
        char temp = str[n - a - 1];

Accidentally screwed that up. Or instead you can do
for (int a=0, int b=n-1; a<n/2; a++,b--)
{
char temp = str[b];
str[a] = str[b];
str[b] = str[a];
}
>>
>>57353468
neither
*str[i + 1] means "dereference the pointer which is the i + 1 element of str". str is an array of characters, not pointers.

*str(i + 1) means nothing.

First understand what you actually want to do, then ask how to do it. Think about what you logically want to pass to the next recursion of reverse(), and then ask how to do that in C. You need to understand WHY you use things, not just copy paste C code until something works.
>>
>>57353471
you get what you pay for. (nothing)
>>
>>57353167
if (op.image.isAnime()) reply("[...]");

I cured cancer
>>
>>57353347
>>57353272
nvm got it.
json.getJSONObject("GBP").getJSONObject("rates").getDouble("last")
>>
>>57353167
>if( op
POO
O
O
>>
File: learnmeahaskell.jpg (68KB, 720x960px) Image search: [Google]
learnmeahaskell.jpg
68KB, 720x960px
This came in the mail today.
>>
>>57353570
>if( op
What's wrong with that?
>>
>>57353591
>he fell for it
>>
>>57353602
yup :)
>>
help!! I need a computer scientist!!

I have a 9x9 array which represents a tic tac toe board.

problem: map the array so that it element 0 maps to (1,1), element 5 maps to (3,2), and so on...

no IF statements allowed.

i can get rows with this,
row = Floor( box / 3 ) + 1

but i cant figure out how to get columns.
>>
>>57353592
"if" is a fucking word and in english, we put a fucking space after each fucking words.
>>
>>57353628
> 9x9
i meant a 9 length array
>>
>>57353628
I had a similar problem when I wrote my sudoku generator and solver.

I made helper functions out the ass.
>>
>>57353647
i need to keep this as simple as a formula that takes in the index and tells me which column it maps to
>>
>>57353628
think about how the % operator could help you
>>
>>57353628
(x,y) -> 3*(y-1) + (x-1)
>>
>>57353628
>>57353635
>computer scientist

This is elementary algebra.

 0 | 1 | 2
---+---+---
3 | 4 | 5
---+---+---
6 | 7 | 8


If you have index n, then you get
row = floor(n / width)
col = n % width

(NB! I use 0-indexed rows and columns).

For example, element at index 8 has row 8/3 = 2 and col 8%3 =2

Element at index 3 has row 3/3 = 1 and col 3%3=0
>>
>>57350364
>>57346388
The source is Mesu-Nized Festival. Please enjoy.
>>
>>57353720
nice try anon, but the question asked for non 0 rows,cols

row = floow(n/width) + 1
col = n % width + 1

are the right answers

nice try though.
>>
>>57353326
Read "How to Design Programs"*. Then learn pick up a manual or tutorial for any language you feel like learning. Apply the principles from the first book to the language in the second. Enjoy.

* May be supplemented with other texts such as SICP, Little/Seasoned Schemer, etc.
>>
Any tips for working on the heap in C? I get the feeling my code isn't as good as it could be but I don't know how to do any better.

I've spent the last three weeks writing a linked list database in C. I wrote it initially for a junior developer position (got the job), but since then I've been working on it to make it do more.

I'm refactoring it, replacing arrays on the stack with dynamic arrays on the heap, but now I feel a little overwhelmed.
>>
>>57353793
ganbate oniichan
>>
>>57353793
>spending three weeks implementing a linked list

I hope you are trolling, son. Otherwise you have no business working as a junior developer.
>>
>>57353772
>nice try
I wasn't aware that this was some sort of quiz and that I needed to answer anon's task perfectly. I was merely giving him a hint.
>>
>>57353790
looks like a good read, thanks dude.
>>
>>57353810
OK bad phrasing.

I wrote the linked list in a few days. Since then I kept thinking about it so I came up with a plan, but now I'm full of doubt.
>>
>>57353841
Have you considered Information Systems as a career path?
>>
>>57353841
>wrote the linked list in a few days
Hmm.
>>
>>57353841
>I wrote the linked list in a few days
You're not doing yourself any favors here.
>>
>>57353793
>>57353841
I've spent the last three weeks writing a linked list database in C

struct linkedlist
{
int x;
linkedlist *next;
}

??????
>>
>>57353748
Worst doujin ever
>badly drawn
>degenerate gay fetish
>awkward story telling and unrealistic character personalities

Kys.
>>
>>57353879
lmao
>>
How do you catch a LOT of possible invalid inputs? Say I have a window with a combobox and 4 textboxes for a C# program and a target userbase I KNOW needs to be stopped from doing as much dumb shit as possible (making exception of course for the inevitable cases I never prepared for); do I have a try/catch with a gigantic if/else or switch statement? Multiple try/catch statements just for input?
>>
>>57353865
unless you have a typedef its
struct linkedlist *next;
>>
>>57353886
validate your input,

you fucking cuck.
>>
>>57353912
thanks.

Forgot how shitty C is.

No wonder it took a junior developer 3 weeks to make it
>>
>>57353912
Is there a reason not using typedef?
>>
>>57353865
I don't see what's wrong with taking a few days to write a linked list?

You don't simply create the data structure, you need to set it up so the user can access and modify it, save it, load it. You need to decide what data the list will store, how it will be presented.
>>
>>57353930
Short answer: No

Longer answer: It depends on whether or not cluttering up the global namespace with arbitrary user types is desired.
>>
if i need to prune rows in libreoffice calc that have any cell containing a value outside of a given range, is there a built in way of doing this, or do i have to actually write a macro for it? ive got a 1000 or so potentially dirty records i need to clean before they can be processed, so simply selecting the offending records manually is gonna take the piss a bit.
>>
>>57353930
I think typedef can be confusing. Just use 'struct' so other people know it's a struct.
>>
File: attention-grabber.webm (3MB, 640x480px) Image search: [Google]
attention-grabber.webm
3MB, 640x480px
best java IDE? in particular i need it for stuff with webRTC and something in the cloud, don't know if it's relevant

thanks
>>
>>57353942
>I don't see what's wrong with taking a few days to write a linked list?
Because it should take a maximum of 20 minutes in any given language of choice, except assembly where 50 minutes should be doable.

>You don't simply create the data structure, you need to set it up so the user can access and modify it, save it, load it. You need to decide what data the list will store, how it will be presented.
See above.
>>
>>57353960
>cloud
What did he mean by this
>>
>>57353960
For a dyke, she really know how to handle a big pair of balls
>>
>>57353966
Sorry but I can only assume you're envious because I actually have a job.
>>
>>57353930
it obscures the actual type (see: Linux kernel C style guide - 'typedef is evil')

Overused it can cause more confusion.

Where it is really useful is definitions like uint32_t, where it isn't just an alias to remove a few characters ('struct', 'enum, etc.) and the real type varies by platform.
>>
>>57353996
>junior developer
>needs days to write a linked list
Not envious (and not jealous either, which is the word you're looking for).
>>
File: 1475177772868.png (734KB, 720x540px) Image search: [Google]
1475177772868.png
734KB, 720x540px
>paste
    const auto mvp = std::array<float, 16>{{
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
}};


>tell editor to auto indent the region
const auto mvp = std::array<float, 16>{{
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
}};


Only a liberal would call this an improvement.
>>
what are you cucks arguing about?

implementing a linkedlist is as easy as
import java.util.LinkedList
...
new LinkedList<T>()
>>
>>57354034
He said implementing, not using.
>>
>>57354025
>move inner curly braces to before, after the data
>tell editor to auto indent
const auto mvp = std::array<float, 16>{
{1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0}
};
>>
>>57353886
Input masking
Look for what you want to accept and reject everything else

also

just fucking tell us what you're actually trying to do
>>
>>57354013
Why? Do you have a job, or are you preoccupied living with your mom criticizing people on the internet?
>>
>>57354045
whats the difference?
>>
>>57353975
>>57353978
can you just tell me if eclipse is good or there are better, more light options
>>
>>57354079
Making it from scratch
>>
>>57354013
Actually, it would be envious.

Please educate yourself.
>>
>>57354102
https://www.youtube.com/watch?v=Tmx1jpqv3RA
>>
>>57354108
Were you trying to support my post with this video?

If I ask someone
>Are you envious of my penis/job/car/?

That is correct, because I would be asking if that person desires something I have. That is envy.
>>
>>57354088
why would you? people smarter than you have already created a solution, so use it.
>>
>>57354177
I have some experience writing firmware for PICs. I haven't written anything that uses stdlib or PICs before. The company I applied to asked me to make a database to show I can use stdlib/the heap since their microcontrollers do use it.
>>
>>57354204
*stdlib or the heap
>>
>>57354076
>Why?
Why I'm not jealous? Isn't that obvious?

>Do you have a job
Yes

>or are you preoccupied living with your mom criticizing people on the internet?
You sound butthurt.

>>57354177
Making things from scratch is a great way of proving that you know how said things actually work. There's a reason why you're being asked to reverse a string in-place in interview.
>>
>>57354218
I don't believe you have a job.
>>
>>57354102
>Please educate yourself.
Okay, thank you for correcting me.

>>57354153
>Were you trying to support my post with this video?
That's a different poster.... Not every post is made by Gary.
>>
>>57354235
I don't really care what you belive or not, my original point is that if you find it in any way shocking that people are able to implement a linked list in C in less than 20 minutes, you obviously lack experience in C programming (and programming in general).
>>
>>57354239
It takes less than 20 minutes to check the dictionary.
>>
>>57354218
but you can cram for those things, you can read a bunch of books on programming interview exercises and you would increase your chances at getting hired but that doesn't mean you can think like a programmer.
>>
>>57354239
I only corrected you because you went out of your way to smugly correct that other anon.

It's just silly to correct someone if you're:
>not 100% certain
>it doesn't really matter anyway
>>
>>57354265
Well, that is why whiteboard programming in interviews are a controversial topic and by many considered a waste of time.

Nevertheless, the mentality behind (if you're able to implement X you understand X) is the reasoning behind why they ask you to do this stuff.

>>57354258
It also takes less than 20 minutes to masturbate. That doesn't mean that I feel like doing that all the time.
>>
Python3 is being weird... whenever I try to import something with a docstring, the shell says 'SyntaxError: """ '
Aren't docstrings (stuff written between triple quotes) supposed to be ignored?
>>
>>57354289
Speak English on my level, scrub.
>>
Ok, I'm a NEET but I don't need money. Should I still try to get a job?
>>
>>57354394
Yes. Work gives life meaning.
>>
>>57354394
In most situations being NEET is unsustainable. So either that, or kys.
>>
My first ever program.

import random

count = 0
comp_count = 0
rules = ('''choose 1 for rock
choose 2 for paper
choose 3 for scissors

game is best 2/3''')
list = (1, 2, 3)
print (rules)
print()

while True:
comp_choice = random.choice(list)
print()
user_choice = input('user selection: ')
user_choice = int(user_choice)

if user_choice == 1:
if comp_choice == 2:
print('computer wins paper beats rock')
comp_count += 1
elif comp_choice == 3:
print('you win rock beats scissors')
count += 1
else:
print('you both chose rock')

if user_choice == 2:
if comp_choice == 1:
print('you win paper beats rock')
count += 1
elif comp_choice == 3:
print('you lose scissors beats paper')
comp_choice += 1
else:
print('you both chose paper')


if user_choice == 3:
if comp_choice == 1:
print('comp wins rock beats scissors')
comp_count += 1
elif comp_choice == 2:
print('you win scissors beats paper')
count += 1
else:
print('you both chose scissors')

if comp_count == 2:
print('computer won 2/3')
break
elif count == 2:
print('player has won 2/3')
break
else:
continue


I feel like this could be achieved so much nicer and easily.

How does someone go from coding something so simple to something like a bit torrent client (my ultimate I want to make this thing)?
>>
>>57353953
anyone?
>>
>>57354071
combobox is 3 job request options. 3 of the 4 text boxes are going to take in a state/city/town. The last text box is going to take in a number between 1-10. The user can't submit anything unless all boxes have content, i.e., a request is selected, the location text boxes are filled, and a number within the specified range is input.

I know the logic for catching each individually, but I don't know how to deal with all of them sequentially.
>>
>>57354502
use regex lol
>>
>>57354531
(You)
>>
File: anal beads.png (28KB, 1379x245px) Image search: [Google]
anal beads.png
28KB, 1379x245px
var dptThreads = Range(1, 10)
.SelectMany(page => Chan.GetThreadPage("g", page).Threads
.Where(x => x.Posts.First().Subject?.ToLower().Contains("dpt") ?? false))
.Select(x => x.Posts[0].PostNumber)
.Select(x => Chan.GetThread("g", x))
.ToList();

var posts = dptThreads.SelectMany(x => x.Posts).ToList();
var triggerCount = posts.Where(x => x.Comment.IsProfane()).Count();
var animeCount = posts.Where(x => (x.Comment ?? "").Contains("anime")).Count();

WriteLine($"Found {dptThreads.Count} /dpt/ threads, with a total post count of {posts.Count}.");
WriteLine($"{triggerCount}/{posts.Count} of these posts contain profanity, which basically means this entire place is offensive.");
WriteLine($"Up to {animeCount} autists are complaining about anime. It might be one really dedicated faggot, though.");


>>57354502
Super simple solution: you have a single method that is called when you click the submit button, something like
ValidateInput();


This method calls your 4 individual validations all at once and if any of them return false, the ValidateInput() method returns false and you show your error.
>>
>>57354470
u gon need abstraction and knowledge of network programming.
>>
Does anyone else think that it's easier to ignore exception in C++ altogether, use return codes and not to worry about exception safety?
>>
>>57354580
its much faster too
>>
>>57353960
intellij idea
>>
>>57354585
Not really.

>>57354580
Easier, no. Exceptions ensure that acquired resources, such as locks and mutexes, are released and breaks execution where the error actually happened, instead of having to nest yourself all the way out.
>>
>>57354542
Makes sense. Thank you, Pajeetslayer.
>>
>>57354580
Exceptions are all about locality of error handling. The term 'exceptions' and how they are taught is done poorly.
>>
>>57354627
It's also worth noting that you could tie a validation to the event of losing focus, or clicking out of a text box.

That way, if you type "ASSFAGGOTS" into the State field, and hit tab or click out of the box, you'll immediately show the user that ASSFAGGOTS is not a known state.
>>
>>57354580
Use an exception monad and you can do it yourself
>>
>>57352902
For Result you have try!. Chaining Options isn't typical in Rust, but you do have methods like map and and_then (bind) that you can pass a lambda to.
>>
>>57354580
Simpler, yes. Easier, debatable. Also potentially less efficient.

>>57354585
Sometimes exceptions are faster.
>>
>>57352902
They have .map{_err, _or, _or_else}, .and{_then}, or{_else} methods.

.map_* takes the inner value, applies a closure and wraps it in Option/Result, .and_*/.or_* take another Option/Result and chain them, e.g.
Some(2).map(|v| v*v|).and(None).or(Some(80085))
results in Some(80085)
>>
>>57352902
>>57354741
>>57354788

Maybe is just Either (), so Option<a> is just Either<(), a>
So you can just use the unit type as your error type, then use try notation ... (and if you need to, write functions to convert it to the built in rust option type) ... I assume, I don't use Rust.
>>
>>57354821
Whoops, I mean Option<a> is just Result<(), a>
Either is what Result is called in Haskell
They both work exactly the same in terms of mapping and binding, and algebraically:

Maybe a = Some a | Nothing
Either b a = Right a | Left b
Either () a = Right a | Left () ~ Right a | Left
>>
Anons, I think we should all take a moment to appreciate the humble kludge.

1200 cases and this one case doesn't work quite right? Kludge it and move on.

One device brand out of millions has that one thing that doesn't work quite right? Kludge it.

One particular region is so cuckolded that their ISPs literally block offensive requests? Kludge it!
>In January 2014, files used in the online game League of Legends were reported as being blocked by some UK ISP filters due to the names 'VarusExpirationTimer.luaobj' and 'XerathMageChainsExtended.luaobj' containing the letters used in the word "sex"

What have you kludged recently, anon?

Today I wrote out 28 possible misspellings of an email domain, because one specific user is clinically retarded and cannot type their domain in correctly. Now, if they fuck it up, it just autocorrects to the right domain! Thanks, Mr. Kludge!
>>
>>57354854
Is this post automatically generated or what?
>>
>>57354821
I think the Rust philosophy on this topic is that chaining syntax is only worthwhile for error handling, and if you're doing error handling you should use Result<T, ()> (or a more descriptive error type) rather than Option<T>. So for methods that give you an Option where you want to treat None as an error, you use ok_or which maps it to a Result. Option is reserved for when it isn't necessarily a bad thing to get back a None.
>>
>>57354868
No, I just typed that out.

Why would you think that, anon?
>>
anyone have the latest version of the challenge roll image?
>>
At your uni (assuming you're studying CS), how often do you need to prove your results?
All of them, most, some or none?
>>
>>57354879
Clearly, you're an advanced AI tryign to trick me.
>>
>>57354894
What do you mean "prove your results"?
>>
>>57354876
For example
fn find_index_of(needle: i32, haystack: &[i32]) -> Option<usize>
>>
>>57354924
Exactly.
>>
>>57354854
>>57354868
>>57354879
>>57354895
He means bodge.
https://www.youtube.com/watch?v=lIFE7h3m40U
>>
>tfw Microsoft is creating the greatest language of our time

Microsoft has announced that Visual Basic will add the "Ain't" keyword to the language. According to a source on the VB.NET team "With VB, we want the language to work the way you think. Extensive usability studies have demonstrated to us the benifit of adding Ain't to the language."

Addition of the keyword would allow such syntax as:
If ThisThing Ain't Nothing Then


According the source "We're just trying to keep up with advances in the English language which, as you know, is changing almost as fast as technology itself." The VB team believes that ain't is poised to finally be a fully supported keyword in the English language, and they feel that if they don't include the keyword in this release, they may fall well behind English before their next chance to update VB.
>>
>>57354976
Why not just "is not"...
>>
>>57354919
I mean providing a formal proof along with your solution to prove that your solution to the problem is correct.
>>
>>57354876
I don't really think an exception should be necessarily thought of as "a bad thing", it doesn't necessarily have to be an error. It's an exceptional circumstance, which might be an error. (one would hope all errors are exceptional, however)

There's a page on it here: https://wiki.haskell.org/Error_vs._Exception

Imho, it would be better in Haskell if Maybe were just a type synonym (and Some and Nothing pattern synonyms)

But anyway, the idea is that you could have two functions that convert between Maybe and Either (), and then since you don't have do notation, you could use the try syntax for result and then convert it to an option at the end
>>
>>57355000
witnessed

In my experience, Visual Basic is popular with redneck programmers
>>
File: 1311763499070.jpg (16KB, 300x354px) Image search: [Google]
1311763499070.jpg
16KB, 300x354px
>>57354976
I'm getting too old for this shit.
>>
>>57355000
Hotly debated is what "Ain't" should equate to. In it's most popular form, the above line of code would translate to:

If ThisThing Is Nothing Then


However, everyone's 2nd grade english teacher has made it clear that "Ain't Nothing" actually means "Is Something", as it's a double-negative. Meaning the correct equivelant would be

If ThisThing IsNot Nothing Then


Microsoft is in no hurry to rush through this decision, state sources, "Look, between VB.NET Beta 1 and Beta 2, we had to change the definition of "true". We don't want to go through that again."
>>
>>57355014
We're not talking about exceptions. Rust doesn't even have exceptions outside of panics.
>>
>>57355012
I only did this in the discrete mathematics class (obligatory) and in the parallel processing modelling class, (an electable) where it was a learning requirement.
>>
>>57355041
Result is an exception
>>
>>57355039
Python is the only language that got it right:
if thing is not None then:
>>
>>57355041
>>57355049

Also, you can probably implement do notation with rust macros
>>
>>57355045
Interesting. I expected there to be more proof oriented mathematics in CS.
>>
File: 1459487295667.png (249KB, 340x314px) Image search: [Google]
1459487295667.png
249KB, 340x314px
>>57354976
If me.carModel Ain't model

fuckin jej
>>
File: assI.png (10KB, 565x179px) Image search: [Google]
assI.png
10KB, 565x179px
>>57355063
>>57355000
>>57355016
It's a joke article from 12 years ago.

http://web.archive.org/web/20050308014055/http://ea.3leaf.com/2004/08/vb_adds_aint_ke.html

>those comments
>they knew VB was shit compared to C# TWELVE YEARS AGO

>August 22, 2004 12:05 AM
>Can someone please throw in GodDammit? Also, I was thinking about a new shortcut - you type in yoru code in C#, then type HowTheFDoesVbDoThisAgain and hit tab - and then it's filled in for you.
>>
>>57355087
It is if you go the theoretical computer science route.

I didn't, most of my electable courses would be considered in the domain of computer engineering because that's where my interests lay.
>>
>>57355049
I didn't read that page but I don't agree with it now that I have. I do agree with this definition:
>I don't really think an exception should be necessarily thought of as "a bad thing", it doesn't necessarily have to be an error. It's an exceptional circumstance, which might be an error.
Which coincides with e.g. the C++ notion of exception just fine. Rust panics kind of conflate the idea of exception with error, though.

Result<T, E> is either Ok(T) or Err(E). The semantics are that Ok(T) represents success with a result and that Err(E) represents a failure with information about the error.

Result<T, ()>, Either<(), T>, and Option<T> are all equivalent from a mathematical point of view but they're not necessarily defined to be the same thing and they don't carry the same semantics. Either and Option are "unbiased", so to speak (Haskell only makes Either a sort of canonical error type because of how type constructors and type level currying work), but Result has the connotation of representing the result or error information of an operation that might fail.
>>
If programmers were required to mathematically prove their solutions, the average development cycle would be about 50 to 200 years.
>>
>>57355128
If programmers knew how to mathematically prove their solutions, they'd be much better programmers, even without having to prove their solutions.
>>
>>57355128
That's why proof assistants and dependently-typed languages exist. Your program IS the proof.
>>
>>57355142
This. We need to rethink programming from scratch.
>>
>>57355142
This is observably false, as applied mathematics publications often contain formal proofs, but the source code they link to is often suboptimal, buggy and often non-performant.

Mathematicians are good at maths and mentally visualising how their algorithms work, but they do not understand how modern computers work and are just as prone as anyone else to make n00b mistakes.
>>
I need a little help with some PHP/MySQL.

I'm trying to write a function that will retrieve the names of all tables in a database, and assign them to an array that I can use elsewhere in my project.

Seems like a simple enough task, and I've looked around a fair bit, trying a couple of different solutions, but everything I've tried so far does not work.

What do?

function get_tables($db) {
$conn = new mysqli('localhost', 'root', '', $db);
if ($conn->connect_error) die($conn->connect_error);
$query = "SHOW TABLES;";
$result = $conn->query($query);
if (!$result) die($conn->error);

// ????

$result->close();
$conn->close();
}
>>
File: 1471388749853.png (2MB, 3840x2160px) Image search: [Google]
1471388749853.png
2MB, 3840x2160px
>>
>>57355156
>he thinks proving your programming is a new concept
See lambda calculus and early computer programs.

There's a reason why we abandoned that stuff and rely more on exhaustive testing instead.
>>
>>57355156
Why are there even colleges that teach mathematics without requiring proofs for everything?
Is it because they need the money?
>>
>>57355166
All anon said was that a programmer that knows how to prove properties will be a better programmer for it. Not that mathematicians are good programmers.
>>
>>57355175
Because 90% of the industry is made up of morons that can hardly pass CS even now that it's hardly CS?
>>
>>57355166
This is because the people publicizing these papers aren't actually programmers, which is the part of my statement that you're ignoring.
If *programmers* knew how to prove their solutions, they'd be better programmers.
>>
>>57355190
You missed my point about formal proofs not taking to account stuff modern computers do, such as caching, pipelining, instruction sequencing etc.

>>57355188
There are mathematicians, and then there are engineers.
>>
>>57355188
Why aren't mathematics teach from the most basic axioms to current concepts?
>>
>>57355206
>If *programmers* knew how to prove their solutions, they'd be better programmers.
See >>57355211

>>57355204
CS != programming
>>
>>57355175
Kys asap please.
>>
>>57355233
?
>>
>>57355127
Even though exceptions aren't necessarily errors, all errors are exceptions
I don't really see this as any different to saying that find functions should instead use a different type called Occurence because it's clearer
>>
>>57355225
I disagree. CS is/should be programming.

>>57355211
I wish it was illegal to be an engineer without knowing anything about mathematics.
>>
>>57355206
>no *TRUE* Scotsman
>>
>>57355238
>There's a reason
>exhaustive testing
You are a meme.
>>
>>57355250
Oh look, a fallafag
Notice the way he completely misunderstands human communication, and confuses all conversation with logical syllogism
>>
>>57355211
Can you boil your algorithm's cache efficiency down to a meaningful yes/no answer? I can't think of a situation other than when you're trying to meet deadlines in real time software. And guess what? We use proofs for that.

>>57355243
I disagree. It's not particularly exceptional to get improperly-formatted input from the user, for instance.
>>
>>57355211
Proving stuff is the difference between carefully thinking about whether your solution is correct and doing stuff via trial and error.
I can assure you that most good programmers (and likely even engineers) that write good and correct code come up with informal proofs in their mind, even without knowing how to prove it formally.
This is good enough already, but what I'm suggesting is that it might be better to teach people to prove things, so they don't start working on everything via trial and error.
It being formal would just be a neat side effect that provides a bunch of other things to the people learning it.
There's a limit to using a debugger and trial and error.
I can see it increasing the barrier of entry (for a degree, for instance), though.

>>57355218
At my uni, they do, and require you to prove everything along the way.
>>
>>57355265
Also, formalizing specifications and their proofs is great documentation.
>>
>>57355247
Math's a prerequisite to engineering isn't it?
>>
>>57355250
>programmers would be better programmers if they could prove things
>you're wrong, there are mathematicians that are bad programmers
>that doesn't make sense
>LE FALLACIES!!!
>>
>>57355256
Exhaustive testing is not a meme, anon. It has been done by hardware people for ages, and now software people are finally catching up.

>>57355261
>Can you boil your algorithm's cache efficiency down to a meaningful yes/no answer?
My point isn't exclusively to cache locality, but more that there computer systems are inherently indeterministic (see halting problem) and this is a real problem when it comes to proofs.

>>57355258
> confuses all conversation with logical syllogism
We are literally discussing formal proofs here.
>>
>>57355309
Testing isn't a proof.
>>
>>57355309
>there computer systems are inherently indeterministic (see halting problem) and this is a real problem when it comes to proofs.
Are you implying you can't prove termination? Because that's plain wrong.
>>
>>57355265
>I can assure you that most good programmers (and likely even engineers) that write good and correct code come up with informal proofs in their mind, even without knowing how to prove it formally.
Well, I don't argue this. All I'm saying is that formally proving your software isn't good for anything, except maybe this: >>57355281

>This is good enough already, but what I'm suggesting is that it might be better to teach people to prove things, so they don't start working on everything via trial and error.
But trial and error is how every hard science works, and this is how engineers and physicists etc work. Computer systems and programming them are in the domain of engineering, not in the domain of pure mathematics.

But I agree that being able to do so can have benefits, such as arguing why an algorithm that works for N samples will work for all samples (or, alternatively, why it won't work even though it works for N).
>>
>>57355336
Not saying it is.

>>57355350
>Are you implying you can't prove termination? Because that's plain wrong.
Publish a paper on how you've solved the halting problem then.

And no, I am implying that you can not account for involuntary context switches in a proof for a computer system that runs concurrent processes.
>>
File: IMG_1577.jpg (91KB, 1000x800px) Image search: [Google]
IMG_1577.jpg
91KB, 1000x800px
Guys, microsoft certified languages are your only viable career option
I just finished my C## visual course, I'm laughing at you neckbeard so and your dumb functional languages and proofs. Haskell and lisp don't even have gotos and for loops.
>>
>>57355365
The halting problem is saying that you can't write an algorithm that looks at an arbitrary program and arbitrary input and determines that it will terminate or not.

This is incredibly pathological and has no bearing on whether a programmer can prove the termination of a specific algorithm.
>>
>>57355366
If you're going to false flag, generally you try to portray a believable caricature of the party that you're trying to smear.

Kill yourself.
>>
>>57355365
>>57355393
And no, obviously you can't prove that you will meet real time deadlines on a non-real time OS. There's so much out of your control on e.g. Windows and Linux that you can't prove things about performance but it would be incredibly short sighted to generalize to all formal verification of all kinds of specifications based on that fact.
>>
>>57352945
>he 3 MWs were the best CoDs
nope
CoD2, MW1, CoD and worth mentioning is United offensive all else is dorito fatty tier
>>
>>57355261
>I disagree. It's not particularly exceptional to get improperly-formatted input from the user, for instance.
I'd say it is, because you expect properly formatted input.

Haskell's Either type isn't explicitly "Exceptional" either - it's clear that Either A B represents Either an A or a B. If you think about try and catch, they're just different binds.

It is more limiting to explicitly use "Result". It's obscuring, too.
Result doesn't imply anything whatsoever. Either does, Except does.

Result could be almost any monad - almost all of them have "results" - it doesn't describe what the extra structure actually is.

>>57355309
discussing, not syllogising

>>57355366
callCC
>>
how do I git gud at c and c++?
All this .NET is turning me into a pajeet and I don't like it
>>
File: Really_Makes_You_Hmmm.png (3MB, 1058x999px) Image search: [Google]
Really_Makes_You_Hmmm.png
3MB, 1058x999px
>>57352910
Ada has a LOT of boilerplate
>>
>>57355393
>This is incredibly pathological and has no bearing on whether a programmer can prove the termination of a specific algorithm.
While this is true, my point wasn't really about the halting problem, but more about how indeterministic and complex computer systems are.

In many cases they are even too complex to accurately model. For example, in the field of computer networking, network simulations are always considered second best to actual tested implementations, because of how flawed networking models are.

I mean, top notch computer scientists can't even accurately predict how a relatively simple algorithm, such as TCP NewReno, behaves under given circumstances.
>>
>>57355434
>how do I git gud at x?
Do x until you want to kill yourself
>>
>>57355436
Ada is cute
>>
>>57355352
Computer systems (read: regular target platforms, excluding stuff like aviation) are *a lot* more deterministic than hardware systems.
That's an advantage, it allows you to reason about the system a lot more clearly than about a regular hardware system!
Why not use that advantage instead of still resorting to trial and error, as if you're still dealing with a highly nondeterministic system?
Also, I'm not specifying whether proofs should be formal or informal here, I think people that can keep the complexity of an informal proof in their mind while programming are definetly good enough.
>>
>>57355416
>it would be incredibly short sighted to generalize to all formal verification of all kinds of specifications based on that fact.
Well, this is a forum for posting image macros and discussing taiwanese tapestry, after all.

I will admit that I may have been too hasty about dismissing it. In my defence, it's mostly related to my own experience when it comes to attempting to model network systems (see >>57355443) and the common meme posted on /g/ that if you don't know mathematics to an extensive degree, you are somehow a bad programmer and generally a suboptimal form of life.
>>
>>57355426
>Result doesn't imply anything whatsoever. Either does, Except does.
enum Result<T, E> {
Ok(T),
Err(E)
}


>>57355443
>this thing doesn't help in some cases so why even bother with it at all
The great thing about proofs is assumptions. Instead of saying "this program will always halt" you can say "assuming no cosmic bit flipping, this program will always halt" and the users of your program can draw their own conclusions based on how likely they think a cosmic bit flip is to happen.
>>
File: cs grad reverse string'.png (90KB, 1000x749px) Image search: [Google]
cs grad reverse string'.png
90KB, 1000x749px
https://github.com/AtrusHB/PNG_steganography
How CS grad is my code?
>>
>>57355436
Holy fuck that PNG is unoptimized.

I have optimized your PNG for you.

Your PNG is now optimized.
>>
>>57355475
Yes, the names of the constructors imply something, and it's a lot more limiting than it needs to be. The name of the type doesn't imply anything.
>>
>>57352902
>Are there any rust coders?
I don't get this question. What would Rust "coders" be doing on 4chan?
>>
>>57355475
>>57355465
You both have good points.

>>57355465
You need to clarify what you mean by "regular target platforms" because I don't understand.
>>
>>57355487
CS grads will think this macro is talking about the first post
>>
>>57355365
Well, you're still saying testing is a valid substitute to formal verification. It's indeed faster and less costly but it's pervert: it's now almost impossible to build a new model on top of this tech mess.
>>
>>57355497
If you wanted to really have Either, you would make Either. It's isomorphic to Result but it carries a different connotation.
>>
>>57355474
I was suggesting that generally programmers that can formally prove their algorithms will be better programmers than ones that cannot, because they verifiably learned how to prove things.
Programmers that cannot provide a formal proof either come up with good informal proofs or resort to mostly trying random stuff until it works (read: pajeet).
Teaching people to formally prove things also teaches them to reason about their code.
A good maths course is essentially a course about expressing logic, not about learning a bunch of formulas and algorithms by heart.
>>
>>57355497
>>57355538
https://crates.io/crates/either
>>
>>57355507
There are certain computer systems that are more prone to nondeterminism than others.
Most devs however don't work on systems like these, so I excluded them from my statement.
For systems that are very prone to nondeterminism, exhaustive testing is obviously often more viable than relying on formal proofs.
>>
>>57355538
It's more general, I don't think such a common case needs such a specific term

As I said earlier, should the various different ways of finding an element in a container be called Occurence?

Even then you could be using synonyms/aliases rather than entirely new definitions
>>
>>57355487
>
if (loggingEnabled)
{
herp = fopen("herpcarrier.log", "w");
derp = fopen("derpcarrier.log", "w");
}


>
FILE *herpderp;


>
int fexist(

(If you make one for s, that's problematic.)
>>
>>57355566
How often is Either used in Haskell for something other than the result of an operation that can fail?
>>
>>57355526
>Well, you're still saying testing is a valid substitute to formal verification
It is in the case where formal verification is impossible, which I argue are in most cases.

After all, testing is extensively done in all forms of science.

>It's indeed faster and less costly
Actually, it's not.

>but it's pervert: it's now almost impossible to build a new model on top of this tech mess.
This is where you are very wrong. Every time you build on top, and previous tests still pass, you know that you haven't accidentally introduced a new bug or regression bug.

>>57355541
I agree, but formal testing raises the bar for people like me who are bad with formal mathematics, but have a good methodical approach to development. You may argue that I may have some form of method of coming up with an informal proof in my head, I think it boils down to being methodical and thorough combined with knowledge about the subject.
>>
>>57355589
A bit, actually, and even that is being generous with the word "fail"
>>
File: 1473472946378.jpg (121KB, 681x767px)
1473472946378.jpg
121KB, 681x767px
Is there a good way to keep track of how many times a recursive function is called without using global or static variables?

I'm trying to store a bunch of values that I get from traversing a tree into an array, but I can't figure out how to make sure it goes into the correct index in the array.
>>
>>57355714
You were given several good solutions last night you chucklefuck.
>>
>>57355747
kys

>>57355714
Yes, there is.
Thanks for posting anime
>>
File: IMG_1771.png (460KB, 800x600px)
IMG_1771.png
460KB, 800x600px
>>57355747
yeah, but I thought i had it working with the static variable, and now it's fucked again, and I didn't have the thread saved
>>
>>57355785
Take a closer look at the OP.
>>
I somehow managed to kludge my way through getting a C++ job at a semi big company as a C only person.

So I hate myself right now but now seriously learning C++ and trying to keep an open mind not wanting to kill myself learning it.

Any hints on how to keep myself sane writing modern C++ while still having the mindset to program in C?
>>
>>57355785
>>57355714
....

int funcThing(int a, int counter = 0);
{
counter++;
if (a == 0)
return counter;

return funcThing(a--, counter);
}

myThing = funcThing(20);


how about this
>>
>>57355871
Learning sepples, kek.

>Any hints on how to keep myself sane writing modern C++ while still having the mindset to program in C?
>Sepples
>Sane

Choose one, m8.
>>
>>57355871
You can't. Nobody can.

[coude]
template<typename S, typename P, typename V >
inline
S
as_string(P sprintf_like, S s, const typename S::value_type* fmt, V a)
{
typedef typename S::size_type size_type;
size_type available = s.size();
while (true)
{
int status = sprintf_like(&s[0], available + 1, fmt, a);
if ( status >= 0 )
{
size_type used = static_cast<size_type>(status);
if ( used <= available )
{
s.resize( used );
break;
}
available = used; // Assume this is advice of how much space we need.
}
else
available = available * 2 + 1;
s.resize(available);
}
[/code]
>>
>>57355871
Stop being autistic is the only advice I can give.

I used to also like being low level. But I realized that writing C++ code is more powerful in terms of abstraction. Learn how to abstract. Learn it. Live it. Love it.
>>
>>57355452
She's pretty cute
>>
>>57355914
Nice. I just wanted to get back to modern C++ (C++14).


I think I'll start learning dlang deeper and keep using FreePascal for some tasks.

The shit you posted literally kills the programmer upon long term exposure.
>>
File: PythonDScover.jpg (9KB, 162x199px)
PythonDScover.jpg
9KB, 162x199px
What does /dpt/ think about this book?
>>
>>57355980
D fell for the C++ meme
>>
>>57355914
template<typename S, typename P, typename V >
inline
S
as_string(P sprintf_like, S s, const typename S::value_type* fmt, V a)
{
typedef typename S::size_type size_type;
size_type available = s.size();
while (true)
{
int status = sprintf_like(&s[0], available + 1, fmt, a);
if ( status >= 0 )
{
size_type used = static_cast<size_type>(status);
if ( used <= available )
{
s.resize( used );
break;
}
available = used; // Assume this is advice of how much space we need.
}
else
available = available * 2 + 1;
s.resize(available);
}


ftfy
>>
>>57356139
>Python
>>>/thrash/
>>
File: python.png (630KB, 2000x1334px) Image search: [Google]
python.png
630KB, 2000x1334px
>>57356201
>>
>>57356225
Stupid snek lang
>>
>>57356230
pls no bully snek
>>
File: kirk.png (92KB, 628x858px) Image search: [Google]
kirk.png
92KB, 628x858px
>>57356201
>thrash
>>
>>57356225
>>57356267
I like python though but every single book on this language is retarded and should only be used as winter firewood.
>>
File: 1473000931289 (1).png (137KB, 251x384px)
1473000931289 (1).png
137KB, 251x384px
>>57356253
fuck your shitty languag
>>
>>57356225
>fangs
>rattle
not python snek
>>
Imagine actually liking the Python __SCRIPTING__ language
>>
>All of the calculations in the range coder must use bit-exact integer arithmetic.
What did they mean by this? Is there some integer arithmetics that go "eh, a few bits here or there makes no difference"
>>
I envision a language that's also a logic, i.e. in writing a program you are proving the proposition described by its type. That's not a new idea, but my contribution is that whenever you make any assumption that can't be internally proven, e.g. that adding two 32-bit machine integers is commutative, it gets listed when you build the project. They can then be subjected to tests or simply trusted.

The point is complete transparency at least, unlike e.g. in Rust where you can simply have an unsafe block and the reasoning behind it being okay is not necessarily clear.
>>
>>57356560
but dependent types already do this

>dependencies

f :: add_comm -> ...
>>
>>57356585
You need some way to get that to then call the function, though. Either you can prove it or you can postulate it.
>>
File: dependent types.png (7KB, 224x225px) Image search: [Google]
dependent types.png
7KB, 224x225px
>>57356600
Write the compiler in the language and then the compiler can provide the proof
>>
Sick of /dpt/ being racist.
>>
File: spicy.png (110KB, 360x360px)
spicy.png
110KB, 360x360px
>>57356370
But anon, I like snakes
>>
>>57356639
That would involve making lots of things part of the language.
>>
File: anal beads.png (21KB, 213x821px)
anal beads.png
21KB, 213x821px
>when you go look at the censor code and you can't stop laughing long enough to make the changes

This is just so hilariously bad. Who ever thought censoring was a good idea?
>>
Trying to triangulate a polygon, way harder than I thought.
>>
I need some FUN genetic algorithm project ideas QUICK!!!
>>
>>57356682
suck my titties tushy tub girl
>>
>>57356682
censor code for what?
>>
>>57356690
Generate random botnet code
>>
>>57356690
generate a waifu
>>
File: dfs.png (1MB, 1920x1080px) Image search: [Google]
dfs.png
1MB, 1920x1080px
Write a JS script that counts all the words in a thread and lists them from most-used words to least-used words, /dpt/.
>>
>>57356664
Nope
>>
>>57356774
>Write a JS script
Sorry, I'm straight
>>
>>57356775
How else is the compiler supposed to provide a proof? And how would that proof be constructed?

I don't see how it's better for the compiler to make the assumption instead of the library/application developer.
>>
>>57356682
Looking at that list, a thought strikes me. Censors must have the dirtiest minds.
>>
>>57356682
>towelhead
>tranny
>tribadism
sensible chuckle
>>
>>57356774
Well, I've got nothing else better to do.
>>
>>57356830
Ok, I'm bored already. I got this far:

var blockQuotes = document.getElementsByTagName('blockquote');
var blockQuotesArray = Array.from(blockQuotes);

blockQuotesArray.forEach(function(elem, index) {
console.log(elem.innerText);
});


Maybe someone else can finish it off.
>>
>>57356774
That would require me to implement a vector of some kind and I don't feel like it.
>>
>>57352823

If user.post.isAnime():
userPostIsAnAbine = True
Elif :
userPostIsAnAmine = false
Else:
Print error
If userPostIsAnAnime == True:
Print u r a faggot


Sent from my iPhone.
>>
File: anal beads.png (27KB, 871x297px) Image search: [Google]
anal beads.png
27KB, 871x297px
>>57356774
>Javascript script

In C#:
var dptThreads = Range(1, 10)
.SelectMany(page => Chan.GetThreadPage("g", page).Threads
.Where(x => x.Posts.First().Subject?.ToLower().Contains("dpt") ?? false))
.Select(x => x.Posts[0].PostNumber)
.Select(x => Chan.GetThread("g", x))
.ToList();

var posts = dptThreads.SelectMany(x => x.Posts).ToList();

var combinedPosts = Concat(posts.Select(x => x.Comment.FormatFourChanPost() + " "));

var commonWords = Regex.Split(combinedPosts.ToLower(), @"\W+")
.Where(s => s.Length > 3)
.GroupBy(s => s)
.OrderByDescending(g => g.Count());

commonWords.ForEach(x => WriteLine($"{x.Key.PadRight(25)}: {x.Count()}"));
>>
>>57356802
No, a compiler for that platform, within the language
>>
>>57356937
I want something in JS so I can just press F12 and paste it into the console, nice and simple.
>>
>>57356959
You didn't address any of those points.
>>
>>57356973
You make a virtual machine and then use the output made for that
>>
>>57356992
I could get the same result by simply not using the machine integers and just using something I can express entirely constructively with the language.

But that's inefficient.
>>
>>57357012
No, you use the machine code output made for the virtual machine
>>
>>57356893
Guess you'd need an array of all the words desu.

var blockQuotes = document.getElementsByTagName('blockquote');
var blockQuotesArray = Array.from(blockQuotes);

var wordArray = [];

blockQuotesArray.forEach(function(elem, index) {
wordArray = wordArray.concat(elem.innerText.split(' '));
});

console.log(wordArray);
>>
>>57357020
Assuming that the machine integer add instruction is commutative.
>>
File: anal beads.png (58KB, 729x739px) Image search: [Google]
anal beads.png
58KB, 729x739px
>>57356962
>not having MemeChan open at all times for maximum shitposting

Do you even i like this retarded and there's a shitty c?
>>
>>57357022
Isn't it autistic to use global variables?
>>
>>57357036
If the actual machine doesn't match the virtual machine then neither will the output

What are you even trying to complain about?
>>
>>57357067
Nothing. I was just musing and you suggested something dumb.
>>
Is there anything recommended I can read if I want to learn how to make a basic raycast like game (not really interested in the game aspect, just want to learn how to do it).
>>
>>57357084
http://lodev.org/cgtutor/raycasting.html
>>
>>57357084
Look up "bisqwit doom engines"
>>
>>57357114
Awesome, thanks!
>>
>>57357071
Your original suggestion was dumb.

I gave you a good idea. If you WANT to put your proven program onto a machine, then write a virtual machine and write a compiler for it... within the language. Then you know it matches the virtual machines specifications.
>>
>>57357121
Yeah, I actually follow him already. Saw that video forever ago. He's pretty damn talented.
>>
>>57357138
>Then you know it matches the virtual machines specifications.
Pointless unless you know that the real machine is equivalent to the virtual machine. And now you're back to the original issue.
>>
>>57357121
His wasn't a raycaster if I remember correctly, it was more like Duke Nukem 3D.
>>
>>57352823
Working my way through the Project Euler problems.
>>
>>57357043
What's the correct way then senpai?

Something like this?

var blockQuotes = document.getElementsByTagName('blockquote');
var blockQuotesArray = Array.from(blockQuotes);

var words = (function() {
var _wordArray = [];

function add(words) {
_wordArray = _wordArray.concat(words.split(' '));
}

function get() {
return _wordArray;
}

return {
add: add,
get: get
}
})();

blockQuotesArray.forEach(function(elem, index) {
words.add(elem.innerText);
});

console.log(words.get());
>>
>>57357155
Yeah my mistake, still VERY informative though
>>
>>57357149
>Pointless unless you know that the real machine is equivalent to the virtual machine.
What are you even trying to get at?

You know the machine code will only perform as expected on a machine that fits the description.

What more do you want?
>>
>>57357176
POO was a mistake
>>
>>57357189
There's no way around assuming that or at the very best testing it to some degree, so I figured it would be nice if the language had a feature to make the "external" judgements more visible.
>>
>installing PlayStation 2 ISOs to IDE harddrive over USB
>attempt to load up program to install them (HDL Dump Helper GUI)
>its written in java
>have java 8 install
>refuses to run because no JRE 6/7 and finding JRE 7 is a chore and fuck Oracle
>WinHIIP, an ancient and actual Windows program, still works fine to this day

Why would you ever made something with Java when it can be deprecated the moment it isn't maintained?
>>
>>57357212
I do not know how to explain this to you
>>
>>57357236
To be fair, that's not unique to Java.

Visual Basic literally changed the value of "true" in one of the early updates to the language.
>>
>>57357176
Just stop now what you're doing Pajeet and learn C
>>
>>57357212
>>57357240
ok how about this

the output is machine code

nothing is stopping anybody from putting that machine code on the wrong machine
>>
File: Cvko-t1UsAA53zE.jpg:large.jpg (162KB, 1280x844px) Image search: [Google]
Cvko-t1UsAA53zE.jpg:large.jpg
162KB, 1280x844px
NEW THREAD AT >>57357273

NEW THREAD AT >>57357273
>>
>>57357281
That's why it's important to clarify the assumptions made.
>>
>>57357176
Should remove punctuation before add the words to the array.

Also, maybe an object would be better.
>>
>>57357292
... yes, which is done by the fact it has a dependency in its type
>>
>>57357311
See >>57356600.
>>
>>57357316
I literally told you that you compile it within the language
The compiler for that platform, written within the language, provides the assumptions, or possibly even the vm that you describe your program with

then it gives you the machine code output


what are you doing
>>
>>57353400
that's pretty fucking bad code
>using c style strings
>no null terminator

faggot.
>>
Who is the girl in OP pic and why isn't it Lain instead?
>>
>>57357880
Senjougahara from Guilty Crown
>>
>>57357339
I think you confused him with the word assumptions. The word you mean to use is axioms. Those are suppositions.
>>
>>57355785
what are archives
Thread posts: 323
Thread images: 32


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