[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: 313
Thread images: 27

File: dpt 2.png (890KB, 1550x1123px) Image search: [Google]
dpt 2.png
890KB, 1550x1123px
Old thread: >>61312355

What are you working on, /g/?
>>
best way to learn OpenMP?
need to learn it
>>
>>61316148
openMP is dead, learn chapel.
>>
>>61314126
Significantly larger, but also 5-10 times faster. Keep in mind C can't just print data structures like python, so comparing the entire code size is kind of unfair.
int cmp(const void *ap, const void *bp) {
int a = *(int*)ap, b = *(int*)bp;
return (a < b) ? -1 : (a > b);
}
void* generate_primes(int end) {
char primes[end];
memset(primes, 0, end*sizeof(char));
void *set = 0;
for(int i=2; i<end; i++) {
if(primes[i]) continue;
int* p = malloc(sizeof(int));
tsearch((*p=i, p), &set, &cmp);
for(int j=2*i; j<end; j+=i) primes[j] = 1;
}
return set;
}
char is_circular(int n, void *set) {
char str[32];
int l;
sprintf(str, "%d%n", n, &l);
for(size_t i=0; i<l-1; i++) {
str[l+i] = str[i];
str[l+i+1] = 0;
int c = atoi(str+i+1);
if(!tfind(&c, &set, &cmp)) return 0;
}
return 1;
}
void show_circ(const void *p, VISIT x, int level) {
static void* set = 0;
if(level == -1 && (set = (void*) p)) return;
if(x==preorder || x==endorder) return;
int n = **(int**)p;
if(is_circular(n, set)) printf("%d\n", n);
}
int main(int argc, char **argv) {
void *set = generate_primes(1000000);
show_circ(set, 0, -1);
twalk(set, &show_circ);
tdestroy(set, &free);
}


>>61316148
I used http://bisqwit.iki.fi/story/howto/openmp/
>>
>Skills:
>Java/JavaScript - excellent
>>
>>61316210
Nothing wrong with Java there. I wouldn't use it for hobby projects but it's the JVM that makes it so valuable

There's a lot of actually decent jobs writing server-side Java
>>
File: 1416801636242.gif (250KB, 320x320px) Image search: [Google]
1416801636242.gif
250KB, 320x320px
>>61316134
Thank you for making a non-Pajeet /dpt/
>>
>>61316185
>5-10 times faster
Surely its more than that.
>>
File: 1496988331440.jpg (20KB, 239x255px) Image search: [Google]
1496988331440.jpg
20KB, 239x255px
>>61316134
A simple express app for my portfolio. It's 2017 and user authentication is still a total pain in the ass. Using Auth0, because I didn't feel like making a whole new database for usersm writing auth logic, etc.

>This'll take 15 mins. I just used it in Angular the other day.

2 hours later, I finally got it running. Fucking JWT's. Mobile web ruining shit for everyone as usual.
>>
>>61316319
>>>/g/wdg
>>
What are keywords to look for in job postings if I'm searching for a non-developer code monkey job?
>>
Job posting
>Junior C Developer wanted
>Must have 4 years experience with C#

I really thought this was just a meme
>>
>>61316339
fucking lol
>>
>>61316339
Proof that C# is deprecated
>>
>>61316339
I saw one that was
>Junior dev position
>3+ years with Android
>4+ years with iOS
>at least 8 years working with Java in a professional environment
>pay 50-60k, but GREAT benefits!!
>>
>>61316317
The reason it's not even faster is because I used a tree based set rather than a hashset.

Which is actually really sad on python's part, that it still loses by a massive margin even when the C code is O(log(n)) instead of O(1). In practice, log(n) doesn't matter since you'll run out of memory before log(n) gets big, but what log(n) means in practice is a really high constant factor - because you're running some iterative code to binary search or travel down a tree.

And python still lost...
>>
should I read K&R, or Practical Programming?
>>
>>61316319
Why not just use OAuth? That's what it's there for.
>>
>>61316388
yes
>>
>>61316369
>And python still lost...
So you measured?
What's the result.
>>
>>61316433
After modifying the code to print one line same as the python:
me ~/Documents $ time python circ.py 
<removed the numbers cause I got flagged for spam>
real 0m0.619s
user 0m0.500s
sys 0m0.064s
me ~/Documents $ time ./circ
<removed the numbers cause I got flagged for spam>
real 0m0.112s
user 0m0.108s
sys 0m0.000s
>>
>>61316423
Thanks Coq.
>>
>>61316465
ty
>>
>>61316185
if (n[i:] + n[:i]) not in primes:

how does is_curcular have access to primes? its not in the function scope. or is python literally cancer/
>>
>>61316617
Python doesn't actually try to read variables until runtime, so what happens is, when primes = happens a few lines down, gets set up so that when that method gets called later, it doesn't throw an error.

The primes variable inside generate_primes is an unrelated one that happens to have the same name.
>>
>>61316657
jesus christ
>>
File: 1499676113241.jpg (197KB, 1920x1080px) Image search: [Google]
1499676113241.jpg
197KB, 1920x1080px
>>61316134
Learning assembly, little confused about where to learn what syntax with what compiler. Just used a random x86_64 I assume is intel's and nasm, but I don't want to dump money on books for something I probably won't end up using much. Any online resources or torrents out there that anyone would recommend?
>>
>>61316709
You read the reference manual.
>>
>>61316674
It's not much different from C in this case, besides the lack of a declaration - the only main difference is you're throwing away compile time errors for not much benefit.

This is one of the reasons why I think python's a great language with great builtins that can't be evaluated quickly and doesn't always scale well to large projects. (although it might better than C)

Now what's really different is closures. If you're not familiar with that, it'll be a mindfuck. I think they're great though. I just want them with a strong type system. But writing stuff like >>61316185 is fun once in a while.

>>61316709
I used wikibooks and wikipedia, but I learned the fundamentals of assembly from 0x10c before moving to x86. Intel syntax is a lot easier to read, just use nasm.
>>
>>61316737
And yeah I should add to >>61316750, I got used to reading shitty/obscure sources of information when good tutorials ran out
>>
File: x-all-the-things-template.png (100KB, 500x355px) Image search: [Google]
x-all-the-things-template.png
100KB, 500x355px
>>61316134
having just learned about the power of git
how long does the "git init all the directories!"-stage last? or is it a lifelong endeavour?
>>
why shouldn't I just use auto for everything in C++11?
>>
>>61317234
You should prefer auto in most cases.
>>
>>61317234
Never initialize an auto-typed variable with a braced initializer list.
>>
I want to know the following:

( current slope * 100/ max slope)
how would you look for the current slope with a class such as this?

class EarthLandscapeColors implements LandColorizer {


EarthLandscapeColors(){

}

public RGBColor computeColor (float height, float slope, TerrainInformation info){
int brightness = info.brightnessForSlope(slope);

if (height <(info.getWaterHeight()*1.1f)){
int light = brightness;
RGBColor sand = new RGBColor(light * 194, light *178, light *128);
return sand;
}
if (height < (info.getPeakHeight()*0.7f)){
int light = brightness;
RGBColor grass = new RGBColor(0,86, 63);
return grass;
}
if (height < (info.getPeakHeight()*0.9f)){
int light = brightness;
RGBColor rock = new RGBColor(85,85,85);
return rock;
}
else {
int light = brightness;
RGBColor snow = new RGBColor(250, 255,255);
return snow;
}

}

public int brightnessForSlope(float slope){
return (int) slope;
}

public int getGridsize(){

return 0;
}
float getWaterHeight() {
float seamirror =0f;
return seamirror;
}
float getPeakHeight (){
float maxheight = 0f;
return maxheight;
}
float randomSimplexNoise (int x, int y, float frequency){
return 0f;
}
}
?
>>
>>61317288
>>61317307
thanks, I was scared of it for some reason. Seems like magic, it's all compile-time costs?
>>
>>61317307
What does that do?
>>
>>61317316
Yes. The compiler can easily infer the type of a variable by what you initialize it with.
>>
>>61316134
Just started using swift for some iOS programming at work, it sucks and I miss F#. Why is swift being shilled as the future of programming?? Someone please explain.
>>
>>61317234
Because your IDE a shit and can't deduce type itself.
>>
>>61317350
>programming with an IDE
>>
>>61317321
std::initializer_list type
>>
>>61317375
lmao
>>
>>61317376
you can of course go auto d = double{1.23}; to avoid that but then why use auto in the first place?
>>
>>61317389
why would you use an initializer list for a single double?
>>
>>61317400
it's just an example, you can try to initialize whatever, it'll be deduced as an std::initializer_list
>>
File: weeb 420.jpg (34KB, 540x390px) Image search: [Google]
weeb 420.jpg
34KB, 540x390px
if i have no other work experience is it worth putting that im working a factory job on my CV when applying for tech and programming jobs? i dont want to add something to my CV that would make me look bad
>>
>>61317423
Changed in C++17.
>>
>>61317473
so
auto foo = {2, 3, 4, 5};
is deduced as an int[4]?
>>
#include <stdio.h>
int main()
{
char c;
while ((c = getchar()) != EOF)
{
if (c == '\t') printf("\\t");
else if (c == '\b') printf("\\b");
else if (c == '\\') printf ("\\\\");
else putchar(c);
}
}

This code works.
However, if I remove the "else if" statements and replace them with "if" statements, then input a tab, it'll print \t then print a tab, even though printf("\t") is supposed to just print "\t".
How come?
>>
>>61317484
Previously:
auto a = {42};   // std::initializer_list<int>
auto b {42}; // std::initializer_list<int>
auto c = {1, 2}; // std::initializer_list<int>
auto d {1, 2}; // std::initializer_list<int>


Now:
auto a = {42};   // std::initializer_list<int>
auto b {42}; // int
auto c = {1, 2}; // std::initializer_list<int>
auto d {1, 2}; // error, too many
>>
>>61317497
How do people defend this garbage language?
>>
>>61317497
uniform brace initialization syntax was a mistake
>>
>>61317505
Y- you get used to it.
>>
>>61317505
there's nothing better
>>
>>61317486
probably because it prints the "\t" and then putchar prints the tab.
>>
>>61317529
But puchar is inside an else statement, so isn't it supposed to be called only if c isn't equal to any of the aforementioned values?
>>
>>61317529
>>61317486
Also use a switch statement for this sort of thing. Or if you want to be a real G make a lookup table using ASCII values.
>>
>>61317486
Think of it like this:
// c == '\t'

// Does c == '\t'?
if (c == '\t') {
// Yes, print \t
printf("\\t");
} else {
}

// Does c == '\b'?
if (c == '\b') {
printf("\\b");
} else {
// No, do nothing
}

// Does c == '\\'?
if (c == '\\') {
printf ("\\\\");
} else {
No, print c, which is a tab
putchar(c);
}
>>
>>61317486
You visit every if statement, and on the last one it executes the else branch because
c == '\\'
is obviously false.
>>
>>61317540
Well, I'm only at the start of the book, so I don't think I'm supposed to use anything complicated. Switch would indeed be better though.
>>61317544
>>61317545
Alright, I get it now. Thank you.
>>
>>61317534
Nah, the else will only apply to the "if" immediately before it
>>
>>61317554
That's cool. It's not too hard though. The idea is you place your characters in an array and use the ASCII values to retrieve them.

e.g. vertical tab has an int value of 9 so you can use the char itself to access the array (+ whatever offset depending on the size of the array) to get the character that you need

Knowing about ASCII values and treating chars as numbers will help a lot when dealing with strings in C
>>
>>61317590
woops, meant horizontal tab

I've been drinking
>>
>>61317590
I see. I'll look into ASCII values eventually since I don't know shit about that.
>>
File: 1468016798295.jpg (66KB, 680x738px) Image search: [Google]
1468016798295.jpg
66KB, 680x738px
>tfw too scared to compile
>>
What is this disgusting shit?

https://www.raywenderlich.com/148448/introducing-protocol-oriented-programming
>>
>>61317975
why
>>
>>61318056
is this a new meme
>>
>>61318057
What if it doesnt work and I dont know why
>>
>>61318103
That's not part of the compiling process, that's part of the testing. Unless you can't solve syntax errors in which case you are a beginner and you should git gud.
>>
>>61318116
but once I compile I will have to test
Thats where the true horror begins
>>
>mfw it actually works
I did it boys
>>
>>61318159
So you are not afraid of compiling, you are afraid of testing your shit. The two are different.
>>
>>61318232
>So youre not afraid of fire, you are afraid of burning to death. The two are different
>>
>>61318250
Horrible analogy. Try again.
>>
>>61318256
t. BTFO
>>
>>61318265
t. cant program lol
>>
>>61318265
but it is a bad analogy.

a fire is active, meaning in this case the program has already been compiled

the proper analogy would be

>So you're not afraid of starting fires, you're afraid of experimenting with fire

most people are not afraid to light a fire, but throw shit in the fire and making sure it doesnt explode does lead to some fear

this translate to

most people are not afraid of compiling, but adding untested shit into the program and making sure everything works correctly does lead to some fear

lighter = compiler
fire = untested compiled program
>>
>>61318361
Nice reddit spacing, fag.
>>
>>61318382
>reddit spacing
this is the dumbest shit i've seen posted on 4chan.
I space my sentences for clarity.

fuck off
>>
>>61318382
I would've thought that most of the people on /g/ would actually sit down and consider logic but it turns out shitposters reside here too, huh
>>
File: 1499753101682.png (157KB, 1500x783px) Image search: [Google]
1499753101682.png
157KB, 1500x783px
>shitrunner
>>
>>61318392
Putting every single sentence into a new paragraph is the opposite of readable, you are supposed to create paragraphs that consist of multiple sentences that follow the same train of thought. Arbitrarily hitting the return key twice every few words makes your post very irritating to read.
>>
>>61318392
You need to leave.
>clarity
Putting a bunch of extra wasted space and breaking your lines in random places does not make your post more clear.
>>
>>61318409
>>61318415
he must've been hitting the enter key all day, it's probably inbuilt muscle memory at this point
This would work fine on messaging platforms but unfortunately, we're not on one
>>
>>61318392
>clarity
Are you retarded?
>>
>>61318409
but it is a bad analogy.
(end clarity)

A fire is active, meaning in this case the program has been compiled. The proper analogy would be:
(end clarity)

>So you're not afraid of starting fires, you're afraid of experimenting with fire
Most people are not afraid to light a fire, but throw shit in the fire and making sure it doesn't explode does lead to some fear.
(end clarity)
This translates to:
Most people are not afraid of compiling, but adding untested shit into the program and making sure everything works correctly does lead to some fear.
(end clarity)

lighter = compiler
fire = untested compiled program

I fixed 2 spaces, otherwise it's perfect as is.
>>
>>61318427
You're deliberately trying to stop doing it now. Your lack of capitalisation and punctuation (especially at the end of each line) is still giving you away.

Fuck off.
>>
File: 1499706027046.png (201KB, 1050x927px) Image search: [Google]
1499706027046.png
201KB, 1050x927px
>We are making a web browser!
>>
>>61318437
what
>>
>>61318437
That's not him you delusional moron.
>>
>>61318446
he's retarded and thinks im you based on something idiotic.
>>
>>61318446
>>61318459
>exactly one minute apart
Nice samefagging pajeet
>>
File: screen.1499774357.png (54KB, 1283x873px) Image search: [Google]
screen.1499774357.png
54KB, 1283x873px
>>61318471
>>
>>61318392
I agree with you. I've been on 4chan since around the Cracky-chan fiasco. I don't even have a reddit account.

And yet, suddenly the way I've always posted is "reddit spacing".

I just want to talk about programming.

>>61316134
>What are you working on, /g/?
Discovering the wonder and horror of using M.
>>
>>61318482
>I don't even have a reddit account
This is basically admitting "I am a redditor, I just don't post".
Fuck off.
>>
>>61318477
wow, nice, you know how to edit html
>>
>>61318512

shut the fuck up

brainlet
>>
>>61318574
And thank you for confirming that I was 100% correct.
Fuck off.
>>
>>61317505
I don't, I also use java and python
>>
>>61318408
>>61318444
Where is this code?
>>
Can I use JS in a browser to load only parts of an external JSON database into memory?
>>
>>61318641
>>61305715
>>
>>61318408
<in
>>
>>61317505
it's ... fine ... you just have to keep in your head 10 times more info than for java for example, and it's exponentially growing with the additions
>>
>>61318392
Line breaks are great for clarity, but you should use them to separate ideas or points, not every sentence. This is otherwise known as a "paragraph".
>>
>>61318444
Nothing wrong with this. It's just planned for future changes.
>>61318408
I don't know if there's clever ways to parse HTML.
How would you do it?
>>
>>61318713
>wants to write a browser
>doesn't know a shit about lexing
jesus fucking christ
>>
>>61318725
I'm not writing that shit anon. Why are you assuming?
>>
Why is the [ code ] window so fucking narrow?
>>
File: 1499776025626.png (6KB, 571x114px) Image search: [Google]
1499776025626.png
6KB, 571x114px
lmao
>>
File: sound.p8.png (3KB, 160x205px) Image search: [Google]
sound.p8.png
3KB, 160x205px
Babby programmer messing around in PICO-8 ("fantasy console" similar to BASIC machines, uses Lua)
Trying to mess around with peek and poke for the first time, setting the sfx memory to different values to try to change the pitch. I've got that working, but trying to change the waveform I have to edit bits in 2 bytes. A note is laid out like (sorry if code tags don't work):
w2-w1-pppppp ?-eee-vvv-w3

where w1-3 are the waveform bits (0..7), p is pitch, e is effect applied and v is volume. I can change the pitch easily since I can shift the bits left and right to get rid of w2-w1, but not sure how to get the waveform.
https://www.hastebin.com/fegapehopi.lua
>>
>>61318735
80 columns is the standard.
>>
Is COM still used? .NET seems to reference it a lot, but all the COM documentation is ancient.
>>
>>61318798
Have you tried google, dumbass? COM hasn't been used for 30 years.
>>
>>61318798
There's this neat thing called wikipedia.. you should try it.
>>
>>61318713
Use a parser
>>
The people who unironically believe in the "chrome shills" meme are ridiculous. You know how every second beginner gamedev wants to make a "MMORPG like World of Warcraft"? Imagine one of them. Reasonable people would always tell him that he has no idea how huge of a project this is and that he needs to scale down his ambitions considerably because he would never be able to pull this off alone, especially as a beginner.
Imagine he then responds "you fucken blizzard shills spreading FUD I can smell your fear you're truly pathetic".
That is pretty much what's happening in the Netrunner thread.
>>
>>61318798
Decades worth of legacy software that you'll likely have to interop with at some point
>>
>>61318934
Just let them waste their time. Everyone that starts a mmorpg ends up leaving it but learns something along the way: that they fucking suck.
>>
>>61318749
that's a bullshit guideline, not standard
>>
In C, how is
array[var - '0']
any different from
array[0]
?
If I'm not mistaken, 'x' tells C to work with the value associated with x by the compiler instead of "x" itself (for example "\n" has a value of \n but '\n' is stored as an integer value). Is that right?

Then do numbers from 1 to 9 take the same value (respectively 0 through 9) when read by the compiler? But in that case why would we need to write '0' instead of just 0?
>>
>>61318934
Yeah because there are no shills on 4chan.
>>
>>61318994
FUCK I meant
array[var - 0]
, not
array[0]
. Sorry.
>>
>>61319000
Take your meds, mongoloid.
>>
>>61318994
no the actual value of 0 is 48 from ascii
>>
>>61318994
Are you fucking retarded?
>>
>>61318934
>>61318976
How hard it it to make a game really?
I'm not talking about something huge with amazing graphics. But what about something like the gameboy pokemon games, or any 2D RPG?
>>
>>61318994
'0' is 48 in ASCII table
>>
>>61319018
See >>61319010
>>61319012
>>61319022
Ok, thanks.
>>
>>61319020
https://en.wikipedia.org/wiki/Undertale
>>
>>61318994
What shit language did you come from where '0' is equal to 0?
>>
>>61318994
In C, something in single quotes is a character literal, and something in double quotes is a string literal.
That character '0' does not mean the integer zero.
'0' // ASCII value is 48
"0" // An array, equivalent to {48, 0}
0 // The integer zero
'\0' // The null character, also has the integer value of 0

When you're dealing with an ASCII digit, you can subtract '0' (the character) to the digit as its integer value.
e.g.
'7' - '0' = 55 - 49 = 7
>>
>>61319011
oy vey
>>
>>61319063
stop calling that shit a string

strings are in C++
>>
>>61319063
Thank you
>>
>>61319075
(You)
>>
>>61319075
idiot
>>
File: Untitled.png (69KB, 1047x710px) Image search: [Google]
Untitled.png
69KB, 1047x710px
>>61319075
kys
>>
File: 1499748978460(1).png (4KB, 400x600px) Image search: [Google]
1499748978460(1).png
4KB, 400x600px
>>61319080
>>61319083
there are no strings in C, you redditors

go back 2 school
>>
>>61319075
This better be bait.
>>
>>61319115
Want to know how I know you're a brainlet?
>>
>>61319115
>there are no strings in C
lol
>>
>>61319020
It mainly takes time.
>>
>>61319133
>>61319156
There is no string type in C. You have to use char arrays.
>>
Sorry if this would be better in sqt but, I've just started learning C# and I'm going through microsofts virtual academy tutorials but I have a question that isn't explained. If I'm making a simple program that asks the user to enter only a or b how do I keep the program running until they do it? I tried doing a while the user value isn't a or b just keep asking but then even when I enter a or b it still doesn't move on.
>>
>>61319183
Nobody said anything about string types, brainlet.
>>
>>61319133
>Want to know how I know
Yeah sure kid
>>
>>61319184
goto
>>
>>61319133
>>61319196
>brainlet
[-]>[-]>[-]>[-]++++++++++++[<+++++++++<++++++++++<++++++++++>>>-]<-.<+.<-----.
>>
>>61319196
>Nobody said anything about string types

brainlet detected
>>
>>61319229
>>61319228
>>
>>61319184
Post code, there's probably some small error
>>
>>61319184
Don't use goto, use a while loop.
>>
>>61319228
++++++++++[>++++++++++<-]>+++++++.++++++++++++++.------.<+++++++++[>---------<-]>--.<++++++++[>++++++++<-]>++.++++++++++++++++.-----------------.++++++++.+++++.--.-------.+++++++++++++++.
>>
>>61319254
what do you think a while loop is
>>
>>61319254
Are you dumb?
>>
>>61319254
loops are glorified jumps
>>
>>61319247
while ((userChoice != "A") || (userChoice != "B"))
{
Console.Write("Enter A or B: ");
userChoice = Console.ReadLine();
}


It just infinitely loops here, I'm sure I'll learn other ways once I move past the tutorial I'm just wondering what the error here is, I assume it's something to do with the or.
>>
>>61319254
brainlet detected
>>
Im currently in the idea phase for a website

I want to make an account system that's as barebones as possible but doesn't need an e-mail registration and also has a "newfag" filter. The idea is that you can only use the site (i.e. doing anything other than read) if you've been lurking for some time.


My plan:
Clicking on register gives you a random string of letters and numbers. The server will save this code and track time. After x amount of hours/days/weeks the code will be automatically marked as "ok" so if you use that code in a log in field you will be able to post.
The idea is that users will hold on to their personal code as their "account".

I have no idea about any of this and I assume there will be some problems with it (security, abusable, logistics)
>>
>>61319303
And of course I fixed it seconds after I posted it, it needed to be an and not or
>>
>>61319303
>that format
disgusting. kys brainlet.
>>
>>61319260
++++++++++[>+++++++++++>++++++++++>++++++++++>++++++++++>+++>+++++++++++>++++++++++>+++++++++++>++++++++++<<<<<<<<<-]>.>+++++.>-.>+.>++.>-.>+.>-.>+.
>>
>>61319303
&& not ||
>>
>>61319319
++++++++++[>+++++++++++<-]>++++++.------------.++++++++++++++++.
>>
>>61319315
reddit had easy registration and requirement for older account to post on some subreddits
>>
>>61319254
guaranteed replies
>>
>>61319333
++++++++++++[>++++++++>+++++++++>++++++++>++++++++>+++++++++>++++++++>++++++++<<<<<<<-]>+++.>----.>+++++.>+++.>-.>+++++.>++++.
>>
>>61319373
Why do you know this?
>>
>>61319315
Logistically isn't it like a reverse discord link? Randomly generate a code but instead of expiring it activates after a set time.
>>
File: alanhappy.png (182KB, 451x496px) Image search: [Google]
alanhappy.png
182KB, 451x496px
Why do we need bash or powershell when D exists? It's much more pleasant to use it for simple scripts, Andrei and Walter should really market it like a modern and sane scripting alternative
>>
>>61319418
I understand your sentiment, because I use C# as a scripting language most of the time. I'm unsure how much first-party support D has for Microsoft products, such as Azure resources, and things like Exchange/Active Directory, though.
>>
>>61319418
>alan happy
Every time I look at him I can't help but think of all the terrible things people did to him.
>>
>>61319418
show an example of a bash script rewritten in D?
>>
>>61319418
>memory management in a scripting language
goddamn it D needs to decide what it wants to be
>>
>>61319414
Sorry I don't use discord but yes, that's the plan. This way, possible ad/spam bots would need to wait a while and if I limit code generation (Sorry, you can only generate 1 code per day - or something) I SHOULD be relatively safe. But what do I know, that's why I ask.

If I would want to ban a user, I would only need to ban the code they were using.
>>
>>61319458
It'd be easy to do, 4chan already does the same thing for people with passes it gives you a randomly generated one and once you get banned they just deactivate the pass.
>>
>>61319418
>Why do we need bash or powershell
we don't because we have python
>>
>>61319315
>(security, abusable, logistics)
>security
The code should be long enough so it isn't easily bruteforcable. If you want to increase security a bit track false IDs and ban on X tries.

>abusable
You can share the ID with friends. You can generate many IDs and then just wait.

>logistics
People would have to bookmark the ID. I think for a prototype you could make the amount of waiting time pretty short and maybe open up several functions / areas depending on the waiting time.


>>61319316
Rubber duck debugging
>>
>>61319418
Python > D for scripting
>>
>>61319447
they would have left him alone if he had had long term relationships or with honorable gentlemen like a normal human bean, but instead he fucked random hoodlums and foreign spies

JFK was offed for the same reason, btw
>>
>>61319481
Nice

I'm going to learn programming this September and always wanted to have my own site. I just want to experiment a bit and keep everything as simple as possible. Thanks for your replies, once I actually know more I'll probably come back.
>>
>>61316388
K&R then the practice of programming by Pike
>>
File: rubberduck.jpg (3MB, 3264x2448px) Image search: [Google]
rubberduck.jpg
3MB, 3264x2448px
>>61319499
>Rubber duck debugging
hahaha it's been a while
>>
>>61319456
it's a high level systems language
>>
>>61319447
what did they do to him and what did he do
>>
>>61319451
*crickets*
>>
>>61319547
>not using Tyâ„¢ Burrows the Meerkatâ„¢ as your rubber duck
>>
>>61319451
% cat myprog.d
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
% ./myprog.d
Hello, world with automated script running!
% _
>>
>>61319547
is that django?
>>
>>61319606
How long does it take to run (as a script) compared to the equivalent in python or shell
>>
>>61319606
that's what you use bash for you brainlet?
>>
>>61319628
now you have more than one option, brainlet
>>
Is there anyway to learn Visual Basic for Applications without buying Microsoft Office?

My job has Excel and I'm looking to do some scripting for my job as inventory manager. However at home I don't have or need Microsoft office. I've been looking for torrents but they all either are rips which don't include VBA or do not work.

Microsoft has a trial period but you need to fork over your credit card info and cancel your subscription. I don't trust them with that stuff. The whole thing seems sketchy and very jewish to me.
>>
>>61319578
>what did he do
was gay ("Gross indecency")
>what did they do to him
Chemical castration.
>What happened later
https://en.wikipedia.org/wiki/Alan_Turing_law
To not consider your rule to be tainted by this and "pardon" people is grossly indecent. I suggest we chemically neuter parliament instead. If you're willing to join in ruling a state with such a horrid history and reputation as the UK something is wrong with you.
>>
>>61319660
>>61319660
well serves him right then perverted degeneracy should be treated
>>
>>61319642
If you can't go to your company and ask for a license for self-training, you need to find a new job.

That being said, if you're using VBA instead of M or DAX, you probably need to find a new job anyway.
>>
>>61319636
an option to print a string in 7 lines??

do something bash like, like traverse a directory based on a regex patters and append every file with a new line
>>
>>61319642
you can manipulate excel files using poi/npoi from java and c# without having office installed, I managed to solve several tasks using it and libreoffice to check things. not sure how if it works good with complicated documents
>>
>>61319686
All he did was be gay. He wasn't even convicted of buggery which is basically jut anal sex between men.
>>
>>61319660
>Murray told Turing that the burglar was an acquaintance of his, and Turing reported the crime to the police. During the investigation he acknowledged a sexual relationship with Murray. Homosexual acts were criminal offences in the United Kingdom at that time
Basically he fucked up.
>>
>>61319447
It was fucked up for sure, basically kill a brilliant man. But sometimes I think it kinda means that uk justice system was/is actually alright, dura lex sed lex, legal egalitarianism all that shit
>>
>>61319694
Shit....time to learn java I guess.

>If you can't go to your company and ask for a license for self-training, you need to find a new job.

Yeah my job fucking sucks. I'm trying to do some programming stuff with it so I can build a portfolio and find a better one. I don't think think they'll provide me a license. They'll probably be like "....We installed this 5 years ago I have no idea how this thing works"
>>
File: codeblocks.png (7KB, 211x270px) Image search: [Google]
codeblocks.png
7KB, 211x270px
How the fuck do I set the file to compile in a project on codeblocks?
I want to compile the game.cpp, but it keeps trying to build from the board.cpp
>>
>>61319742
Well yeah certainly. What should have happened is a reconsideration about the law. That's the problem with almost all legal systems. People rule against their will. So if you're the kind of person that decides to inherit these laws instead of do over the guilt falls on you.

And to act devils advocate, they were morons back then. Their idea of treating homosexuality is to neuter you. Which is just bonkers.
>>
>>61319768
>codeblocks
hahahahahahahaha
what fucking year is this?
>>
>>61319769
how is this bonkers? homosexuality is a sexual deviation, castrating someone solves the problem
>>
>>61319743
If you're on Windows I recommend C#
>>
>>61319780
it's 2017, bigot
>>
>>61319780
hey at least he's not using dev-cpp
>>
>>61319698
bullshit, learn the story before posting

https://en.wikipedia.org/wiki/Alan_Turing#Conviction_for_indecency
>>
>>61319768
People still use codeblocks?
>>
>>61319768
Use a good IDE like Jetbrains or QtCreator, or use a text editor + makefiles

>>61319795
Fuck I'd forgotten about this.
>>
>>61319797
are you blind or just retarded
>>
>>61319803
Neither.
>>
>>61319807
how cum?
>>
>>61319768
Why are you using codeblocks you dolt?
>>
>>61319820
>>61319802
>>61319797
>>61319795
>>61319780
fuck off nodevs
>>
Is there anything more euphoric than compiling with text files in the command line? It just werks
>>
>>61319796
Was he convicted for buggery? No he was convicted for gross indecency.
Admitting a sexual relationship doesn't mean you're having anal sex.
Explain to me how he wasn't convicted of gross indecency.
>>
>>61319780
>>61319797
>>61319802
>>61319820
Just answer my question, I don't give a shit about your IDE of choice.
>>
File: weqrwgfzd.png (53KB, 225x225px) Image search: [Google]
weqrwgfzd.png
53KB, 225x225px
>>61319820
>>
>>61319833
No.
>>
>>61319780
>>61319797
>>61319820
Stop memeing and help that anon you doofuses
>>
>>61319825
>>>/vg/agdg
>>
>>61319825
>nodevs

cringed
>>
>>61319825
fuck off brain::let
>>
>>61319851
let brainlet = you;
>>
>>61319833
How are people supposed to know this?
It's your IDE.
Ask google.
>>
File: code-640x1097.jpg (72KB, 640x642px) Image search: [Google]
code-640x1097.jpg
72KB, 640x642px
>On May 4, 2015, The Singapore Prime Minister Lee Hsien Loong posted his Sudoku solver program in C++ on Facebook. In his screen shot, he's using Microsoft Windows and Dev-C++ as his IDE.
hahaha what the fuck
https://en.wikipedia.org/wiki/Dev-C++
>>
>>61319870
>Ask google.
I did it and didn't find anything
>>
>>61319829

he was having gay drama with street scum involving police and LITERALLY GOT HIMSELF CONVICTED

even today, the system will convict if you insist, but that's very far from the norm, eg drug laws, prostitution, etc
>>
>>61319833
>just give me tech support fuck you
>>
>>61319875
Pretty cool
>>
>>61319833
stfu you piece of shit
>>
>>61319691
*crickets*
>>
How do I create an object in C?
>>
>>61319893
Do you even read what you link?
>>
>>61319917
Type name;
>>
>>61319917
malloc
>>
>>61319875
>Lee Hsien Loong

The last program I wrote was a Sudoku solver in C++ several years ago, so I’m out of date," he said. "My children are in IT, two of them—both graduated from MIT. One of them browsed a book and said, 'Here, read this.'" It was a textbook on the Haskell programming language, Lee recounted. "One day that will be my retirement reading."
>>
what if there were a computer whose firmware had a hidden built-in lightweight ide for freestanding c so you could write your os and test it on the same machine without using other media and without worrying about accidentally overwriting the environment you were writing it in
>>
>>61319917
you
int killyourself = *(int*)0;
>>
>>61319930
neat
>>
>>61319930
Makes you question if American voters are trying their best.
>>
>>61319875
that's cool
what would pence code i wonder
>>
>>61319919
yes, take off your 21st century brainwashed SJW moron glasses for a second
>>
>>61319930
haskell btfo
>>
>>61319968
unsigned long long please_give_me_this_much_money = 0;
please_give_me_this_much_money--;
>>
>>61319973
>burglar
>turns out to be someone he knows tangentially
>reports the person to the police
>accidentally mention his relationship with the person who knew the burglar
>had gay street drama with street scum
I can't remember reading that last bit. Could you screenshot it for me?
>>
>>61316185
>calling malloc without freeing it
nice memory leak senpai
>>
I want to jump on the wasm hype train, what neat project should I make?
>>
>>61319917
To define an object type:
struct YourObjectType {
/* any variables declared in getter
here will be object properties */
};

To create an object:
struct YourObjectType your_object;
/* Note that the prefix "struct" is necessary both when defining struct types and when using them */

Remember to pass it by pointer in any function that needs to modify it, because if you pass it by value, the changes won't persist after the function call. Also never return an object by pointer, because that pointer will be invalid once the function that created it is popped off the call stack.
>>
>>61320022
OS handles it
>>
>>61319991
>accidentally mention his relationship

"accidentally mention his lsd use"

you're a hopeless SJW imbecile, fuck off
>>
File: grisha.jpg (37KB, 620x320px) Image search: [Google]
grisha.jpg
37KB, 620x320px
>>61320076
>a genius is a literal autistic baby in every aspect of his life apart from his field of study
wow no shit

I remember reading that pierre and marie curie were depressed and sad with their family life because they literally didn't know how they were supposed to cook food
>>
>>61320139
He's implying that he deserved to die for being gay, not that he was careless in disclosing his status as a gay.
>>
>>61320139
Turing decided to bury silver for safe keeping during WW2 and then he forgot where he buried it.
>>
>>61320139
well, he told his lawyer not to dispute the charges and then plead guilty

I think this was not autism, he was insane and looking for a way out of his criminal street scum fucking habbit

then accepted some experimental treatment regiment while british jails for his class looked pretty comfy, Oscar Wild wrote books in there
>>
Are there any good GitHub-based projects that need help?
>>
>>61320215
Just look for open issues on projects in languages you know.
>>
>>61319768
I have trouble understanding what you're asking.

>How the fuck do I set the file to compile in a project on codeblocks?
You press F9 to build it? When you add a file to a project, C::B will handle its compilation. Automatically.

>it keeps trying to build from the board.cpp
What?

What exactly are you trying to do?
>>
>>61320228
Isn't almost everything on GitHub written in English?
>>
>>61320205
It's nice that the toilets have walls.
I think if I lived in one of these I'd be pretty chill with it. The bed looks like shit but that's to be expected. I think I'd rather just sleep on the floor. I sleep on the floor anyway, so I'd be right at home.
>>
>>61320350
No, lots of chinese and spanish speakers use GitHub.
>>
>>61320367
that's a very good bed, it's just pictured without a mattress
>>
>>61319768
That's weird. It should be building from literally everything, and the resulting program would start by calling main. Have you defined main? If so, it should be """"building from"""" whatever file that's in. But make sure you haven't defined it more than once (including across files), because that's invalid C++. Also make sure you're generating your makefile automatically and not using a custom one that may not be doing what you want.
>>
File: old british prison.jpg (30KB, 615x409px) Image search: [Google]
old british prison.jpg
30KB, 615x409px
>>61320367
this is what a bed was like
>>
File: Oscar_Wilde_Prison_Cell.jpg (86KB, 340x227px) Image search: [Google]
Oscar_Wilde_Prison_Cell.jpg
86KB, 340x227px
>>61320367
lots of room for activities and no distractions

you can reinvent computer science ten times in here
>>
>>61320488
or just masturbate your whole sentence
>>
>>61320428
Well hey that's pretty nice.

Even so, I don't think prison is bad enough for criminal scum. But paradoxically, it also feels inhumane.

Perhaps a better solution would be exile.

The natural world has no laws. Everyone's a sociopath there. Freedom is infinite, but survival is difficult. Criminals would probably be happier there, and yet the prospect of going there would probably be enough to deter them from crime. Best of both worlds really.
>>
>>61320505
brainlet
>>
>>61320423
brainlet
>>
>>61320556
why are you calling someone a brainlet for being right
>>
This is valid JavaScript:
                   $$
=-~-
~[];$_
=$$+ $$;
_$=$$+$$+-
~[];_=-~[];$
=!![]+[];__={}
+[];$$_=/\\ /+[]
_$$=(![]+[])[_]+(!
[]+[])[$$]+$[$_+~[]]
+$[_]+$[+[]];$=__[_$]+
__[_]+($[$]+[])[_]+(![]+
[])[$_+~[]]+$[+[]]+$[_]+$[
$$]+__[_$]+$[+[]]+__[_]+$[_]
_=$$_[_]+-~[];$[$][$](_$$+'("'
+_+-~[]+-[]+_+$_+_$+_+_$+$_+_+_$
+$_+_+_$+[$$+_$]+$$_[-~[]]+$_+-[]+
_+$$+[$$+_$]+_+_$+[$$+_$]+_+[$$+$_]+
$$+ _+_$
+$_+_+$_
+$_+'")'
)($)
>>
>>61320594
it's july you fucking bible belter
>>
>>61320594
still more readable than sepples.
>>
>>61320594
but what does it do?
>>
>>61320594
>copy and paste into console
>it actually works
hahaha holy shit
Can someone please explain what's happening here?
>>
>>61317114
kys or go back to /reddit/
>>
>>61320594
but someone said yesterday that javascript can't be obfuscated...
>>
>>61320625
http://www.jsfuck.com/
>>
>>61320594
holy shit thats actually a stupid hello world! program
>>
>>61320594
dear god what
>>
this thread is full of children
>>
r8 my implementation of javashits in sepples
#define var auto
>>
I got tired of manually renaming my subtitle files, so I wanted to make it easier for me.
Is there a better approach to this and am I complicating things? How do I avoid 4 levels of indentation?
I'm a beginner.

https://codepaste.net/ruzypa
>>
>>61320698
yes
>>
>>61320710
Now do prototypical inheritance
>>
>>61320698
What's the advantage of being an adult anyway?
>>
>>61320751
operator. in C++17 will let you do that pretty much
>>
>>61320756
U can fuck traps wearing programming socks.
>>
>>61320594
Is shit like this possible in any other language?
>>
>>61320801
looks just like perl to me desu
>>
>>61320717
It's perfectly reasonable. Only complaint would be the number of obvious comments but you should only complain about comments when they're wrong. I could hide them if I wanted to.
I don't think 4 levels of indentation is a problem but you can use more functions if you feel it's necessary to reduce that.
Or optionally I'm sure there's some way in python to only iterate over elements in a list that meets a condition.
>>
>>61320801
Perl
>>
>>61320022
You should at least try running my program in valgrind before accusing me of having memory leaks
==7457== HEAP SUMMARY:
==7457== in use at exit: 0 bytes in 0 blocks
==7457== total heap usage: 156,997 allocs, 156,997 frees, 2,826,952 bytes allocated
==7457==
==7457== All heap blocks were freed -- no leaks are possible


>>61320072
Actually I do
>>
>>61320698
must be why you're hanging around
>>
>>61320717
>>61320813
Also this only handles 3 letter extentions. Which is obvious from line 48. But if you're fine with that there's no problem. I'd probably search for the dot and replace from there instead.
>>
Using codyacademy to learn basic python. Im under no illusuion i'll come out of this with no more than a basic understanding of Python but is there any better way? I'm using Learn python the hard way for reading. I'm going into this with a decent understanding of bash.
>>
>>61320813

I added the comments so people on here can figure it out even easier.
I tried using functions, but I don't really understand how those would reduce my levels of indentation. Many levels make it look ugly when I try to stick to the 79 character style guide limit (have to split across lines).
>>
>>61320022
>>61320836
The calls to free happen at
tdestroy(set, &free);
>>
>>61320911
You shouldn't need to explain this. It's obvious.
>>
how do I add the same ad network on all the platforms unity can build?
>>
>>61320949
Anon please. Go to /agdg/.stop shitting up our thread.
>>
>>61320890
Automate the boring stuff with python is a million times better than either.
>>
File: sad_froge.png (225KB, 2400x2400px) Image search: [Google]
sad_froge.png
225KB, 2400x2400px
>>61319875
>>61319930
>America will never have a president like this
>>
File: Mark-Zuckerberg.jpg (118KB, 1024x1001px) Image search: [Google]
Mark-Zuckerberg.jpg
118KB, 1024x1001px
>>61321151
Are you sure?
>>
File: donald-trump-happy-ap.jpg (26KB, 480x360px) Image search: [Google]
donald-trump-happy-ap.jpg
26KB, 480x360px
>>61319930
>>61319875
I didn't know the President of Indonesia was a developer, that's pretty impressive
>>
New thread:

>>61321347
>>61321347

>>61321347
>>61321347

>>61321347
>>61321347
>>
>>61321302
Christ, please god no. Having to look at that Android's face failing to impersonate a human for 4 years sounds like hell.
Thread posts: 313
Thread images: 27


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