[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: 337
Thread images: 35

File: 1490212703797.jpg (182KB, 764x650px) Image search: [Google]
1490212703797.jpg
182KB, 764x650px
What are you working on, /g/?


Previous Thread: >>59800214
>>
>>59804801
First for D
>>
Second for C is technically an interpreted language.
>>
>>59804870
Third for every language can be interpreted or compiled.
>>
>>59804779
>>59804793
Try this.

#include <iostream>
#include <string>

using namespace std;

string play(string p1, string p2) {
string result = " ";

if (p1 == "rock") {
if (p2 == "rock") {
result = "Draw!";
}
if (p2 == "scissors") {
result = "Player 1 wins -- Rock breaks scissors";
}
if (p2 == "paper") {
result = "Player 2 wins -- Paper covers rock";
}
}

if (p1 == "scissors") {
if (p2 == "scissors") {
result = "Draw!";
}
if (p2=="paper") {
result = "Player 1 wins! -- Scissors cuts paper";
}
if (p2 == "rock") {
result = "Player 2 wins -- Rock breaks scissors";
}
}

if (p1 == "paper") {
if (p2 == "paper") {
result = "Draw!";
}
if (p2 == "rock") {
result = "Player 1 wins -- Paper covers rock";
}
if (p2 == "scissors") {
result = "Player 2 wins -- Scissors cuts paper";
}
}

return result;
}

int main() {
string p1, p2;

cout << "Play rock, paper, scissors\n";

string goOn = "yes";

while (goOn == "yes") {
cout << "Player 1: ";
cin >> p1;

cout << "Player 2: ";
cin >> p2;

cout << play(p1, p2) << "\n";

cout << "Do you want to continue? (yes or no): ";
cin >> goOn;

cout << goOn << "\n";
}

return 0;
}
>>
An Angular APP. JavaScript is the future.
>>
>>59804870
Oh boy, I'd like to see you justify this
>>
>>59804961
It's interpreted in the same sense as HTML is. The HTML interpreter takes a HTML file as input and generates a bunch of stuff to appear on your screen. The C interpreter takes a C source file as input and generates a bunch of stuff to write into an object file.
>>
9th for 'monad' is another name for an object and funcfags are using OOP every day while being too dense to realize it
>>
>>59804870
First for "compiled" is a subset of "interpreted"
>>
>>59805017
Anything with dynamic dispatch is an object (including functions) and FP fags are perfectly fine with that especially considering its a much better framework than OOP.
Also monad isnt a thing, its a classification.
>>
when I look at code it seems everyone has fancy notation for their variables. You see function variables with leading underscores and different acronyms defining different types.

Do all projects just have their own standards about variable naming or is there actually some community standard out there I should get familiar with?
>>
>>59805017
Nice try, you clearly don't understand monads but are desperate to try to make OOP stay relevant.

PROTIP: if you have to water OOP down to the point that "everything is an object!!", then OOP doesn't mean anything at all.
>>
>>59804915
Disgusting, define a type for rock/paper/scissors instead of using string everywhere.
>>
New /dpt/ challenge: write a program that accepts arbitrary input, and reports whether the input is a monad.
>>
>>59805075
Take that up with google or the anon I'm responding to. I don't know all the restrictions or the template for the play function. As such I'm working with the limitations at hand.
>>
>>59805091
Were you dropped on your head as an infant?
>>
>>59805055
https://01.org/linuxgraphics/gfx-docs/drm/process/coding-style.html
>>
File: 1460274412996.png (327KB, 717x539px) Image search: [Google]
1460274412996.png
327KB, 717x539px
>>59805121
thanks familam
>>
>compile very poorly coded game on ICC
>fix boost, fix boost more, fix problems in const translation, fix templates
>finally compiling
>32gb of ram
>out of memory
>>
i tried writing an operating system in haskell and it broke my computer

i press the power button and nothing happens, also there's a faint burning smell but now ive unplugged it at the wall

i knew this paradigm was janky ... i never should of given it a chance
>>
>>59804870
It can be, but generally speaking, no.

>>59805001
The process of compiling is not called interpreting. A language is called "interpreted" if there is no intermediate step in the program's execution. That is to say, the source code is the program. A language is called "compiled" if the source code is used to create the program. So for instance, some object code or bytecode is generated, and that is what gets executed.
>>
Is writing a lexer in C the ultimate beginner project? I just finished mine and I'm so proud of myself and I learned so much about pointers and file/stream handling.
>>
>>59805155

First of all, you should be testing your program in a virtual machine before you test it on real hardware. Second of all, post your source. Maybe you shouldn't have your kernel be doing crazy things like turning off the fan and overclocking the CPU.
>>
>>59805212
Pretty sure he's baiting, buddy.
>>
String s = "/r <someWord> text"
how do i turn someWord into its own string and remove it from s?
>>
>>59805110
>haskeks think this constitutes an argument
>>
>>59805230
Pretty sure he's baiting, buddy.
>>
>>59805259
s2 = s[s.index("<") + 1 : s.index(">")]
>>
>>59805194
Good start, write it in Assembler next time.
>>
Why are games the only things that are fun to program?
>>
File: 1463606423970.gif (152KB, 400x267px) Image search: [Google]
1463606423970.gif
152KB, 400x267px
Can learning algorithms revive a dead interest in programming?
>>
>>59805323
>>>/v/

>>59805336
learn FP
>>
>>59805336
Learn Lisp.
>>
>>59805344
I didn't say that games are fun to play, turbo nerd.
>>
File: 1425932943838.png (340KB, 665x662px) Image search: [Google]
1425932943838.png
340KB, 665x662px
>fooling around with opengl
>glfw window + nothing else = 100mb ram usage In Java
>glfw window + nothing else = under 10mb in C++

how does this even happen?
>>
If you use anything other than Java and Python you need to get a life or get used to being unemployed
>>
>>59805370
That's what happens when people without running water script "programs".
>>
>>59805370
Curry munchers that don't understand how to use malloc,calloc,realloc,new and delete/free
Pls garbage collect me bcuz I can't be trusted
So now there's a gigantic overhead for all your garbage collection
Rinse and repeat for anything else curry munchers are too stupid to do
>>
>>59805377
Java is shit.
Python is shit.
>>
>>59805401
If you think the same of C and Scheme then you need to suck on a fat one.
>>
File: .jpg (102KB, 507x800px) Image search: [Google]
.jpg
102KB, 507x800px
Another version of my intcat.

/**
* SUMMARY: intcat concatenates a series of integers and prints the result.
* NOTICE.: Any negative integers passed will be made unsigned.
* ........ All decimals points, if existent, will be cut off.
* ........ Cannot concatentate any zeroes at the moment.
* ........ Will add an option, -z, that will let the user concatenate zeroes
* ........ at the expense of not checking if the input is indeed an integer.
*/

#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

#ifndef DEBUG
#define DEBUG 0
#endif

// Checks for must-kill errors
#define ERR_CHECK_K(cond, msg) {if (cond) {logerr(msg); exit(EXIT_FAILURE);}}

// TODO: Add valist
void logerr(const char *msg) {
if (!msg) {
msg = "No messeage set";
}

if (DEBUG) {
fprintf(stderr, "%s:%d %s\n", __FILE__, __LINE__, msg);
}

else {
fprintf(stderr, "%s\n", msg);
}
}

// Returns the number of digits in a
int intlen(long a) {
return (int)(floor(log10(a))) + 1;
}

int main(int argc, char *argv[]) {
ERR_CHECK_K(argc < 3, "Too few arguments\nUsage: intcat <integer> "
"<integer>");

const unsigned Num_Ints = argc - 1;
long lints[Num_Ints];

// Converts the string args to longs
for (int i = 0; i < Num_Ints; i++) {
ERR_CHECK_K((lints[i] = strtol(argv[i + 1], NULL, 10)) == 0L || \
lints[i] == LONG_MIN || lints[i] == LONG_MAX, \
"An argument is out of range or not an integer.");
}

long catint = labs(lints[0]); // Stores the result of the concatentation

// Concatenate
for (int i = 1; i < Num_Ints; i++) {
long b = labs(lints[i]), s = (long)(pow(10, intlen(b)));
// Check if the resulting concatentation will be too big
ERR_CHECK_K(s > (LONG_MAX - b) / catint, "Concatentation is too large");
catint = catint * s + b; // $500,000 starting salary
}

printf("%ld\n", catint);

return EXIT_SUCCESS;
}

/* Cirno and Lain a cute! CUUUUUTE!*/
>>
>>59805413
Are you trying to cover your bases before I say they're shit? Too bad, that won't help you.
>>
>>59805436
What isn't shit?
>>
>>59805390
Oh shut up. In a few years they'll kick us from our jobs because they'll be both cheaper and more qualified after they gain some experience.
>>
File: 1491586568196.jpg (766KB, 1416x1086px) Image search: [Google]
1491586568196.jpg
766KB, 1416x1086px
I'm working on a script that identifies all the greentext-abusers in a thread, links all the post numbers and appends "Who are you quoting?" to the line-seperated list of post numbers.
>>
I have a string with the format "/r <word> text"
How would I separate "/r <word> " from the string and put it into its own string?
>>
>>59805454
>identifies all the greentext-abusers
why
>>
>>59805469
Regex
>>
>>59805444
>Kick "us" from jobs.
>More windows 10s pop up on market
>Pajeet interfaces, some windows have no less than 5 different context menu styles
>Everything runs slowly and is full of bugs because Pajeet cannot compile in debug and profile
>C++ development stops entirely
>PajeetSTD written 2052
>>
>>59805454
I look forward to filtering your shit posts
>>
>>59805472
Not him but a lot of people who abuse "greentexting" are shitposters or feelsposters.
>>
>>59805472
People shouldn't use the quote feature without intending to quote someone, it's considered poor form!!!
>>
>>59805500
Are you new?
>>
>>59805454

Who are you quoting?
>>
>>59805510
Stop responding to him
>>
File: 1478151209559.png (2KB, 198x62px) Image search: [Google]
1478151209559.png
2KB, 198x62px
>>59805454
>>
>>59805510
the irony of not knowing the "who are you quoting" meme and asking if someone else is new
>>
>>59805474
how would i use that to get a word
>>
Hello anons, I want to learn how to create my own android apps. From what I've read I should learn the basics to Java. What's a good book and/or online course I can take? Preferably one that teaches it with the assumption that you're running Linux. I'd prefer to learn hands on rather than listening to lengthy lectures... CS50 wasn't very fun with all the videos.
>>
Clang has -O4, is this designed to absolutely break my program? I've heard of the dangers of -O3 from my GCC days.
>>
>>59805586
What language are you using, anon-kun?
>>
>>59805602
Java
>>
>>59805256
Character array. Take the indexes of the word, save it into a string.
>>
>>59805605
Post code.
>>
>>59805591
Thenewboston on youtube. Walks you through the basics.
>>
>>59805500
>why am I using so many exclamation points?
>>
>>59805513
Whom quoteth thou?
>>
>>59805668
messageOriginal = ((CPacketChatMessage) event.getPacket()).getMessage();


if (messageOriginal.startsWith("/pm ")) {
String privateMessage = "";


input would be like "/pm anon hello :3"
>>
>>59805684
Who is the source of the quote contained in your post?
>>
>>59805718
http://www.javatpoint.com/java-regex
>>
>/dpt/ thinks they're superior to Indian software engineers who have studied 12 hours a day, 5 days a week for 4 years with state-of-the-art equipment at top universities
>/dpt/ doesn't realize (or is willfully ignorant of the fact that) an Indian computer science freshman will have to write a bootloader and a compiler IN THEIR FIRST SEMESTER or fail their degree
>/dpt/ considers themselves better than such engineers... and it's all because the engineers have brown skin
Inferiority-superiority complex much?
>>
5,5
t. (you) bait for pepople calling you a pajeet
>>
>>59805805
i mean the unwarranted anger at Indians is clearly from unemployable /pol/tards but i don't think your first or second statements are true at all

nice bait though, you'll catch some idiots
>>
> studied 12 hours a day, 5 days a week for 4 years with state-of-the-art equipment at top universities
>compiling on same hardware
>scripting the same scripting languages
>>
>>59805718
Here's a regex example with grep:
input: echo /pm anon hello :3 | grep -oe "\s\w*\s"
output: anon
>>
what do you think lads
supposed NSA tools
https://github.com/x0rz/EQGRP
>>
>>59805941
Don't care nor am I going to dig through thousands of shell scripts and other bullshit hoping to find one thing that's useful for me.
>>
who here /code-let/
>take forever writing simple code
>can't wrap my head around monads
>>
>>59805960
monads allow for linear ordering of dynamic effects
so you can think of them as an abstraction of procedures
>>
>>59805983
explain more
>>
>>59805994
e.g.

perform task a
THEN perform task b

the "THEN" bit is the linear ordering
or strict ordering, I may be using the wrong word

the dynamic part that makes an applicative into a monad, is bind or join
(join can be expressed in terms of bind)

join takes a (m (m a)) and gives back a (m a)
i.e., you have your abstract procedure that returns a new abstract procedure
the dynamic monadic part is that you can then jump into that new procedure, in the same context, while if it were just an applicative, you couldn't

the type parameter / generic bit is so you can return an arbitrary "result", e.g. (m Int) or (m ())

for something like the list monad, you can imagine each effect as being "fork". e.g.

do
x <- [1,2] -- fork into two threads, in one x = 1, in the other x = 2
...
>>
File: 1451190682707.png (441KB, 1048x587px) Image search: [Google]
1451190682707.png
441KB, 1048x587px
Why do people hate Python?

Is it just special snowflakes who hate the language because it's noob-friendly and thus they can't feel special for writing FizzBuzz in C anymore?
>>
File: 1486803031004.jpg (25KB, 800x609px) Image search: [Google]
1486803031004.jpg
25KB, 800x609px
>>59806066
it is absolute garbage and i cant believe you used a picture of karen to defend it

you will pay for this
>>
>>59806040
ill understand this tomorrow
>>
>>59806066
its purely a front-end language.
>>
>>59806071
>claims it's absolute garbage
>no reasoning
Special snowflake detected
>>
>>59805989
seems pretty ridiculous can you just do something like String recipient = msg.("\s\w*\s"); ?

a regex tester says that it gets the recipient name with white space attached which is fine
>>
>>59806084
literal shit for brains detected
>>
>>59806074
It's not a systems programming language, but that doesn't make it a "purely front end" language at all. Do you even know what 'front-end' means?
>>
>>59806084
- slow
- no control
- made for intro to programming
>>
>>59806096
>still no reasoning
I'm guessing I offended your special snowflake sensibilities, you're this triggered
>>
>>59806091
Fuuuug I suck. Let's try this again:
Compiled and tested; it works.

import java.util.regex.Pattern;
import java.util.Scanner;
import java.util.regex.Matcher;

public class GetUserFromMsg {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);

System.out.print("Enter message: ");
String msg = sc.nextLine();

if (msg.startsWith("/pm")) {
Pattern pattern = Pattern.compile("\\s\\w*\\s"); // match words flanked by whitespace
Matcher matcher = pattern.matcher(msg);
// Get first result
if (matcher.find()) {
String recipient = msg.substring(matcher.start() /*the starting index of the username*/, matcher.end() /*the ending index of the username*/).trim();
// You now have the recipient's name.
System.out.println(recipient);
}

else {
/* ... */
}
}
}
}


It's been years since I wrote any Java.
>>
>>59806105
>Slow
Wrong.
>no control
No control over what? Because it's GC? Idiot.
>>
>>59806098
Its L I T E R A L L Y the language people use to front-end their projects.

You /can/ do non-front end work but you dont want to.
>>
why exactly do people call dynamically resizing arrays a 'vector'? Rust has it as Vec, C++ as vector, and Java even has a Vector class but not commonly used.

Who did this? It confused the fuck out of me when doing graphics since that's not what vector means.
>>
>>59806114
alt-c, lad
You can also highlight chunks and alt-c them.
>>
>>59806121
> >Slow
>Wrong
right. Python is interpreted, and that will always be slower than a compiled (or even JIT compiled) language.
>>
>>59806121
>wrong
http://benchmarksgame.alioth.debian.org/u64q/python.html

You are a retard for even trying to say Python is fast.

>No control over what? Because it's GC? Idiot.

This is exactly the attitude of a toddler who never used anything but Python.
>>
>>59806105
>made for intro to programming
So you don't like it because lots of people use it because the syntax is clean?

This makes you a special snowflake.
>>
>>59806121
>>Slow
>Wrong.
Python is the slowest mainstream language there is, only rivalled by Ruby.
>>
>>59806139
Jesus christ I'm retarded; thanks you anon. I should've figured that existed considering we have alt-m and ctrl-s.
>>
>>59806153
>This is exactly the attitude of a toddler who never used anything but Python.
This is exactly the attitude of some unemployable millennial special snowflake who thinks using C makes him smarter.
>>
>>59806160
or perl
>>
>>59806170
Perl has fallen into obscurity.
>>
>>59806169
C programmers make some of the highest salaries in Software, toddler. Now go on back to your webdev startups.
>>
>>59806182
>C programmers make some of the highest salaries in Software, toddler.
This is exactly the attitude of someone who writes FizzBuzz in C all day and thinks this makes him an embedded developer.
>>
>>59806128
Apparently the guy in charge of designing std for C++ named it that and now regrets it and I'm guessing Java followed suit just because why not and Rust too.
>>
>>59806114
thanks senpai this will work
>>
>>59806192
It's funny you keep resorting to fizzbuzz arguments when no one is posting fizzbuzz in C in these threads nor talking about them except you.

Insecure much?
>>
>>59806220
This is exactly the attitude of a special snowflake who thinks he's smart by virtue of his hipster language choice rather than inherent programming ability.
>>
>>59806227
Okay shitposter, have fun.
>>
>>59806227
>does personal attacks because he can't name any reasons why python is actually good
>>
>>59806220
>>59806227
Will you two stop arguing and shitposting? It's fucking stupid. Go put on stockings or whatever and program.
>>
>>59806234
This is exactly the attitude of a poster who has run out of arguments and has to bring out the old "shitposter" canard to save face when he clearly lost the debate.
>>
File: 1433698243654.png (29KB, 613x556px) Image search: [Google]
1433698243654.png
29KB, 613x556px
Can
free(ptr)
fail?
>>
>>59806258
freeing an invalid pointer will result in a program crash (technically UB tho)
>>
>>59806258
"Yes".
As in, if you pass it an invalid pointer (one not received from malloc or friends) or a pointer you've already freed, the behaviour is undefined, and the program will most likely crash.
free is not going to tell you about it, though.
>>
>>59806258
http://en.cppreference.com/w/c/memory/free
>>
>>59806258
>Can free(ptr) fail?
No, but it can cause your program to crash
>>
What's the preferred method of error handling in C?

Like if I fail a malloc should I just exit or return some failed status and let the caller decide if it wants to exit or repeat the same until someone fixes it or exits?
>>
>>I want to keep this in the same class but when i build i get build errors because it's expecting semicolons where there arent supposed to be

    private void getRecipientFromPM(String[] args) {
if (msg.startsWith("/pm ")) {
Pattern pattern = Pattern.compile("\\s\\w*\\s"); // match words flanked by whitespace
Matcher matcher = pattern.matcher(msg);
// Get first result
if (matcher.find()) {
String recipient = msg.substring(matcher.start() /*the starting index of the username*/, matcher.end() /*the ending index of the username*/).trim();
// You now have the recipient's name.
}
return recipient;
}


i put this at the top but i guess i did it wrong at the first line?
>>
>>59806294
It really depends on what you're trying to do, and the nature of the error. Here is my take on it:
If your program is "one-shot" (does something, then exits), just exit immediately. Trying to fluff around fixing shit is probably a waste of time, and is needless code complexity.
If you program is interactive, try and pass your error back to your input/main loop, and just try again later.
If you are a library, always pass the error back to the user. It's pretty damn rude for a library to quit/crash the program without a good reason.
>>
File: 1463396351307.jpg (65KB, 700x500px) Image search: [Google]
1463396351307.jpg
65KB, 700x500px
>Spend all day on Google CodeJam
>Can't even qualify

Just fuck my shit up
>>
>>59806367
The autism olympics are hardly relevant. I used to be pretty decent at them though and it got me a Google offer I used as leverage for another.
>>
>>59806367
>only 10k
who cares
>>
Wrapping my head around the C++ ecosystem, move semantics, perfect forwarding, and variadic templates.
>>
>>59806322
Compiled and tested.

GetUserFromMsg.java
import java.util.Scanner;

public class GetUserFromMsg {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
MsgParser msgParser = new MsgParser();

System.out.print("Enter message: ");
String msg = sc.nextLine();
System.out.println(msgParser.getRecipientFromPM(msg));
}
}


MsgParser.java
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class MsgParser {
public String getRecipientFromPM(String msg) {
String recipient = "";

if (msg.startsWith("/pm ")) {
Pattern pattern = Pattern.compile("\\s\\w*\\s");
Matcher matcher = pattern.matcher(msg);


if (matcher.find()) {
recipient = msg.substring(matcher.start(), matcher.end()).trim();
}


}

return recipient;
}
}
>>
How can I post code within a code box?
>>
>>59806418
{code}
{/code}
but [square brackets]
>>
>>59806395
The real benefit is contestants are often contacted by Google recruiters. Entry level offers at G at pretty hefty.
>>
>>59806429
>at G at pretty hefty.
Not if it means having to live in commiefornia
>>
Is there a javascript function/syntax/command/whatever to close the page it performs the script on?
>>
>>59806440
>>>/g//wdg/
>>
>>59806451
sorry
>>
>>59806437
Google provides housing compensations in SF
>>
>>59806460
It's all good, anon.
>>
>>59806465
>6
the money wasnt my point.
I wouldnt live in that shithole for 500k/y
>>
>>59806477
>
case 'a':
case 'A': billCalc (usrInput);

stop
>>
>>59806481
They have offices in Seattle too. West Coast is where tech jobs are, so it's worth moving out. Oregon's the cheapest though. Google offers are excellent negotiation leverage.
>>
>>59806396
C++11 was a magical time.
>>
>>59806498
>in Seattle
meh, i would do that
>>
>>59806415
I just copied the code into the else if (messageOriginal.startsWith("/pm ")) and it finally compiled

all I really needed was
             Pattern pattern = Pattern.compile("\\s\\w*\\s");
Matcher matcher = pattern.matcher(messageOriginal);


if (matcher.find()) {
recipient = messageOriginal.substring(matcher.start(), matcher.end()).trim();
}
>>
>>59806489
what did I do wrong? I thought using the char value for another method was fine
>>
>>59806500
It's such a massive language since I used it back when it was template OO hell. There's so many keywords and concepts that seem to be useful some of the time, but the interaction between them is really complicated.
>>
>>59806512
Java and C# best selling points are that their IDEs are excellent. I always know when my code is going to compile before I build it with Java. Check out intellij (free)
>>
>>59806512
Well I'm glad it's working now.
Hey, if you need further help, and this is a project hosted on github and the like, I'd be interested in contributing.

>>59806533
It really is. People talk about how easily C allows you to fuck up, but C++ is worse in my opinion. There's so much shit you can use and the implicit stuff really makes shooting yourself in the foot an easy task. I've moved to C for most of my efforts because of this. I'm scared of returning with C++14 and the future standard that's looming on the horizon.
>>
Wow I just did an interview problem that blew me the fuck out.

You get the width and height of a matrix, and a list of coordinates. With this, you have to compute the distance to the farthest point in the matrix reachable from all the coordinates you were given.

At first it seemed straightforward. I made a simple breadth-first search; starting from each given coordinate, I simply explored all the neighbors until I hit the boundaries of the matrix. Took me a while to re-figure out breadth-first search though... It's been a while.

OK, so I have a matrix of distances for every given coordinate... So what now? The question asked for the furthest point in the matrix in relation to every single starting point, not just one of them...

What I did was: for every point, select the smallest distance amont those computed in the breadth-first search phase. That way, I get the smallest distance of the point to any of the given coordinates. From that new "integrated" matrix of distances, I thought I could simply select the largest; that must have been the furthest point.

That solution failed the given test cases though... I don't know why. I ran out of time and couldn't fiddle with the problem any longer.

Anyone know how to solve this? It's really bothering me.
>>
>>59806577
"Effective Modern C++" seems like a lot of great info and it's scaring the hell out of me. I don't know if I trust C much over a restricted and reasonable subset of C++. I really tried to like Rust, for almost 6 years now since it looked really different. I know the language pretty well, but it's so goddamn unproductive and the ecosystem feels like I'm reinventing the rock.
>>
While you guys gloat over your console tech demos javascript is about to become enterprise-tier on the desktop app market.

What do you have to say for yourself?
>>
>>59806671
But Javascript is my favorite langauge.
>>
>>59806671
>desktop app market.
literally who?
>>
>>59806607
I don't follow the problem statement. What's the terminating condition?
>>
>>59805091

def is_monad? arbitrary_input
true
end


Since it was not specified what type of language the input comes in the form of, it stands to reason that any string of any length is a monad in some fictitious programming language.
>>
File: 2017-04-09_03.37.19.png (601KB, 1360x706px) Image search: [Google]
2017-04-09_03.37.19.png
601KB, 1360x706px
>>59806577
separating the /pm recipient and message allowed me to convert the text into meme font so i could do this to people

code for the meme font was taken from here: https://github.com/Wurst-Imperium/Wurst-MC-1.9/blob/master/src/net/wurstclient/features/mods/FancyChatMod.java

also this is private and my friend who made it actually knows what the fuck he's doing
>>
>>59806671
Browser tech is pretty cool but don't fool yourself thinking that WASM isn't going to create a upheaval in the next 18 months. JS will never be stable or fast enough for many applications. Data analysis, games, audio and video manipulation, and new ways to consume information. The web is successful because it is 0-install and easy updating. The web could be more successful without a broken inheritance model, insane type-coercion semantics, and a generation of library gluers who can't prepend characters to a string.
>>
>>59806114
What if the target has a name with a space in it?
>>
>>59806780
actually he tried to release it with a backdoor (that he fucked up) and someone unobfuscated it and put it on their github
https://github.com/DaMatrix/forgehax-source
>>
File: file.png (85KB, 373x237px) Image search: [Google]
file.png
85KB, 373x237px
>>59806710
Starting from the white tiles, compute the distance to the most distant point. The distance is calculated by moving horizontally and vertically (no diagonal movement).

You receive matrix size and the coordinates of the white tiles. For example:

7 5     # 7x5 matrix
2 # two white tiles
0 4 # white tile #1
4 3 # white tile #2


Output is the distance to the farthest tile:

5       # maximum distance


What I did was:

1. Depth-first search from each white tile, producing a matrix of distances from each white tile.
2. Iterate over those matrices, computing a new "integrated" matrix. The value for each point is equal to the smallest value for the same point among all matrices computed in (1).
3. Iterate over the "integrated" matrix, compute the absolute maximum value.

This algorithm computed 7 instead of 5 using the example above.
>>
>>59806780
mods, ban this under aged faggot
>>
>>59806641
When I first read Effective C++, my mind was blown. The biggest, and most helpful, thing I learned from it was that C++ is more like a union of languages than just one. It made so much sense and allowed me to not only take a new approach with my C++ programing standards but that of others too. I have to say though, I don't know if I can take a another mind explosion from Effective, but I'm going to have to eventually to keep up.
>Rust
I haven't tried Rust as I'm waiting to see if it goes further than it is now. Of course I say that even though it's been out forever. One day perhaps.

>>59806671
If they can speed Electron applications up and make JS safer, then I'm fine with them, and I'll take the time to learn how to build them. Until then I'll stick with making desktop programs the old fasion way.

>>59806780
I'm going to be honest with you anon: I kind of regret helping you now.

>>59806789
Usually if names are allowed to have whitespace in them, you address the usernames like this:
/pm "g anon" hello :3

Thus you would capture the quotations.
>>
>>59806808
>>59806883
:^)
>>
>>59806883
That's what I don't like about C++. It tries to be everything. I like C because it's an extremely simple language made out of simple building blocks.
>>
>>59805454
Sounds like a 30 minute project at most.
>>
s = 'dick'
while True:
print (n * 1000)
>>
>>59806951
s='dick'
while True:
print(s*1000)

can't even shipost properly
>>
File: Screenshot_20170409-101239.png (201KB, 720x1280px) Image search: [Google]
Screenshot_20170409-101239.png
201KB, 720x1280px
>>59804801
Is she right?
>>
>>59806066
It's garbage, like all dynamically typed languages.
>>
int main(int argc, char **argv)

>Daily reminder that argv is pointer to array of characters
>It is also pointer to pointer to character
>It is also a pointer to character pointer
>It is not a pointer to array of string contants
>It is also a 2-d chracter array of dimension
char[][]
>It is also your mum

Why is this language such a shit
>>
>>59806998
Which language are you talking about? I can come up with at least 10 languages based on this syntax...
>>
>>59806998

Argument vectors are a mistake. They're placed on the stack by the operating system, limiting how much data you can pass to the program. Many systems/terminals have additional arbitrary platform-specific limitations on top of that. There are so many switch styles and option-passing syntaxes it's amost impossible to deal with it in a sane way.

Use standard I/O streams for ALL program input, including configuration. Fuck Unix.
>>
>>59806807
Furthest point is an (x,y)? How is it determined? What is the example for the furthest point for white tile 1 and 2?
>>
Suddenly you wake up. Now your least liked language is now the norm, all other languages have now been deprecated, no longer updated and if it had any dependencies then they are now broken forever with their remnants in dark corners of the deep web..

How fucked are you?
>>
>>59807075
>How fucked are you?
I start on the path of language dev then.
>>
>>59807075
my soul will be dead but it's not like I can't pickup python
>>
>>59807033
>They're placed on the stack by the operating system
I don't see how placing a number and a pointer on the stack would limit the amount of data that can be passed. The actual data can still be on the heap.
>>
>>59806998
it's not about the language, it's about the programmers being shit

reminder this is a thing
http://wiki.c2.com/?ThreeStarProgrammer
>>
Here is KRC5 problem to print lines that match pattern?
#include<stdio.h>
#include<string.h>
#define MAX 100
int getLine(char *ar,int max);
int patternFound(char* ar, char* pattern);
int main(int argc, char** argv){
if(argc < 2)
return;
int c;
int lineNumber;
lineNumber = 0;
int i;
int x;
int n;
x = 0;
n = 0;
int printIndicator;
printIndicator = 0;
char p;
for(argc;argc > 1;--argc){
if(*++(*++argv) == 'x')
x = 1;
else if(**argv == 'n')
n = 1;
}
if(argc != 1)
return;
printf("Options %d %d\n", x, n);
char ar[MAX];
int found;
/* Exclude and found truth table
* Exclude Found Print
* 0 1 1
* 0 0 0
* 1 0 1
* 1 1 0
* This is what kind of logical operator ? This looks like !(Exclude && Found) */

/* This is actually Exclude^Found or Exclude!=Found */
while( ( c = getLine(ar,MAX)) >=0 && ++lineNumber){
found = patternFound(ar,argv[argc-1]);
(printIndicator = (x^(found!=-1)) && n)?printf("%d ",lineNumber):0;
printf("%s",printIndicator?ar:"");
//printf(n?"%d%s",lineNumber,(x^(found!=-1))?ar:"":"%s",(x^(found!=-1))?ar:"");
//printf("%s%d",(x^(found!=-1))?ar:"",n?lineNumber:0);
}

return 0;
}
int getLine(char* ar, int max){
int c;
while( ( c = getchar()) != '\n' && c != EOF)
*ar++ = c;

if(c == '\n')
*ar++ = c;

*ar = '\0';
return c;
}
int patternFound(char *ar, char* pattern){
char* i;
char* j;
char* k;
for(i = ar; *i != '\0'; ++i){
for(j = i, k = pattern; *k != '\0' && *k == *j; ++k,++j)
;
if(*k == '\0')
return (j -ar);
}
return -1;
}

>>
>>59806807
The furthest point will always be a corner. So check tiles in all 4 directions from each point, until you reach the edge of the matrix. Then do the same by going up/down or left/right. Sum the distance of these 2 steps and get the maximum outcome.
>>
>>59806785
>generation of library gluers who can't prepend characters to a string
kek
>>
>>59807075
>How fucked are you?
Not just me, the entire world is fucked and computing is now dead because nothing works.
>>
this is C
what the fuck does this syntax mean? (the declarations between the function arguments and the body)

static void
swapfunc(a, b, n, swaptype)
char *a, *b;
int n, swaptype;
{
if(swaptype <= 1)
swapcode(long, a, b, n)
else
swapcode(char, a, b, n)
}
>>
If you create a variable in the start function that you don't change through the rest of your function should you make it const or is that dumb? I never really see anyone do that.
>>
>>59807169
Not if you have 4 white tiles, one in each corner.
>>
>>59807551
Looks like K&R C
>>
>>59806066
>because it's noob-friendly
No, because it's whitespace dependent.
>>
>>59804801
What stockings should I buy to maximize my programming performance? Will any other clothing items help and, if so, which ones?
>>
>>59804870
>>59804896
nth for there exists no such thing as an "interpreted" or "compiled" language.
>>
>>59807624
don't forget to get a cock cage

I notice a significant increase in my performance when wearing mine
>>
>>59807624
>stockings
this only matters if you are sexy trap
>>
>>59807568

const in the body of a function is better than magic numbers, and it's also better than [spoiler]preprocessor directives[/spoiler].
>>
>>59807551
that looks retarded
>>
>>59807624
rainbow ones, that's for sure
>>
>>59807653
Yes, but it's overall a benefit, no? Does that mean I have to become a trap first? How do you recommend going about it, if so?
>>
>>59806066
>Why do people hate Python?
What people? How can you expect a genuine answer if you didn't even bother to specify who you were talking about. Just fuck off to your subreddit.
>>
>>59807652
Damn, I used the money I had to buy a dildo
>>
>>59807680
yes. be sexy trap. start hormones.
see:
>>>/lgbt/7985923
>>
>>59807551
It is C before ANSI you dumb fuck
>>
>>59807695
Is height an issue? I think I might be too tall. If so, what should I do?
>>
>>59807551
>>59807671
It's an obsolete (but still valid) way of defining functions before the prototype syntax was introduced. It's something you'll see from extremely old programs or extremely old programmers.
It's the reason that many C indent styles have the { on its own line for ONLY for functions, and on the same line everywhere else.
>>
>>59807551
Isn't that immediately obvious? To declare the types of a, b, n and swaptype. Why this is still in the standard: I don't know.
>>
>>59807709
how tall?
>>
>>59807706
Still valid in C11.
>>
>>59807717
Almost 6'4"
>>
>>59804801
This image needs to be updated, atmel and microchip are now the same company

also fuck assembly
>>
>>59807732
That would be considered a manlet. You're fine.
>>
Object detection with raspberry pi and pi camera module... I have a robotics competition.
>>
>>59807736
>Average male height
>172.2 cm (5 ft 8 in)

Are you sure, anon?
>>
>>59807732
Use proper units please
>>
>>59807735
Are you suggesting that people are unironically using assembly for more than microopimizations on those?
>>
>>59807742
>anon
what did he mean by this?
>>
>>59807748
No, I was suggesting that OPs image was suggesting that
>>
>>59807743
that would be about 190 centimetres
>>
>>59807761
Ok thanks
>>
@59807741
>Object
>>>/r/ibbit
>>
>>59807775
>@59807741
>@
>>>/t/witter
>>
>>59807785
What are you going to mean by this?
>>
>>59807761
The SI units are meters on millimeters.
REEEEEEEEEEEEEEEEEEEEEEE
>>
@59807807
>using "REEEEEEEEEEEEEEEEEEEEEEE" incorrectly
>>>/r/abbit
>>
>>59807807
If he was hypothetically in a vacuum, light would take approximately 0.63 microseconds to travel next to his body while he was standing up.

Does this answer satisfy you?
>>
File: 1423121490163.png (258KB, 549x560px) Image search: [Google]
1423121490163.png
258KB, 549x560px
What's a good anime to watch when you're high.
>>
@59807841
fuck off hippie
>>
>>59807841
Inferno Cop
>>
>>59807841
Akira

Or princess mononoke or in fact any ghibli movie
>>
@59807856
>hippie
Far from it.

>>59807857
>>59807870
I trust you guys implicitly.
>>
>>59805960
me too, bra. I may be simple, but all I want is to be considered a code monkey.
>>
File: 1376687099695.gif (2MB, 350x196px) Image search: [Google]
1376687099695.gif
2MB, 350x196px
>>59804801
>intern walks in
>can't even print pi to the nth decimal
>>
namespace vowelchecker2
{
class Program
{
static void Main(string[] args)

{
string inputString = "I LOVE TACOS"
//need to go into the other method to get the resulting strings and bring them up here for other calculations
}

public static void separation ()
{
//take inputSrting do shit to separate vowels and consonants,then create a string of the vowels only and a string of the consonants only. ((i already wrote this code, but it is too long to include))

Console.Writeline(myVowels)
//outputs: IOEAO
Console.WriteLine(myConsonants)
//outputs: LVTCS
}


how to get a string created in one block and use it in another block?
>C#
>>
>>59802825
if(condition1)
{
if(condition2)
{
statement2;
continue;
}
statement1;
}


>In this example, will continue skip statement1 if condition2 is met?

You're so stupid I'm actually replying to a 10 hour old post.
continue
jumps to the next iteration of the nearest enclosing LOOP statement.
If isn't a loop, so break and
continue
have no effect, unless your if also lives inside a loop.
>>
>>59807841
Hidamari Sketch, or at least that's what one anon did.
>>
File: 1491299243518.jpg (38KB, 362x346px) Image search: [Google]
1491299243518.jpg
38KB, 362x346px
What is the most redpilled programming language?
>>
>>59808085
ASM
>>
>>59807807
he gave the value in pow(10,-2) meters. what is the problem?
>>
>>59808085
What is "redpilled"?
>>
File: 1462716265601.png (64KB, 180x236px) Image search: [Google]
1462716265601.png
64KB, 180x236px
>>59808098
Most definitely not.
>>59808149
Watch the movie called "The Matrix".
>>
>>59808191
>Most definitely not.
Abstraction is the blue pill - some fancy lies and assumptions, that hide the truth. Knowing, what actually is happening with the machine, is the red pill. Therefore red pill is Assembly.
>>
Any machine learning masters here? Working on implementing a CNN for duplicate question detection and I think I've bitten off more than I can chew

I've got my data all pre-processed and vectorized but I don't really understand how to actually build a convolutional layer in tensorflow/python or how many I should have or any of that part of the program really
>>
File: 14617586434690.jpg (65KB, 482x361px) Image search: [Google]
14617586434690.jpg
65KB, 482x361px
>>59808279
Assembly is itself an abstraction.
The only acceptable languages are either machine code or SKI combinator calculus (with a processor which directly executes it).
>>
>>59808334
assembly maps directly to machine code you dumb cunt.
>>
>>59808334
>machine code or SKI combinator calculus
Neither of those are languages.
>>
>>59808344
so it's an abstraction
calling people names doesn't make you right you know
>>
>>59806807
I think you can do it without any graph searches. I'm not 100% sure though. If you're interested I can elaborate.
>>
>>59808358
A one to one mapping is not an abstraction. That's what we call a language.
>>
File: 1456263830582.png (646KB, 1280x720px) Image search: [Google]
1456263830582.png
646KB, 1280x720px
>>59808344
Meaning it's an abstraction, which in turn means it's the very definition of being a bluepill language.
>>59808350
Both of them are languages actually. Do you by any chance think that lambda calculus is somehow not a language as well?
>>59808373
>That's what we call a language.
>we
That's not what it means to be a programming language. Unless you have a processor which directly executes assembly without translating it to some other form, it's an abstraction.
>>
>>59807075
>visual basic everywhere
>>
>>59808382
Abstraction is an arrangement, that reduces complexity by "hiding" certain details of an implementation and providing a simplified, idealised interface. A one to one mapping does not.
>Do you by any chance think that lambda calculus is somehow not a language as well?
Nope, it's just a stupid meme.
>>
any professional programmers here?
as in, you live off of programming.
programming sounds pretty interesting, but how do you make a living out of it? what is your average day on work like? where do you work?
how's the salary? is it easy to get a job? what programming language is best to learn as a professional programmer?
>>
File: 1489350942924.jpg (64KB, 620x720px) Image search: [Google]
1489350942924.jpg
64KB, 620x720px
>>59808528
>Abstraction is an arrangement, that reduces complexity by "hiding" certain details of an implementation and providing a simplified, idealised interface.
What a retarded definition, no wonder someone who speaks a mongrel dialect of English would think that. By your definition something which is at its core more simple (machine code) is somehow more complex than any high level language which compiles to it.
>A one to one mapping does not.
You don't seem to understand what "one to one mapping" even means. It's synonymous with compilation. Which means even the necessity for it clearly shows that it's merely an abstraction.
>Nope, it's just a stupid meme.
How can a programming language be a "meme"? Your retardation is showing.
>>
>>59808591
>By your definition something which is at its core more simple (machine code) is somehow more complex than any high level language which compiles to it.
The simpler the language the more complex is any implementation in it. I was talking about that.
>It's synonymous with compilation.
Not really. Higher level languages use compiler-level optimisations, which are, of course, compiler-specific. Therefore, the same C can map to many possible ASM outputs, as an example. ASM -> machine code translation is one to one on any compliant compiler.
>How can a programming language be a "meme"?
Haskell exists and is very efficient at being one.
>>
>>59808591
>How can a programming language be a "meme"?
Why would a programming language be exempt from meme status?
Also, calling lambda calculus a programming language just seems incorrect. Do you call a Turing number a programming language? Do you call second order logic a programming language?
>>
>>59805164
Is Python interpreted? Python isn't run directly, the interpreter is essentially a stack machine and Python code is transformed into a sequence of op codes before being run, so by that definition it's not interpreted
>>
>>59808738
Lambda calculus IS a programming language
With second order logic it's more context
You can directly translate second order logic into a typed lambda calculus (I forget which type system) and you'd call that a language
>>
File: 1486503004985.jpg (27KB, 480x580px) Image search: [Google]
1486503004985.jpg
27KB, 480x580px
>>59808668
>The simpler the language the more complex is any implementation in it.
Even that is incorrect.
>Not really.
A compiler is, by definition, something which maps an input language to an output language. The necessity for this transformation shows that the language being compiled is merely a layer on top of something else.
>ASM -> machine code translation
Why would you even need to perform this translation if assembly was somehow already the lowest level language of that machine?
>Haskell exists and is very efficient at being one.
H*skell is a programming language (as you yourself admit), meaning it can't possibly be a "meme". I think you are referring to the memes surrounding H*skell, not the language itself.

>>59808738
>Why would a programming language be exempt from meme status?
I didn't say that. But a programming language itself cannot be a "meme".
>Also, calling lambda calculus a programming language just seems incorrect.
I'm glad you realize that it merely "seems" incorrect.
>Do you call a Turing number a programming language?
I can't answer this question.
>Do you call second order logic a programming language?
Absolutely.
>>
I watched a yt tutorial how to create a simple snake game.
Now I used what I learned in that tutorial and decided to make a 'racer' game, as in you move your 'car' left to right on the bottom of the screen and have to avoid oncoming obstacles

so far I got this, it works, I can move the car, however I can't come up how to make it stop when it hit's the '#' wall
I mean I got the idea, but I dont really know when this piece of code should be

#include <iostream>
#include <conio.h>
#include <windows.h>
#include <ctime>

using namespace std;

const int width=20;
const int height=20;
bool gameOver;
int carX, carY;

enum eDirection{STOP=0,RIGHT, LEFT};
eDirection dir;

void setup()
{
carX = width/2;
carY = height-1;
gameOver=false;
}

void draw()
{
system("cls");
for(int i = 0 ; i < height ; i++)
{
cout << '#';
for(int j = 0 ; j < width - 2 ; j++)
{
if(i == carY && j == carX)
cout << '@';
else
cout << ' ';
}
cout << '#' << endl;
}

}

void input()
{
if(_kbhit())
{
switch(_getch())
{
case 'a':
dir = LEFT;
break;
case 'd':
dir = RIGHT;
break;


}
}
}

void logic()
{
switch(dir)
{
case LEFT:
carX--;
break;
case RIGHT:
carX++;
break;
}
}

int main()
{
setup();
while(!gameOver)
{
draw();
input();
logic();
Sleep(30);
}
return 0;
}


>>
>>59808832
>Why would you even need to perform this translation if assembly was somehow already the lowest level language of that machine?
Exactly, there is no abstraction involved in assembly
>>
>>59808832
>Why would you even need to perform this translation if assembly was somehow already the lowest level language of that machine?
Same reason why you can't understand Chinese moving pictures and need subtitles.
>H*skell is a programming language (as you yourself admit), meaning it can't possibly be a "meme".
See >>59808738
>>
File: 1481298937910.png (129KB, 500x374px) Image search: [Google]
1481298937910.png
129KB, 500x374px
>>59808896
So your processor directly executes assembly without translating it to machine code? Those are the only circumstances under which assembly would be considered a non-abstraction.

>>59808900
>Same reason why you can't understand Chinese moving pictures and need subtitles.
Speak for yourself.
If the machine can't understand assembly then it's obvious to any sane person that assembly isn't the language of that machine, meaning it's an abstraction.
>See >>59808738
I already replied to that post. A language having meme status because of the memes surrounding it doesn't somehow mean that a language is a "meme".
>>
Are you project names as cool as the NSA's? https://github.com/x0rz/EQGRP
>>
>>59804915
Make rock paper scissors enums (do NOT conpare strings) and for draw, just check if p1 equals p2
>>
>>59809018
Even cooler since they contain Germanic-sounding words.
>>
>>59809007
Using mnemonics to represent opcodes isn't abstraction
>>
>>59809092
Not the guy you're talking to but: Wikipedia disagrees.
>>
>>59809092
How is using retarded mnemonics to help you hide what's really going on not an abstraction? Nobody can be this fucking delusional, right?
>>
I'm working with git for the first time, and I've already cloned the repository. I've made some changes to my version of the file and I did a pull and it told it was up to date. I added the file and made a commit and then I did a pull, it still told me everything was up to date. I did a push, the content on the online repository changed like it should, but what about conflict resolution?
>>
>>59809099
>>59809109
To be fair, an abstracion is a way to generalize constructs and problems. Calling a nearly 1:1 mapping from assembly instructions to machine instructions is some hardcore autistic dictionary riding (i.e. argumentum ad verecundiam).
>>
>>59809174
>Calling a nearly 1:1 mapping from assembly instructions to machine instructions an "abstraction" is...
fixed
>>
>>59809174
>Calling a nearly 1:1 mapping from assembly instructions to machine instructions is some hardcore autistic dictionary riding
It really doesn't matter, the claim that assembly is somehow not an abstraction is outright false.
>>
>>59809183
Prove it.
>>
>>59809168
Git will let you merge changes in conflicting files, otherwise you just need to rebase when remote updates while you were working on local copy.

Most of the times this will suffice:
git pull --rebase
>>
>>59808098
mips_asm
>>
>>59809099
It doesn't, though.

>>59809109
Sure. "dec" really hides what the processor is actually doing, right? It doesn't just mean 0xCE to the processor, right? Heh
>>
>>59809196
It's self-evident. No processor understands it, meaning you have to convert it to some lower-level form before execution.
>>
>>59809216
The name "dec" is a convenient way for humans to remember the actual instruction, which is the very definition of being more high level.
It's pretty clear why you're acting this way, you think you have taken the true redpill by using assembly, but the ugly truth is that you have been fooled. I can only hope that you recover quickly and start using a real language instead of high-level garbage.
>>
Machine code is also an abstraction (especially hexadecimal notation), what the cpu 'really' only understands are electrical signals - and even that is an abstraction over quantum phenomena.

It's abstractions all the way down.
>>
>>59809217
I hope you realize that you're arguing that you're calling mathematical functions "abstractions" at this point, right?
>>
>>59809206
>Git will let you merge changes in conflicting files
But how? It never told me my files differ from the ones on the remote repository.
>>
>>59809262
In what way?
>>
>>59809270
Oh, sorry, but does someone else beside me have to change the remote so that I would have something to pull?
>>
>>59809270
If there weren't any conflicts, git can just seamlessly merge without problem.

Git stops the merge if there is a conflict, and you have to resolve it before you continue.
>>
>>59809270
>But how? It never told me my files differ from the ones on the remote repository.
Some changes are non-conflicting and get fuzzed, in case of conflicting changes the editor will open and you will have both changes next to each other and it will let you pick which ones to keep.

>>59809291
Yes, if it's just you that makes the changes then there's nothing upstream that the local copy needs to be updated with.
>>
>>59808853
oh mate i cant compile that, can you rewrite that in python please
>>
>>59809254
I develop my programs by buying the transistors and hooking them up correctly. Get on my level.
>>
File: 1488067458126.jpg (30KB, 439x392px) Image search: [Google]
1488067458126.jpg
30KB, 439x392px
>>59809326
>buying
>not making them yourself
>>
Does gcc ever use mmx instructions? I'm doing something that should be easily possible with mmx but gcc just keeps operating on single bytes. It doesn't have any problems with sse though.
>>
>>59809289
From Wikipedia, but any mathematics book will tell you the same:
> In mathematics, a function[1] is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.
The important part for this discussion being:
>with the property that each input is related to exactly one output
Which means that any one (set of) inputs to a function must always produce the exact same result.

Unless you're using a hardware agnostic assembler (those *are* abstractions!), any hardware specific assembler will transform any line of assembly code to a specific output data. If the developer actually put any effort into the assembler (with regard to history: very unlikely) it might give you warnings or print errors if an assembler construct will be converted into an instruction that will cause a CPU exception without the user having to painfully figure that out on his or her own.
Nevertheless, a hardware specialized assembler is a direct 1:1 mapping of the assembly code to the resulting machine code, i.e. a function in the mathematical sense.
>>
>>59809368
> It doesn't have any problems with sse
IIRC SSE is a superset of MMX.
>>
>>59809359
It's pretty easy too. However, if you buy them they're usually much smaller and you can get a lot more functionality per m3.
>>
>>59809359
Making tubes would be easier
>>
>>59809377
>Nevertheless, a hardware specialized assembler is a direct 1:1 mapping of the assembly code to the resulting machine code, i.e. a function in the mathematical sense.
Yes, I understand that a compiler is indeed a function. Your point being?
>>
>>59805454
can you do one for namefags and tripfags too
>>
>>59809406
No it's not. A compiler for a regular programming language may switch around instructions, replace instructions with precomputed results, ...
>>
>>59805472
Who are you quoting?
>>
>>59809428
I should have said a good compiler.
>>
>>59809439
A good compiler is an optimizing one. Which does exactly what I said.
>>
>>59809431
It quotes the post before, dumb robot.
>Who are you quoting?
>>
>>59809443
A good compiler is something which is a function. What you described is merely a toy which shouldn't really be used.
>>
>Let Σ be a non-empty finite set of symbols (alternatively called characters), called the alphabet. No assumption is made about the nature of the symbols. A string (or word) over Σ is any finite sequence of symbols from Σ.[2] For example, if Σ = {0, 1}, then 01011 is a string over Σ.
>The length of a string s is the number of symbols in s (the length of the sequence) and can be any non-negative integer; it is often denoted as |s|. The empty string is the unique string over Σ of length 0, and is denoted ε or λ.[2][3]
>The set of all strings over Σ of length n is denoted Σn. For example, if Σ = {0, 1}, then Σ2 = {00, 01, 10, 11}. Note that Σ0 = {ε} for any alphabet Σ.

Why all this formalisation is needed?
>>
>>59809377
>>59809428
You're confusing the definition of function with the more specific 'monomorphism' (one-to-one function). You should be talking about those.
You can certainly argue that a compiler is a function, but not a monomorphism.
>>
>>59809473
Without formalisation, you're going to have a pretty hard time proving anything to be correct.
>>
Currently learning PHP and SQL.
I'm trying to insert some data inside a table via PHP, but looks like it's broken. Did I do something wrong?
$sql = "INSERT INTO Telefoni (nometelefono, rom, ram) VALUES ('Redmi Note 3 Pro', '16', '3')"

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
>>
File: 1483398051056.jpg (57KB, 633x855px) Image search: [Google]
1483398051056.jpg
57KB, 633x855px
What language should I use to make me feel like a hacker?
>>
>>59809514
Canadian
>>
>>59809524
Chinese or Russian seems to be better suited for that.
>>
>>59809524
>not Russian or Chinese
>>
>>59809473
>Why all this formalisation is needed?
Dunno, ask ancient Greeks. They've invented and set up the rules and conditions for proper deductive reasoning.
>>
>>59809539
>>59809540
Eh?
>>
File: 1461467269965.jpg (91KB, 600x697px) Image search: [Google]
1461467269965.jpg
91KB, 600x697px
>>59809524
>>59809539
Oh, sorry. I meant a programming language.

Corrected version of my post:
What programming language should I use to make me feel like a hacker?
>>
>>59809514
cyka blyat
>>
>>59809524
>>59809539
>>59809540
I know all of those, they aren't very hacker-like.
>>
>>59809584
C
>>
>>59809598
What exactly should I do in it to help me achieve that feeling (it can't be hacking)?
I've done some basic things in it and they didn't make me feel anything.
>>
>>59804801
Anyone knows some good free resources for learning Go? Feel like learning it.
>>
>>59809584
C is probably the best choice here. Make sure to include as much optimizing inline assembly as possible (using profilers to figure out the actual slow parts is for faggots)!
>>
New thread:

>>59809632
>>59809632
>>59809632
>>
>>59809624
Read an image file (without using libraries) and extract metadata from it.
>>
>>59809584
Lisp if you want to go old school.
>>
>>59809624
>What exactly should I do in it to help me achieve that feeling (it can't be hacking)?
Pointer magic.
>>
>>59809383
Not really. mmx has its own instruction set and operates only on integral values. Also applies automatic saturation.
>>
>>59807075
the way everything is headed this scenario is actually the future. 2019 - kernel in javascript edition
>>
>>59809678
sse2 adds the missing integer ops.
>>
>>59809641
>no cute anime image
where's the real thread, you fucker
>>
>>59808853
part of logic() should be checking that the location the car is about to move is actually valid (not a wall or other obstacle) before moving it
>>
>>59809509
no semicolon after your sql statement?

if not that, what's the error?
>>
>before cs
>wow i really enjoy life
>after cs
>holy shit im gonna get fired and its gonna be because of a missed parentheses or semi colon

super fun
>>
>>59810433
Who said this?
>>
>>59810479
me
>>
>>59810502
Where? I don't see any of that said before this post.
>>
>>59810551
No, thats my experience
>>
>>59810598
Then why did you quote it?
>>
>>59806807
Then you must have implemented your algorithm incorrectly.
>>
>>59810661
I didnt quote
>>
>>59810677
You clearly did as evident by your use of the quotation operator '>'
>>
File: IMG_4812.gif (473KB, 500x496px) Image search: [Google]
IMG_4812.gif
473KB, 500x496px
>>59806105
What's it like being such an autist that you can't see value in different tools for different situations?
>>
File: shiny.png (441KB, 575x575px) Image search: [Google]
shiny.png
441KB, 575x575px
>>59810691
>You clearly did as evident by your use of the quotation operator '>'
>your use of the quotation operator '>'
>quotation operator
>'>'
>>
>>59810808
Really, who are you quoting?
>>
File: image.png (4KB, 296x21px) Image search: [Google]
image.png
4KB, 296x21px
>>59810828
>Really, who are you quoting?
>who
Anonymous
>>
>>59810894
Can you link to the post?
Thread posts: 337
Thread images: 35


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