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

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

Thread replies: 255
Thread images: 16
File: yF1VCTm.jpg (89 KB, 1366x768) Image search: [Google]
yF1VCTm.jpg
89 KB, 1366x768
Old thread: >>55269029

What are you working on, /g/?
>>
(From Last Thread)


I have to sort a singly linked list composed of words from the entirety of War and Peace. My sorting algorithm works but I need to do the sort in under 20 seconds and I am nowhere close to it. Can anyone give me any hints?
>>
>>55274909
sage this shit
>>
>>55274919
If you absolutely have to use a linked list, you might consider mergesort.

If you can use an array instead, then do that and use quicksort.
>>
>>55274928
I have to use a singly linked list (it's a uni assignment). I tried to use merge sort but failed horribly, I'll give it another go.
>>
>>55274909
Rewriting all my Haskell programs to not use any IO as it is impure.
>>
>>55274952
How will you get user input?
>>
>>55274952
But then who will build roads?
>>
>>55274951
Quicksort is great for arrays because it can operate in-place, but I seem to recall that mergesort suits linked lists well.
>>
I am the anon talking about scope and other things from the last thread. I think this may be a way to "restart" the conversation:

Could you define the concept of "scope" without using the word "block" (or equivalent expressions, no trolling please)?
>>
>>55274964
user input is impure
>>
>>55274983
Scope just means where that piece of information is valid. If it's outside of it's scope it is not valid in that area.
>>
>>55274952
I'd love to replace the current IO representation with the operational monad specialized for a GADT of IO actions
>>
File: pied-piper-box.png (439 KB, 1273x820) Image search: [Google]
pied-piper-box.png
439 KB, 1273x820
>>55274999
So basically you are creating a box?
>>
>>55275002
>area

but see, that's my problem, how do you "limit" this area? and upon doing so, have you not just defined a block?
>>
>>55275023
What do you mean, "how do you limit this area"?
>>
>>55275044
>Scope just means where that piece of information is valid.
This I understand and agree with.

>If it's outside of it's [sic] scope it is not valid in that area.
What thing are you referring to? A variable? If so, then you're saying that a variable has a scope, out of which it is not valid, correct? Then how do you identify this scope? Feel free to use a specific scope resolution policy (static or dynamic), but please give me a precise definition of how to identify that scope's limits. I suspect you will try to restrict the scope of a variable based on the language's syntax, but then you'll be defining blocks of code and I'm back to not understanding how you can separate the two concepts.
>>
>>55274964
I won't, that's the point.

>>55275021
No, I'm creating a pure universe.
>>
What is the worst spaghetti code that exists?
>>
>>55275173
http://lxr.free-electrons.com/source/net/ipv4/tcp_output.c#L2776
>>
>pycurl.error: (7, "Can't complete SOCKS5 connection to 0.0.0.0:0. (1)")
is there any particular reason pycurl shits itself like this when i try to connect through tor?
>>
I'm using connection pooling in my express.js app.

When I normally handle requests, I have to close the database connection within the callback after I've finished handling the request. Does this need to be done in an app that utilises connection pooling? If not, why doesn't the app hang in a way it would if I neglected to close the database in an app that doesn't use connection pooling?
>>
>>55275473
>is there any particular reason pycurl shits itself like this when i try to connect through tor?
0.0.0.0 on port 0 doesn't seem right....
>>
>>55274909
Fucking weaboo piece of shit
>>
how do you fags deal with frustration when something doesn't work and you can't find a solution?
>>
>>55275743
Remember that flawed beings create flawed things, sometimes necessarily..
Unravel where, why, and how the flaws of a given system might be introduced.

More commonly, drop it and come back later. Very tired of the human species and consistent bullshit at every turn.
"I want to add this to x vector, should be fine."
>x.push_back(someshitoranoter);
>make
"Error: Fuck you and btw here's 10 pages of error messages that overwrite the part of your console line-buffer that actually matters."
>>
File: BaseD.jpg (846 KB, 1580x3422) Image search: [Google]
BaseD.jpg
846 KB, 1580x3422
With most other hipster languages adopting codes of conduct, are there any anti-sjw languages other than D?
>>
>>55275860
Please stop talking this way about programming. Please.
>>
I'm new to programming and I'm currently working through the book Learning Python the Hard Way.
The book recommends using notepad++ and for the most part it seems to be pretty easy to use.
How come vim and emacs are shilled so hard on here and how are they any different from notepad++?
>>
>>55275926
Fuck off weaboo shitstin
>>
>>55275926
I'm guessing you're a Rust user. How is that tranny dick treating you?
>>
>>55274909
I'm a beginner but I learned python to be familiar with how a programming language works.
should I learn C or C++?
>>
File: cWJDqFi.png (52 KB, 500x366) Image search: [Google]
cWJDqFi.png
52 KB, 500x366
anyone here making passive income off their development? any tips?

I can program full stack but fuck me if I can think of a good idea.
>>
>>55275926
Really, he's just as bad as SJWs he professes to detest.

Some of us just want to get shit done and choose a language based on its merits, not the politics of some of its users or creators.

C would still be C if Lenin had invented it.
>>
>>55275931
Vim and Emacs both prioritize functional power over aesthetics or discoverability. They are an investment in the sense that they have powerful editing primitives, but they are indeed a little time consuming to learn to use. Basically, you can edit text from Vim and Emacs without ever leaving the keyboard.

>>55275947
both, don't get hung up on languages
>>
>>55275945
i'm non-binary cis-gender and you're offending me
>>
>>55275964
An app to find cats in photographs and create unfunny meme text
>>
>>55275977
which should I learn first then
>>
>>55275967
>C would still be C if Lenin had invented it
What the fuck does this mean?
>>
>>55275947
Yes
>>
>>55275986
C++ is a little complicated. You could do either and not be in a bad situation. I guess I'd say C just because there's some quality books CS books in general out there.
>>
>>55275998
who gives a shit who the devs are and what they think a language is a language and if it works well you should use it.
>>
>>55275977
Thanks for the explanation.
Do you think it would be worth trying to learn how to use one of those editors right now, or should I stick to notepad++ and then try one of them layer on?
I know for a fact that my dad is quite comfortable with vim so he could probably help me out if I ever don't understand anything.
>>
>>55276026
Until you get banned and shunned from the entire community for accidentally triggering some cunt with blue hair
>>
>>55276034
So what if that happens? You can still use the language.
>>
>>55276034
Why do you need the damn community in the first place? It's a programming language not a bar
>>
>>55276033
I would say yes. Just dive right in to whatever editor you like. You'll have to look up a lot of commands at first, but you'll eventually catch on and need to look up things less and less.
>>
>>55276034
So basically you're looking for a hugbox? You won't get banned for talking about programming
>>
>>55276055
I'm not sure you understand how sjws work. They will hunt you down until you either quit using the language or cease all public activity. You cannot apply logic to these creatures, and the only way to deal with them is to stay off their radar. Hence, you should choose a language that has a minimum of sjw activity such as C, C++, D, Nim, Haskell, etc.
>>
>>55276060
They'll sue you for using their language to write a project that violates their code of conduct.
>>
>>55276084
>he doesn't know about donglegate
I sort of agree with your point but you really can't assume that if you keep your head down and don't talk politics that you're safe
>>
>>55275812
>Unravel where, why, and how the flaws of a given system might be introduced.
>"Error: Fuck you and btw here's 10 pages of error messages that overwrite the part of your console line-buffer that actually matters."
but why, why should I try to track down this bullshit, it's not worth the stress

;_;
>>
>>55276090
m8...
>>
>>55276097
Talk shit get hit (with a ban)
>>
>>55276034
who gives a fuck

the only reason the community matters is to get your name out there and pad your resume, and if that's your goal you shouldn't be offending anyone anyways. The fuck else would you want to do in an "open source community"
>>
>>55276097
What was donglegate? My understanding is someone made an innuendo out of the word dongle and refused to apologize but I admit I didn't look into it
>>
>>55274951
quick sort should be good enough. I don't see any problems why it would be worse with linked lists. other than all those cache misses of course.
>>
>>55276090
only if their license says that the programs written in their language have to abide to their code of conduct and I'm not sure that this ever happened. The code of conduct is only for the community.
>>
>>55276172
Maybe he can't separate his political views from his job/hobby
>>
>>55276172
You're not understanding. These people will find out where you work and complain until you're fired. I'm telling you, once you're on the shitlist it can only end in your complete destruction.
>>
>>55276202
What's wrong with them doing that? It's their right to complain to your employer, and your employer has a reputation to preserve.
>>
File: bait2.png (74 KB, 1024x1024) Image search: [Google]
bait2.png
74 KB, 1024x1024
>>55276230
>>
>>55276230
Pathetic.
>>
File: gbxnVvz.gif (667 KB, 640x400) Image search: [Google]
gbxnVvz.gif
667 KB, 640x400
>>55274909

Making weird ASCII graphics.
>>
>>55276278
How so?

If I make an ass of myself, even when I'm off the clock, then my employer might decide to fire me. It's the way things are.
>>
File: evolutionOfDesk.gif (3 MB, 440x314) Image search: [Google]
evolutionOfDesk.gif
3 MB, 440x314
What's an efficient algorithm to get a gf?
>>
>>55276230
>what's wrong with sjws? We should just let them keep doing what they're doing.
>>55276292
It's not about making an ass of yourself. They lie and exaggerate. Theh get you fired through mob rule, the employer thinks that a lot of people don't like you or what you're doing so they fire you even if really you said something completely benign and it triggered some hug box retard. It could happen to anyone.
>>
>>55276310
Run around her in a circle, and share your carrots with her.
>>
>>55276310
chloroform
>>
>>55276315
So make and retain incontrovertible evidence of what actually happened, to present to your employer.
>>
>>55276310
watch weird science, make your own gf
>>
>>55276344
They won't care.
Their company's name is already receiving negative press, and it's your fault.

Pack your shit and get out.
>>
>>55276344
Look m8 you can put your head in the sand, but the SJWs will still be there doing what they do.
>>
>>55276374
They're a shitty employer, then.
>>
>>55276390
Your a danger to their bottom line.
Any company will throw you out to the dogs to save face.
>>
>>55275688
well no shit, but i cant see any likely cause

heres the relevant code, python3 btw
import argparse
import pycurl
from io import BytesIO
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import os

#default settings
_proxy_url = "localhost"
_proxy_port = 9050
_page_increment = 12
_follow_redirects = True
_useragent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"

def get_file(url):
buffer = BytesIO()
conn = pycurl.Curl()
conn.setopt(conn.WRITEDATA, buffer)
conn.setopt(conn.PROXY, _proxy_url)
conn.setopt(conn.PROXYPORT, _proxy_port)
conn.setopt(conn.PROXYTYPE, conn.PROXYTYPE_SOCKS5)
conn.setopt(conn.FOLLOWLOCATION, _follow_redirects)
conn.setopt(conn.USERAGENT, _useragent)
conn.setopt(conn.URL, url)
conn.perform()
rcode = conn.getinfo(conn.RESPONSE_CODE)
conn.close()
return rcode, buffer.getvalue()
>>
>>55276450
You're using dynamic types, that never works.
>>
Can we make a discord or something? I'm terrified that I'm going to teach myself bad habits but can't afford to go to school to get formally educated.
>>
>>55276468
u wot m8?
>>
If I want to focus on security. What should I get for my backend?
>>
>>55276494
your what backend?
>>
>>55276494
for a webapp? Go (golang)
>>
>>55276477
What's a discord?

>>55276494
I'd say 6ft of concrete and 6in of lead lining, lots of steel reinforcing struts, and some ceramic outer plating, should be fairly secure
>>
>>55276490
Dynamic types just don't work, they make refactoring impossible, and can't help you when you make a mistake because you might have wanted to change the type of that variable there, and maybe you just wanted the argument you missed to be null
>>
>>55276477
https://discord.gg/yx7BdyY
>>
>>55276508
>>55276517

A MOOC-site related. The security is due to the fact that some user might need to used their credit card. Ive only worked with Java EE and PHP so far.
>>
>>55276529
>What's a discord?
It's a shitty voip/im app targeted towards gaymer types that's notable for having a web version of the app that requires no sign up or installation. Though I believe it uses flash for the web app's voip features if that's an issue for you.
>>
>>55276546
senpai, its a <200 fucking LOC script, i dont give a flying fuck about anything other than getting shit done fast
>>
>>55276579
I've got bad news for you. Dynamic types can't be fast either
>>
>>55276563
For the love of all that is holy, don't use PHP for anything handling financial transactions and credit card details
>>
>>55276593
fast as in getting it working asap, if i wanted speed i wouldnt be writing in python
>>
>>55276192
do you think he programs for an alt-right facebook page
>>
>>55276607
But we've established that dynamic types don't work, so you can't get it working asap with them.
>>
>>55276619
That's not programming, anon. That's dick sucking
>>
>>55276604
Ive heard bad things about php before. But why exaclty?
>>
>>55276629
m8, just fuck off, python isnt even dynamically typed, its inferred
>>
>>55276653
It thinks the link is spam, so search for 'php fractal bad design'.
>>
>>55276696
https://wiki.python.org/moin/Why%20is%20Python%20a%20dynamic%20language%20and%20also%20a%20strongly%20typed%20language
>>
>>55276714
oh, fair enough

still though, fuck off
>>
>>55274919
sleep sort
>>
>>55276757
Make me m8

I'm just trying to help you write better code, stop being ungrateful
>>
>>55276780
senpai, when i knock up a script, i want it in as few lines as possible. its either python or something that lets me be even lazier. if i want to write something that needs more than one source file, ill do it in a more appropriate language.
>>
>>55276817
Haskell is the laziest language of all, and you can do things in it with a single source file.
>>
>>55276858
>haskell
i dont have the time to learn an entirely new paradigm atm, aside from this ive got more important shit to focus on learning right now
>>
>>55276882
Okay, anon-kun, but don't say I didn't warn you. I'm not going to help you when you go insane.
>>
>>55276940
fuck knows, maybe i should just give up on python seeing as how the ecosystem seems to be fucked
>>
File: Upon run.jpg (63 KB, 652x310) Image search: [Google]
Upon run.jpg
63 KB, 652x310
I'm learning C++,
I have a data file with 18 lines of two values like this;
2 0.238
4 0.421
6 0.479

I am trying to read said data file and assign them to a
value_1[] array and value_2[] array.

I can open the file and I have a for loop that should be
assigning each value to a spot in the array and then
printing that value to display.

I don't understand why when I run this it waits for me to
give it input before displaying the table, or why the
values are way too big or small.

#include <iostream> //For user input
#include <fstream> //For reading data from file
using namespace std;
int main()
{
//Define input and arrays
double value_1[20], value_2[20];
int i;
ifstream fin;

//Attempt to open data file and check for read errors
fin.open("values.dat");
if (fin.fail()) {
cerr << "Could not open input file values.dat\n";
exit(1);
}

cout << "value_1 value_2" << endl;
cout << "---------------------" << endl;
for (i=0; i<20; ++i) {
cin >> value_1[i] >> value_2[i];
cout << value_1[i] << " " << value_2[i] << endl;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
>>
Since the old thread is dead, for the anon that thought I "had only compiled a hello world program", you should use qmake.
>>
Obligatory how is K&R?

I'm only halfway through the first chapter but it seems really easy, does it get any more complex?
>>
>>55277049
senpai, we have
 tags, pls use them
>>
>>55277148
>senpai
What the fuck is this shit?
>>
>>55277148
>>55277049
whoops tag is [ code ], wasnt expecting 4chan to accept the tag without a closing tag to match it
>>
>>55277049
cin gets things from stdin.
you should probably be using, I think you put 'cin' instead of 'fin'
>>
>>55277049
In the future wrap your code with "code" and "/code" inside brackets, [<>] [/<>] (can't remember how liberally it detects the tokens.)

#include <iostream>
#include <fstream>
using namespace std;
int main()
{
double value_1[20], value_2[20];
int i;
ifstream fin;

fin.open("values.dat");
if (fin.fail()) {
cerr << "Could not open input file values.dat\n";
exit(1);
}

cout << "value_1 value_2" << endl;
cout << "---------------------" << endl;
for (i=0; i<20; ++i) {
cin >> value_1[i] >> value_2[i];
cout << value_1[i] << " " << value_2[i] << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}


Stickler shit: don't write comments like that. If they're for you to remember what shit does, replace those comments with googling "iostream" for example and reading about it. It's a slippery slope for bad habits.

It waits for you to input because you're reading from the standard input as opposed to your filestream on the line
// cin >> value_1[i] >> value_2[i];
fin >> value_1[i] >> value_2[i];
>>
>>55277161
Get on my level, kouhai.
>>
>>55277161
f a m is filtered to senpai on blue boards
>>
>>55277167
man that was a fuck up of a sentence
>>
>>55277172
I'm not Japanese.
>>
[]wut[]
>>
>>55277210
you're getting there
[nigboy][/nigboy]
>>
>>55277148
>>55277164
>>55277167
>>55277168
Sorry about the
 blocks, I won't do that again.

>>55277168
>>55277167
'fin' man I spent like the last 45 minutes trying to figure this out, thank you so much.
>>
>>55277225
[
]what the fuck did you just say about me, you little shit?
]
>>
>>55277235
>>55277250
[CODE]CODE[/CODE]::BLOCKS 2, NI/G/GAS 0
>>
>>55277250
[test[]
>>
>>55277264
make that three. ;_;
>>
>>
>>
>>55276230
This is a form of social oppression. A tyranny of the majority and prevailing cultural ethos.

I genuinely hate broken, deficient people. It's irrational, but I don't care. See this shit everywhere.
>>
>>55277143
>does it get any more complex?

Yes, it does.
>>
>>55276230
you realise that if you allow groupthink to take control of society regression in terms of individual liberty is inevitable, right?
>>
>>55277370
No anon, you're wrong. Democracy guarantees that we all have individual liberty.
>>
>>55277489
>Democracy and any of its derivatives
>Not either shifting towards oligarchy / plutocracy, or at best a tyranny of the ignorant majority.
Yeah, no. There's a reason most democracies, republics, etc eventually fall apart or degenerate into miserable dysfunctional failures.
>>
How might I implement GLSL's vector swizzling in C++?

e.g. myVec4.xy
>>
>>55277536
abuse glm?
>>
>>55277489
no it doesnt, thats why we have republics, and other such ideas
>>
>>55277528
lel, and other forms of governments dont?
>>
>>55277693
Nowhere in my post was there any suggestion, implicit or otherwise, that the human species has ever managed to produce anything approaching any sort of ideal short or long term.

Don't make something and then say I made it.
>>
>>55277536
#include <stdio.h>

struct vec {
float w;
float x;
float y;
float z;
};

#define SWIZZLE(v, W, X, Y, Z) (struct vec) { \
.w = (v).W, \
.x = (v).X, \
.y = (v).Y, \
.z = (v).Z, \
}

void print_vec(struct vec v)
{
printf("{w = %.1f, x = %.1f, y = %.1f, z = %.1f}\n", v.w, v.x, v.y, v.z);
}

int main()
{
struct vec v = {
.w = 1.0f,
.x = 2.0f,
.y = 3.0f,
.z = 4.0f,
};

print_vec(v);

print_vec(SWIZZLE(v, w, w, x, y));
}

:^)
>>
>>55277680
But a republic keep old outdated laws like the second amendment around. It needs to be a living legal code.

>>55277528
But rule by kings was abandoned because they were oppressive. All kings are oppressive. I should have a say in what my country believes in.
>>
>>55277739
Not if you're thick, anon. If we give thick people a say, they will destroy the country. See Britain right now.
>>
>>55277739
>All kings are oppressive.
Depends what "oppressive" means. By your definition it's better if something is miserable for everyone as long as you feel like you have a say, than to have it be net okay and to feel powerless. It's true that contrast, ownership, and context is important for perception, but there's always the bigger picture.

A stable benevolent dictatorship or variant of an aristocracy probably has the highest potential for any given window of time. A lot of people's desires and beliefs are knowably harmful and invalid, and the majority of people are barely capable of self governance, much less having any say in the governance of others. These hierarchies provide a means to strip these people of having so much impact on society as a whole, hopefully providing them the means to pursue better goals.

Usually deteriorates to something pretty awful though.
>>
>>55277770
ya, britain got lucky.
>>
>>55277731
that wouldn't work if you pass x, w, w, w for example. it would first w to x and set rest to new w.
>>
>>55277770
>If we give thick people a say, they will destroy the country. See Britain right now.

Freedom won.
>>
File: Terry-Davis.jpg (24 KB, 418x438) Image search: [Google]
Terry-Davis.jpg
24 KB, 418x438
He's streaming again

https://www.youtube.com/watch?v=hxyiafJ7CeQ
>>
>>55277947
Stupidity won. Their economy is in free fall.

The best option for them is to never trigger Article 50. Europe will be rightly pissed, and they'll lose what little goodwill they still had, but it's better than the alternative of leaving the EU.
>>
/*=======================================*/
/* compile with cc backg.c -lm -o backgd */
/*=======================================*/

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include <string.h>

int main(int argc, char ** argv)
{
if (argc > 1 && !strncmp(argv[1], "-d", 2))
daemon(0, 0);
srand(time(NULL));
uint8_t r, g, b;
uint16_t i = (uint16_t) rand();
r = 0;
g = 0;
b = 0;
char * systr;
while (1)
{
r = 0x55 + 0x33 * sin((double) i / 160);
g = 0x55 + 0x33 * sin((double) i / 120);
b = 0x55 + 0x33 * sin((double) i++ / 80);
systr = malloc(64);
sprintf(systr, "xsetroot -solid \"#%02x%02x%02x\"",
r, g, b);
system(systr);
free(systr);
usleep(1 << 18);
}
}
>>
>>55277965
and it would quickly go back to normal.
>>
>>55277965
Oh fucking hell, give it a break. You're just parroting a myopic narrative pushed by the media and large corporations.

No one really has a decent means to predict how this will pan out and it isn't so clear as you seem to believe. Yes, big changes just occurred. Yes, the economy is behaving differently; that's what happens with meaningful change. Calm down, don't be so myopic. you're embarrassing yourself and negatively affecting my day. There are way too many of you reactionary types who are in a full tailspin after losing.
>>
>>55277921
Yes it does. It doesn't set the original vector to the swizzled value, it just creates a new one.
It's a C99 designated initialiser.
>>
>>55277961

whats his obsession with random numbers
>>
>>55278030
God.
>>
>>55278030
The dude is legit insane. Don't question it too much.
>>
lol some nigger called him
>>
>>55277985
>Constantly mallocing and freeing the same 64 byte string
Just do
char systr[64];
>>
>>55278077
CIA or MIT?
>>
>>55278077
A CIA nigger no doubt.
>>
File: 1466874068320.jpg (128 KB, 994x768) Image search: [Google]
1466874068320.jpg
128 KB, 994x768
>>55277965
>Their economy is in free fall.

This is literally a temporary market reaction to the referendum. It's going to bounce back quickly and everything will be hunky dory once they design some free trade agreements on their own terms.

Hopefully they deport you lefty fucks, too.
>>
>>55278013
>negatively affecting my day
Why don't you go home and cry about it on your blog?
>>
>>55278116
Last I knew London and Northern Ireland were pretty pissed. Very curious about the possibility of the UK dissolving outright.
>>
>>55278116
I'm on a different continent, and I'm not a lefty.
>>
Redpill on java servlets?
>>
>>55278128
I am home, and you're on my blog. I'm not sure why you're complaining.
>>
Anybody have any issues getting SDL2 to recognize a gamecontroller?

I compiled SDL2.0.4 from source, that could be why.

I tried an afterglow 360 controller and an xbox one controller and neither passed the SDL_IsGameController() function.

What I found online is alot of people asking, but no one giving answers. Something to do with xinput.
>>
>>55278143
>I'm not a lefty

And I'm the Queen of England.
>>
>>55278178
I knew it.
>>
>>55278178
How's it going, Liz?
>>
>>55278178
Can I be knighted for my dedication to and advancement of shitposting in /dpt?
>>
>>55278025
>designated
rajesh...
>>
>>55278178
lmfao the queen of england would never use M$ shit like C#. She's definitely into OCaml.
>>
>>55278260
That's the actual terminology, you memer.
>>
>>55278272
>Implying ancient reptiles program
>>
>>55277961
Who is this?
>>
>>55278306
The schizo who wrote TempleOS.
What he accomplished by himself is actually pretty impressive.
>>
>>55278272
it's possible, the prime minister of Singapore is learning Haskell
>>
>>55278322
>by himself
With God.
>>
>>55278293

Sir, I am a great wyrm red dragon. Are you implying I do not program?
>>
>>55278116
>Hopefully they deport you lefty fucks

I thought they were leaving on their own accord? That's what they were saying on twitter.
>>
>>55277961
>I'm not a marxist atheist, but I use ubuntu.

That should be enshrined somewhere.
>>
>>55278371
>I thought they were leaving on their own accord?

They're all teenagers bitching about how they didn't vote. I doubt they're moving anywhere.
>>
Where can I download a big database of IP address-subnet-to-location lookups for use in my serverside application? (and I dont wanna query any 3rd partys servers)
>>
>>55278416
4chan
>>
>>55278287
>butthurt
kid...
>>
>>55278116
>Hopefully they deport you lefty fucks, too.
>says the anarcho-libertarian-religious-statist-capitalist-militarist
>>
>>55278557

Leftists are incompatible with freedom.
>>
>w3m source code mixes tabs and spaces for indentation
disgusting
>>
>>55278416
https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml
I *think* this is it
>>
>>55278615

thanks for letting us know about your political stance once again, you insolent little shit
>>
>>55278615
>Freedom
>Existing in any meaningful form
Use more accurate terms to convey your ideas.
>>
>>55278626

It was already the subject of discussion here, since people were talking about the referendum. The only people who disagree are leftists.
>>
>>55277357
It gets really complex, but maybe I'm just an idiot.
>>
int64_t average(int32_t* n, char nlength)
{
int64_t avg;
for(int a=0;a<nlength;a++)
{
avg = avg + n[a];
}
avg = avg / nlength;
}

I wrote this shit for one of those CS major meme threads, and now I have the legitimate question of is there any chance of an overflow?
>>
>>55278703

No, you're not. K&R was written for programmers.
>>
>>55278721
avg is uninitialized on the first run of the for loop.
You forgot to actually return the value.
Why on earth are you using char?
>>
>>55278764
For the first two, oops, I forgot that.
I'm using char because I need INT32_MAX int32s to reach int64_max and char_max isn't anywhere near int32_max.
>>
Is Himegoto actually good?
Can I jerk off to it?
>>
>>55278721
Worst case is an array of 256 times 4294967296, which fits into an int64_t, so no. Still, you should write that as

int64_t average ( int32_t *n, char nlength )
{
int64_t avg = 0;
for ( int i = 0; i < nlength; ++i )
avg += n[i];
return avg / nlength;
}

to compile. Ignore stylistic changes.
>>
>>55278804
Honestly, it's fucking shit.
>>
>>55278809
>>55278780
As retarded as it is to use a char instead of size_t to be a length, you could at least use unsigned char.
>>
>>55278810
That sucks. Why?
>>
>>55278821
size_t is a 32bit type on most compilers, which means that the max size_t can hold is about 4294967296, which means that if you use 4294967296 int32_t's with a value of 4294967296 you overflow the int64_t. With char that won't happen because the max it can hold is 256, and 256 int32_t's with a max value of 4294967296 can't overflow an int64_t. I could change it to int16 or something, but who the fuck needs to average more than 256 numbers and hires a highschool student to write a function for it?
>>
>>55278884
>size_t is a 32bit type on most compilers
No. It's usually 64 bits on 64-bit computers. Also, it's not usually the compiler that decides, it's the ABI it's trying to follow.
>With char that won't happen because the max it can hold is 256
Assuming that char is an unsigned type. If it's signed, it's only 127. And even that, that's assuming CHAR_BIT == 8.
>but who the fuck needs to average more than 256 numbers and hires a highschool student to write a function for it
You don't really seem to understand the exercise. It's supposed to make the function as general and portable as possible.
>>
>>55278923
>that's assuming CHAR_BIT == 8.
Now really, are there any ABIs, archs, or fucking anything in use that doesn't assume a byte to be 8 bit? You'd have to be a fucking retard not to do so, since you'd be breaking compatibility with anything made in the last 30 years. But now you've raised me a valid question, does an int8_t exist?
>>
>>55278956
int8_t? That's just a signed byte. (char)
uint8_t is unsigned byte.
>>
>>55278804

No.
Maybe.

You could watch the entire series in about an hour or so, because each episode is only 5 minutes. It's not really an erotic anime, although the main character does get molested a bunch and forced into crossdressing against his will, and at one point, almost raped.

>>55278923

>and even that, that's assuming CHAR_BIT == 8.
Well actually, if CHAR_BIT != 8, then the code won't compile. On a system where CHAR_BIT is, say, 9, it is impossible to have a 32 bit data type (although you can have an 18 bit and 36 bit data type), so int32_t would not be defined. There's a reason why the C standard does not require int32_t to be defined, although it does require int_least32_t to be defined. To my knowledge, there are no machines where CHAR_BIT is a power of 2, that is not 8 (although I am welcome to be proven wrong here, I like weird architectures).
>>
>>55279069
>Well actually, if CHAR_BIT != 8, then the code won't compile
What if CHAR_BIT == 16?
>>
>>55279088
Wait, I didn't provide a link:
https://lists.nongnu.org/archive/html/lwip-users/2011-12/msg00012.html
suggests that some DSPs have 16 bit chars.
>>
File: DSC02237.jpg (3 MB, 3200x2400) Image search: [Google]
DSC02237.jpg
3 MB, 3200x2400
I just bought a hd44780 4x20 display which will be added to pic related in the next few days :^)
>>
File: 8pen.png (86 KB, 400x374) Image search: [Google]
8pen.png
86 KB, 400x374
Hey lads, supposing I dev a typing app for smartphones, can I skip the spellchecker part of it and just use something native in conjunction?

I just want to create the input method, won't arse myself with advanced user learning and prediction.
>>
What would cause a std::vector with one value be seen as empty()?
>>
>>55279114
So what exactly IS pic related?
>>
>>55274952
So it does literally nothing?
>>
>>55279069
Or you know, you could just read the manga.
The anime was really just an ad for the manga like many low budget 1 cours these days.
>>
File: 1466520880861.webm (249 KB, 720x404) Image search: [Google]
1466520880861.webm
249 KB, 720x404
Trying to lean C but I'm failing hard.

http://pastebin.com/GfuM2p5K

This should be a simple program that creates random names and 4 subject scores for some students, sort them by rank based on the total score, then sort them back by students no. Then it saves the whole thing on a .txt as comma separated values.

If anyone could tell me why the thing crashes when creating and sorting the data I'd be really grateful. Also I should learn how the read the debugging thingy.

And yes I'm not a smart man.
>>
>>55274983
No, because then I'd be describing something else that isn't scope.
>>
>>55279338
I'm pretty sure it's because you're using chingchong. I can't even get it to compile because of it.
>>
>>55279338

nvm found it
>>
lmfao fucking agdg shitkids will still defend the unity engine

even AAA devs can't make good games with it

https://www.youtube.com/watch?v=DL4GXV2XzYE
https://www.youtube.com/watch?v=5PUsnzNfOwQ

umbrella corps is obviously complete fucking shit

and big surprise the controls are shit which is a fault of the engine lmfao kill yourselves idiots

https://www.youtube.com/watch?v=OCabT_O0YSM

and this thread is a bunch of literal fags and sub-110 IQ idiots just look at the OP pic and look at yourselves in the mirror
>>
>>55279432

There were two problems.

First was placing \0 in str[10] with str going from [0] to [9] in dataInputf.

Second was in saveFilef printing %d for a char variable with ascii and printing %s for digits.
>>
>>55277809
AI will change things, anon
>>
>>55279504

Can't wait for an AI waifu that is a nice conservative black gril.
>>
>>55279522
Fuck off back to IRC
>>
If I decide to write my own Domain-Specific Language and then immediately turn around and use it in production, how dumb is that?
>>
Anyone experienced with ren'py here feel like helping me out? Just a newbie trying to make a shitty test game.

What I tried was this. $ int = 0

That line worked but when I tried to make an if statement from it. I got an error. Here's the line that gave me an error.

if int = 0:
e "blah blah blah"
>>
>>55279545
Okay, as long as most of your code isn't in the DSL. But it's usually better to use a more popular language because that way contributors don't have to learn it, plus there are plenty of Lua, Lisp etc. interpreters that have a lot of work put into them, so they'll probably be more efficient and better designed.
It's not stupid to make your own, but I'm sure people around you would prefer that you don't.
>>
>>55277809
This all depends on the assumption of a supercompetent dictator / oligarch-class, though. In practice even when the leadership is benevolent they're often dumb enough that they get beaten out by the wisdom of the crowds.

See: Every dictatorship that has ever existed in real life, sans possibly Ancient Rome and modern-day Iran.

Also there is the issue of separation of labor. A lot of time the people making certain governmental decisions for a domain need to have spent their whole lives studying domain-specific knowledge to do it properly. If all final decisions lie with a "decider" caste, those guys (or individual guy) will probably have broad and shallow knowledge of everything, which means they'll fuck up a lot. Naturally they can delegate, but in real life people are control freaks and will try to legislate about things they don't really understand.
>>
>>55279564
1. In nearly every programming language, you use "=" to ASSIGN values to variables, and you use "==" to COMPARE values to values. It's absolutely imperative that you remember this and understand that there is a difference, and it is an important difference. = is assign, == is compare.
2. you shouldn't name variables "int" in Python code because "int" is by default a function that converts things to integers. If you overwrite that it could, (not necessarily), unintentionally fuck things up.
>>
>>55279610
1. So if you use = you're making the thing become that number but if you use == you're checking for that number?

2. Gotcha.

Also, what I'm going for here is a stat thing. Basically as the number goes up, different dialogue happens, but I'm not exactly sure how I'm supposed go about doing that. I could do if x = True stuff, but that'd get really tedious after a while. I'm more than likely using google wrong because I can't seem to find the answer for it.
>>
are there any shit-tier browsers for windows that can't use javascript?
>>
>>55279646
>1. So if you use = you're making the thing become that number but if you use == you're checking for that number?
Pretty much.
"a == b" means "is 'a' EQUAL TO 'b'?"
"a = b" means "set 'a' to become the value 'b'"

I've never used ren'py so I can't help you with anything specific. These might help you:

x = # something

# later...
x = x + 1
# this increases x by one, read "set x to become whatever x is currently, plus one more"

if x == 1:
# do thing
elif x == 2:
# do other thing
elif x == 3:
# etc..

if x > 4:
# do thing if x is greater than 4
else:
# do thing if x isn't
>>
did anyone do the hackerrank contest yesterday?
i'm amazed there are people who actually did all 7 problems in time.
>>
>>55279678
Thanks for your help. Have a great day.
>>
>>55279436
http://pastebin.com/vGEW2qFw
>>
>>55279545
good use of DSLs is part of good program design. the important thing is creating a DSL that actually fits your domain well and only using it in places that it makes sense, rather than trying to write your whole application with it
>>55279567
kinda true, but DSLs aren't the same as embedded scripting languages (usually), and a lot of the time what people refer to as a DSL is really just a layer of abstraction over the language you're using (which means little performance loss at all). languages like Lisp, Ruby, Scala, Forth, and Haskell are very well-suited for implementing DSLs, but it's not impossible to do in other languages. i'd say if metaprogramming makes DSLs simple in your language, stick to that, otherwise write your own interpreter for the DSL. getting caught up on having to reinvent the wheel because of the learning curve doesn't really help when writing the code without the help of a DSL would make it less readable (which is most cases, really)
>>
>>55279914
You could probably make any DSL into a couple of Lisp macros
>>
>>55279965
yeah, i think most well-written Lisp/Scheme makes wide use of macros
>>
you know people are memeingly panic selling and web devs/server admins suck fucking ass when your stock broker's website won't even load after trading starts
>>
>>55279107

I would be interested in seeing such a DSP.
>>
I am bored of this ARM and operating system dev shit soooo
I am developing a WebGL based realistic 3D cheese pizza mmorpg where you can diddle lolis, shotas, and trap shotas all around the world

also I'd diddle tf out of the feminine penis'd girl in op's pic
>>
>>55277961
>he wrote an OS using that awful setup
what editor is he even using
>>
http://www.cplusplus.com/reference/regex/regex_replace/
>$´
Who the FUCK on the C++ standards comity thought it was a good fucking idea to use a non standard fucking character in a standard library STL function?
Just fucking why? this fucking character isn't on my STANDARD Australian keyboard, and even copy pasting the fucking character didn't work.
What the FUCK. Come on C++ people.
>>
>>55280097
Then explain why it isn't on my keyboard.
How the fuck could the C++ people overlook this?
>>
>>55277961
holy shit this is a fucking gold mine
>>
>>55280080
>Dollar sign
Are you using some sort of European keyboard or something?
Why would an Australian keyboard be any different than the US layout? Considering you use $ for your currency as well.
>>
>>55280080
>>55280108
>>55280097
lads... regex certainly doesn't require that character

I'm sure there is a way around that. There's all sorts of operators you can use for selecting characters. regular expressions are the most versatile thing ever

>>55280129
I think he's referring to the variant of '
>>
>>55280129
I'm talking about the '´' (tick) character after the dollar sign. Of course I have the dollar sign, I'm not some dirty foreigner.
>>
>>55280108
Its standard notation used by standard regex parsers including the C++ standard. Also a "standard Australian" keyboard is a standard Intl(US) Qwerty[1]. Even the UK Qwerty has a dollar sign.

1:https://en.wikipedia.org/wiki/British_and_American_keyboards
>In Australia, New Zealand, Canada, the Netherlands, Poland and India, the US keyboard is used.
>>
>>55280129
I think he's talking about the strange backwards tick (backwards `), not the $
>>
>>55280146
>>55280147
>>55280160
The backtick?
That's with the ~, left of 1.
>>
>>55280169
No, it's a backwards backtick.
Yes I have the normal backtick, but not the backwards variant of it.
>>
>>55280151
m8 I'm not talking about the fucking dollar sign, Jesus fuck.
>>
>>55280169
compare the two
>>
´ (NOT `) is not part of ASCII, that actually pisses me off too...
>>
>>55274909
Sauce on the anime?
>>
>>55280235
it's called kill yourself
>>
>>55280238
Dont lie to me, anon.
Thread replies: 255
Thread images: 16

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.