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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 331
Thread images: 25

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>58621095

What are you working on /g/?
>>
First for using hashmaps for everything.
>>
>>58626701
>not using function ASTs
>>
>>58626718
>not using hashmaps
>>
My C++ debugger is fucked.
What do?
>>
>>58626835
Learn how to use a real debugger.
>>
>>58626835
Debug it.
>>
nodejs and electron for a car management appthing. can't be bothered to have a notebook with all the issues of my cars, just wrote an app for that.
THE FUTURE IS NOW BOIS.
>>
>>58626857
That's absolutely disgusting.
I just puked in my mouth a little, and then couldn't stop myself from throwing up
>>
What happens if I have a function that takes a void pointer, and I don't pass anything in, then I call delete on the void pointer?
>>
>>58626857
>nodejs
Stopped reading right there.
You're stupid.
>>
>>58626875
free(NULL) is defined to be a NOP.
>>
>>58626868
I'm so sorry I'm using efficient and easy to use things that are my disposal to create something that will be used by me. A Java note-taking app eats 116MB of RAM (literally did this earlier to test), this eats 29MB. Suck a dick pajeet.
>>
>>58626857
literally a notepad: write down problems. cross out fixed problems.
>>
>>58626897
Who the hell brought up Java?
>>
>>58626875
Magic
>>
>>58626875
>don't pass anything in
Are you bypassing the type system with a cast?

Anyway it's UB, will likely call delete on whatever is in the register/stack where it expected the argument to be.
>>
>>58626897
So the only two languages you've ever heard of are Java and Javascript?
Why am I not surprised.
>>
>>58626897
>efficient
kek
>>
nvm fixed it lol
>>
>>58626940
Depends what you mean by initializing it, did you allocate memory with new? If not, UB.

That "function that shouldn't be called" might be the result of UB or more likely just a bug.

Whatever, valgrind that shit.
>>
>>58626984
see
>>58626974

Also
>valgrind that shit
>not devving on windows
>>
>>58627013
>>not devving on windows
(You) are retarded.
>>
File: code.png (24KB, 304x674px) Image search: [Google]
code.png
24KB, 304x674px
>>58627019
I'll bet this pleb doesn't even code in Chiller.
>>
File: 1480711367564.png (478KB, 705x397px) Image search: [Google]
1480711367564.png
478KB, 705x397px
>>58627087
>>
>/dpt/ - /agdg/ Overflow
>>
>>58627087
so droopy and unreadable it looks like arabic
>>
>>58627218
>/agdg/
Still surprises me that there's a programming general on 4chan with more shitposting and autism than here.

Also stop sending people here, we don't send anybody to you.
>>
File: 1482593375642.png (1MB, 1040x1000px) Image search: [Google]
1482593375642.png
1MB, 1040x1000px
>>58627265
>we don't send anybody to you
well, we don't send EVERYBODY to them
>>
File: cute anime pic 0388.png (213KB, 600x393px) Image search: [Google]
cute anime pic 0388.png
213KB, 600x393px
I'm already regretting taking a webdev course
>>
>>58627284
Don't you have a Trump protest that you should be rioting at?
>>
>>58627284
>>>/vg/agdg/
>>
>>58627310
?
>>58627311
Hell no
>>
File: download.jpg (7KB, 225x225px) Image search: [Google]
download.jpg
7KB, 225x225px
Queries.
>>
>>58627284
>>58627333
how about this then
>>>/g/wdg
>>
File: ChicagoChildren.jpg (362KB, 1600x1200px) Image search: [Google]
ChicagoChildren.jpg
362KB, 1600x1200px
How do you create a regex that exactly matches a string with a dot?

i.e.
example-1.0
example-1.1
example-1.2
>>
>>58627350
This is my home
>>
/comeng/ when? I'm sick of you idiots.
>>
>>58627359
\.
>>
>>58627333
>?
Huh?
>>
>>58627381
Why would I be rioting at a Trump protest?
>>
>>58627394
Because you're programming in webdev-ese instead of a manly, dick-swinging American language like C. You're obviously a SJW.
>>
>>58627394
Where else would an antifa "member" be right now?
>>
File: 1480974118479.png (518KB, 974x974px) Image search: [Google]
1480974118479.png
518KB, 974x974px
>>58627414
>C
>manly

C is for anime girls and traps
It's the least manly language out there
>>
>>58627414
>>58627422
It's okay, I'll write a few OS's to cleanse myself of it when I'm done
>>
I have a "while(1)" loop, and it just feels wrong.
i does what i need and i cant think of a better way without gotos.
int linesToIterate = scrollY / atlasInfo[1];
if(linesToIterate > 0) {
while(1) {
if(i < stringBuilder->curEles) {
if(stringBuilder->data[i] == '\n' || (bufferedChars += 1) == maxCharsPerLine) {
linesToIterate -= 1;
if(linesToIterate == 0) {
break;
}
}
} else {
stringBuilder = stringBuilder->next;
i = 0;
}
}
}
>>
>>58627359
.+-\d+\.\d+

?
>>
>>58627377
I definitely know I'm doing something wrong, but what is it?
https://regex101.com/r/uJkZy2/2
>>
>>58627359
haskell/parsec

sepBy (many1 $ noneOf ".") (char '.')
>>
>>58627427
> []
> not {} for C
I mean, [] are used just for the array-expressions, [] belongs more to shell scripting tests
>>
>>58627453
>while(1) loop
>just feels wrong
Well I wonder why.
>>
>>58627520
Me too, i was hoping some of you guys would have some insight.
Apparently your as befuddled as i am.
>>
File: weak typing.png (2KB, 209x18px) Image search: [Google]
weak typing.png
2KB, 209x18px
>>58627518
that particular image wasn't very C
>>
>>58627518
arrays decay into pointers
>>
>>58627537
That is extremely c, their just missing parentheses around the params of sizeof().
>>
>>58627464
I don't know what your shitty online thing is doing but

example-1\.\d
>>
>>58627576
That makes more sense. Thanks!
>>
>>58627559
>their just missing parentheses around the params of sizeof().
Nuh-uh, clearly you don't know C.
sizeof is an operator, not a function. The parentheses are just optional eye-candy
>>
File: you wouldn't steal a car.png (119KB, 563x378px) Image search: [Google]
you wouldn't steal a car.png
119KB, 563x378px
>>58627559
>>
>>58627587
wrong.
sizeof has two forms: one that uses a unary expression and one that uses a type name

sizeof unary-expression
sizeof ( type-name )


the parans are required if you do a sizeof of a type name.
>>
>>58627587
glBufferData( GL_ARRAY_BUFFER, 4 * 2 * sizeof GLfloat, verts, GL_STATIC_DRAW );

the error is:
expected expression before start of GLfloat.

glBufferData( GL_ARRAY_BUFFER, 4 * 2 * sizeof(GLfloat), verts, GL_STATIC_DRAW );
works fine doh.

its ok dude, maybe we are using difference compilers.
i stick to gcc.
>>
>>58627598
Oh, right.

Whatever! I obviously meant that you can write
sizeof declval<boy>()
instead of
sizeof(boy)
, because that's clearly much better
>>
>>58627626
Oh i thought we were talking about C, not C++.
Didnt realize you changed the topic without telling any of us.
>>
>>58627636
Obviously when people say "C" they mean the inferior subset of C++, so that is perfectly fine. Yep.
>>
>>58627646
This is some pretty weak bait.
Here is your (You), though.
>>
File: 1471761644797.jpg (100KB, 500x500px) Image search: [Google]
1471761644797.jpg
100KB, 500x500px
How much does an average Haskell programmer earn?
>>
>>58627427
>C
>for Traps
That would be any dialect of Fortran.
C is a language made for men with wills made of metal to get down and interact with bare metal.
>>
>>58627731
1/2 tendies/hour.
>>
what are people's thoughts on "learn you a haskell"?
>>
>>58627731
It's probably a whole lot of money, or at least that's what they say in theory.
>>
>>58627756
shit grammer
>>
>>58627731
http://www.haskell.com/jobs
>>
>>58627731
$0
>>
>>58627756
use the wikibook instead

>>58627764
it's intentional
>>
Do people actually pronounce CLI and GUI as "cly" and "gooey" or is the author of this book I'm reading just a cornball?
>>
>>58627817
I do
>>
>>58627817
Cly and Gwy
>>
>>58627817
I also agree that they are retarded.
I say
CLI: See Ell Eye
GUI: Gee You Eye
SQL: Ess Queue Ell
>>
>>58627817
I've heard people say gooey, they sound like faggots but it happens.

Have never heard anybody say "cly".
>>
>>58627817
"command-line interface"
"graphical user interface"
>>
How do you even program in C? I cant even find an easy way to filter items from an array with google search?
>>
>>58627904
Throw some malloc's around and call it a day
>>
>>58627904
>How do you even program in C?
With a text editor and C compiler, usually.
>I cant even find an easy way to filter items from an array with google search?
In place? As a new allocation?
Do you actually want to remove elements, or just do sometime for each matching element?
>>
>>58627904
If you'd paid attention in class you'd realize that they are in fact teaching you how to program in C.
>>
is it true that once you can think like a programmer learning another language is just about learning the syntax or is it a meme?
>>
>>58627904
>filtering items from an array
It's easy if you're creating a new array, otherwise you need to memmove on every element you remove.

Try using a list, a data structure meant for this shit.
>>
>>58627969
It's mostly true. The languages you can't pick up in a couple of days turn out to be useless for any kind of real work.
>>
>>58627904
with great difficulty
>>
>>58627971

you mean LINKED LISTS?
>>
>>58627969
More or less, because every language has a set of functionality that are among them. Though, obviously, some implementer more features depending on how "high" the language is.
>>
Anyone has experience with ASP.NET? What's your opinion of it and how does it compare to a MEAN stack? What are the best practices to do?
>>
>>58627971
I'm certain that making a new array is going to be better than doing it with a linked list.
>>
>>58627992
YES!??!

Kinda, meant type not structure. Linked list is the easiest implementation though.
>>
File: i_know_youre_listening.png (19KB, 390x288px) Image search: [Google]
i_know_youre_listening.png
19KB, 390x288px
what is anyone in /g/ actually doing to avoid botnet etc...?
>>
>>58628047
Masturbating furiously
>>
>>58628047

windows defender and common sense
>>
>>58627766
Oh shit, I was just poking around but that site is INSANELY vulnerable.

The C# backend is full of holes. Directory listing is enabled, I found a list of employees with phone, adress, mails lying around, and many of the Admin pages and other pages don't require any authentification if you can find them...
>>
>>58628047
I purchased botnet insurance from some guy on /g/, feeling pretty safe.

Just wished I had some way to contact him.
>>
Is it """WRONG""" to ignore a sites API and use regular requests and parsing to get what you want? Fucking hate how all APIs require Oauth even for read-only activity.
>>
in java at what point is it worth to go off heap for extra speed?
>>
>>58628097
It's probably against the ToS.
>>
>>58628097
Ethically?
>>
>>58628101
At about the same point it becomes urgent to switch to C++
>>
>>58628101
If you have to ask this question the bottleneck isn't java
>>
>>58628115
>>58628101
come on guys, let get off java
like i just got off your mom
>>
>>58628115
>hey lets just rewrite the whole codebase in c++
brilliant

>>58628133
what does that even mean
>>
is C++ just C with additional stuff added to it with C in it's core? I dont get it
>>
>>58628047
nothing

the privacy meme is outdated thinking, it's like when christians flipped out when social security numbers became a thing. sorry bro, it's the world you live in now. the idea that you can somehow avoid the botnet in 2017 is absurd, at this point even if you go full Amish mode you will STILL get botnetted by facial recognition systems because the government is moving to monitor all public spaces. companies pay big money to access databases that have profiles of every single citizen in the US. society itself is now the botnet, there is literally zero escape, being a fucking human being is the botnet.

I don't particularly like that it applies to me but I don't give a shit about normies and I can't do anything about it anyway so whatever.
>>
>>58628152
It means if you're still asking /g/ for help your problem won't be solved trying to give your jvm the slip
>>
>>58628164
if only your posting was
>>58621984
>1984
>>
>>58628175
I dont have problems. I just want to optimise as much as possible. if going off heap gives me 10% faster loading speed I will do exactly that.
>>
>>58628181
>1984

What?
>>
>>58627990
>>58627904
That shit is easy though
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

size_t filter(void *base, size_t size, size_t nmemb, bool fn(const void *))
{
char (*ptr)[size] = base;
size_t last = 0;

for (size_t i = 0; i < nmemb; ++i) {
if (fn(ptr[i])) {
// Don't bother copying things that are already
// in the correct place
if (i > last)
memcpy(ptr[last], ptr[i], size);
++last;
}
}

return last;
}

bool lowercase(const void *ptr)
{
return islower(*(const char *)ptr);
}

bool even(const void *ptr)
{
return *(const int *)ptr % 2 == 0;
}

int main()
{
char str[] = "Hello, World!";

puts("before:");
puts(str);

size_t last = filter(str, 1, sizeof str - 1, lowercase);
str[last] = '\0';

puts("after:");
puts(str);

int arr[] = {2, 5, 6, 8, 9, 10};

puts("before:");
for (size_t i = 0; i < 6; ++i)
printf("%d\n", arr[i]);

size_t len = filter(arr, sizeof arr[0], 6, even);

puts("after:");
for (size_t i = 0; i < len; ++i)
printf("%d\n", arr[i]);
}
>>
>>58628285
>size_t filter(void *base, size_t size, size_t nmemb, bool fn(const void *)) {
>...
>...
>}

in haskell this is just

filter p [] = []
filter p (x:xs) | p x = x : filter p xs
| otherwise = filter p xs
>>
>>58628353
That's not in-place though.
>>
>>58628356

but what if you have more than 1MB RAM hardware
>>
>>58628370
>1 GB/s
>>
>>58628370
It's not equivalent, so it's not a valid solution.
>Haskellfags can't even implement quicksort
>>
>>58628356
He didn't ask for it to be in-place.
>>
>>58628387
It's not a quicksort
>>
>>58628405
I know. But Haskell cannot implement quicksort.
>>
>>58628408
How can a language implement something? Don't programmers usually do that?
>>
>>58628408
You can do inplace algorithms in Haskell if you want, it'll be as verbose as the C example.
But he just wanted to filter an array, he didn't say inplace.
>>
why do i waste so much time on /g/ rather than being productive, learning and practicing my programming??
is there something else i can put on my second screen that positively relates to coding that won't keep me so distracted?
>>
>>58628424
Get a hold of yourself, you weak piece of shit.
You need willpower to get shit done, not some extra waste of screen real estate.
>>
What's the best programming language to help reduce global warming?
>>
File: good_code.png (38KB, 455x695px) Image search: [Google]
good_code.png
38KB, 455x695px
>>58628437
i know. i know. but HOW?!
it's much easier said than done.
>>
>>58628498
Any language is equally good at that
>>
>>58628498
if global warming is real why is there ice in my fridge? check mate atheists.
>>
>>58628285

what does this do? sort an array in the same memory block?
>>
if final means the variable cannot change, then why don't we just drop the final shit and call it an invariable?
>>
Long shot but has literally anyone here ever used Hot Soup Processor? It's a gook language used to make the roguelike game Elona but

>all the docs appear to be in moon runes

Unless I am mistaken. Doesn't seem to be much English language discussion of this.
>>
>>58628424
>>58628503

Find something you want to make and make it, even if it already exists. Is there anything you do often that could be slightly faster if automated? Try to automate it. If not, I dunno. If you're not making money from it, you probably won't ever put in the effort to work on something you don't feel like working on.
>>
>>58628533
It removes the elements of some array that do not match some predicate, and also removes the 'gaps' created by elements that did not match.
The return value is the length of the "new" array (i.e. the number of elements that matched).
>>
>>58628498
C. Efficient = Lower CPU usage = Lower power consumption = Less CO2
>>
>>58628564
>If you're not making money from it, you probably won't ever put in the effort to work on something you don't feel like working on.
exactly! been trying to teach myself but i have non coding job (trucker) to earn. got pay bills, buy food, etc... if only i could be immersed in coding, have an on-the-job-training environment, i'm sure i'd master it. but it's not currently relevant to daily life.
>>
>>58628370
>1MB
It's funny because that's the order of magnitude we're talking about.

That Haskell snippet takes 114 MB of RAM to compile and results in a 1.1MB binary that requires 3MB of RAM to run.
>>
>>58627453
instead of
if(linesToIterate > 0){
while(1){}
}


use
while(linesToIterate > 0){}
>>
>>58628503
>>>/r/ibbit
>>
interesting thought: adopting a son or girl and teaching them extreme mathematics and how to program from a very young age
>>
>>58626687
>What are you working on /g/?
I fixed a few minor things on my website, and I added a new feature to my Python DiscordBot

I also looked up a bit of stuff for future features.
I think I'll make that Snapple Facts feature for my bot soon
>>
>>58628746
If I had a kid, I'd certainly try to teach them programming early on.
>>
>>58628746
>adopting
I wouldn't want to share my knowledge with someone with lower quality genes.
>>
How does /dpt/ take their coffee?
>>
>>58628816
I don't drink coffee.
>>
>>58628824
What do you drink while you code?
>>
>>58628832
Water
>>
I just joined a programming competition at uni and there's 3 members per team. Any tips?
>>
>>58628774
if you find yourself here you are not going to reproduce
>>
>>58628856
don't let anyone on your team who doesn't know C
>>
>>58628856
Your first mistake was going to uni.
>>
my " key broke
>>
>>58628816
coffee is addictive and you build up a tolerance with time.
After some point not only you have to drink 3 cups every day to stay awake, also the second you stop drinking you become more sleepy than you would normally be if you didn't drink any coffee.
>>
>>58628816
1.5 small spoons of sugar, non-dairy cream + milk.
>>
>>58628832
Soy milk
>>
>>58628816

Half way up with coffee
The other half way up with whole milk
Add in sugar until the amount makes you wonder what the chances are of getting diabetes if you keep adding this much.
>>
>>58628353
filter p = foldr (\x acc-> if p x then x:acc else acc) []
>>
>>58628816
Mocha when possible, else cream and sugar, else black
>>
>>58629026
r u fet
>>
>>58629101
It's assumed Ruby-sempai and everyone here is fat or a trap
>>
>>58629044
filter = flip foldr ([]) . flip flip id . (ap .) . (`ap` (:)) . (((.) . if') .)

ftfy
>>
>>58628885
Well, that's better than sharing my power with someone inferior.
>>
youtube idea: rapping c functions and libraries and name it 'the c rap'
>>
>>58629210
Fuck off Monzy.
>>
>>58629129
>if'
>>
>>58628931
I was going to say use arrays of character literals, but ' is on the same key as " lol.
Gonna have to use arrays of integer literals casted to char
>>
>>58628931
>>58629282
C has your back.
#include <stdio.h>

#define str(s) #s

int main()
{
printf(str(hello world!\n));
}
>>
Is raw lambda calculus low-level?
>>
>>58629305
#include <stdio.h>

#define str(s) #s

int main()
{
printf(str(hello, world!\n));
}

What now faggot?
>>
>>58629345
#include <stdio.h>

#define str(...) #__VA_ARGS__

int main()
{
printf(str(hello, world!\n));
}
>>
>>58626897
>note taking app
>29MB
>efficient

This is bait.
>>
>>58629305
>>58629345
>>58629356

#include <stdio.h>

#define str(...) #__VA_ARGS__

int main() {
printf(str(hello, world!\n));
}
>>
>>58629331
>Is pure abstraction low level?
sure
>>
>>58629356
>>58629365
#include <stdio.h>

#define str(...) #__VA_ARGS__

int main()
{
printf(str(hel//lo, world!\n));
}

What now faggot?
>>
>>58629375
>pure abstraction
It corresponds very closely to machine instructions and is the simplest and most fundamental formulation of computation
It's not very abstract at all in that sense, there are no streams, operators, class heirarchies, polymorphic calls, variadic functions, etc.
Just three forms

>>58629388
You broke it.
{ should be after main(), not on a new line
>>
>>58629405
>It corresponds very closely to machine instructions
What machine are you talking about here, anon?
>>
>>58629388
#include <stdio.h>

#define str(...) #__VA_ARGS__

int main()
{
printf(str(hel/) str(/lo, world!\n));
}


>>58629405
>{ should be after main(), not on a new line
>Not using linux kernel style
>>
>>58629417
#include <stdio.h>

#define str(...) #__VA_ARGS__

int main()
{
printf(str(h)el/) str(/lo, wor)ld!\n));
}

What now faggot?
>>
>>58629405
>It corresponds very closely to machine instructions
i wish. where did you obtain such a machine?
>simplest and most fundamental formulation of computation
Exactly, which by definition makes it abstract.
>there are no streams, operators, class heirarchies, polymorphic calls, variadic functions, etc.
None of these can be called "abstract" by any sane person. it doesn't get any more abstract than math, especially when we're talking about lambda calculus
>>
>>58629413
You can translate each one into a small set of instructions on any modern desktop processor.
>>
>>58629465
>which by definition makes it abstract.
wrong

not the same concept of abstract that applies to something like haskell or java

>None of these can be called "abstract" by any sane person
oh, so you're an idiot
ok
>>
>>58629460
Ok, you defeated it.
The C preprocessor cannot deal with embedded round brackets.
Fix your damn " key, then.
>>
>>58629466
I'm skeptical, considering it has closures.
>>
>>58629480
I'm not the one with the broken " key. I just wanted to prove you wrong.
Have a nice day
>>
>>58629489
but it doesn't have mutable state and is 100% pure
>>
>>58629502
Your point?
>>
>>58629473
>not the same concept of abstract that applies to something like haskell or java
which is an absolutely retarded way of using that word.
>oh, so you're an idiot
no, but i think you might be if you think something can be more abstract than math
>>
>>58629509
Abstract as in abstraction.
Lambda calculus is abstract but it's not an abstraction.
Lambda calculus isn't taking an underlying set of things and saying "How can I provide a nicer interface that expresses what I want?" it is itself an underlying set of fundamental instructions.

Streams are an abstraction.
Streams are high level.
Same for 99% of features of most libraries.

>more abstract than math
Art
>>
>>58629537
or fundamental forms, and fundamental operations such as beta reduction
>>
>>58629497
Actually, after some experimentation, you can get it to work:
#include <stdio.h>

#define str(...) #__VA_ARGS__

int main()
{
printf(str(h\051el/) str(/lo, wor\050ld!\n));
}
>>
https://tromp.github.io/cl/LC.pdf
>>
>>58629554
Ok. You win. I've lost.
>>
>>58629582
Whoops, typo
I meant
int main() {
>>
>>58629593
Fuck off
>>
>>58629599
YOUR SYNTAX STYLE IS WRONG AND NEEDS FIXING

W R O N G
>>
>>58629593
I personally do
int main()
{


The other way looks tacky for main.
>>
>>58629621
why?
how?

it is literally a line for no reason
the int main() already serves the visual purpose of opening the block
>>
>>58629610
Your life is wrong and needs fixing.
Start by putting your life on the new line.
>>
File: 1484661399539.png (615KB, 664x720px) Image search: [Google]
1484661399539.png
615KB, 664x720px
>>58629637
>>
>>58629634
>muh lines
>>
>>58629634
>why?
>how?
GNU C guidelines.
>>
>>58629654
so why don't you do this then?

int 
main ()

{

printf (
str(h\051el/) str(/lo, wor\050ld!\n)
);

}
>>
>>58629668
I don't care about GNU
>>
>>58629670
>IT HAS TO BE EITHER BLACK OR WHITE
>ABSOLUTELY NO GRAY
Just fuck off. Some people prefer their opening and closing braces on the same fucking y coordinate, because it makes fucking sense.
>>
>>58629682
Yet that's how they write C
>>
>>58629670

int 
main ()

{

printf
(
str
(
h\051el/
)
str (
/lo, wor\050ld!\n
)
);

}


:^)
>>
>>58629689
x coordinate*
>>
>>58629702
>>58629670
Almost forgot,
int 
main
(
)

{

printf
(
str
(
h\051el/
)
str (
/lo, wor\050ld!\n
)
);

}
>>
>>58629717
kek

>>58629689
it is black and white
{
is wrong
}
>>
>>58629101

I am a skinnyfat. Could probably look just fine if I bothered to exercise, and maybe shaved.
>>
>>58629721
There's nothing wrong about it, it's valid syntax.

Now just because it's valid syntax doesn't mean you should do it, there's a reason behind it, and that reason is because that style makes sense to a lot of people and looks aesthetically better to a lot of people.
It's completely reasonable, much much more reasonable when you consider that shit like the GNU coding style exists.
>>
File: 1485028517723.jpg (102KB, 773x893px) Image search: [Google]
1485028517723.jpg
102KB, 773x893px
>book covers different datatypes
>I can't even think of their use
>I can't even think what to do with my new language knowledge
Jesus, C feels like a baby language.
>>
>>58629766
implement the most efficient fizzbuzz this world has ever known
>>
>>58629773
I would rather go asm route to implement the most efficient fizzbuzz.
>>
>>58629786
implement the most efficient fizzbuzz compiler the world has ever seen
>>
>>58629766

The language semantics are pretty trivial, but knowing them won't teach you how to program. To learn how a program should behave, look to other programs.
>>
>>58629804
I don't talk about C, though, I already know C. I'm learning Perl.
>>
>>58629820
Perl is not a very good language.
>>
I'm working on machine handwriting.

I handwrite A-Z on graph paper, 100 characters a page, 5 pages each character, feed it into the algorithm and uses a convolutional neural network coupled with user input to "write" something using sample data.

>I give it 500 examples of C, A, and T
>tell it to write the word "CAT"
>it will generate a unique sample of C based on NN data, same for A and T
>it will generate the word "CAT" how I would spell it but not using exact data I inputted it with

It works fantastic but I haven't done all the sample data yet. I got to Q so far, so it can write sentences using letters A-Q. Took me around 14 hours to train it A-Q.
>>
>>58629951

when are you capable of forging checks
>>
>>58629804
Learned Haskell yet, Ruby?
>>
Anyone know a good tutorial for parsing XML files with Java?
>>
>>58626687
What should I make today lads?
coin flipper, implied probability calculator or a countdown timer?
>>
File: 1482007225219.jpg (58KB, 600x415px) Image search: [Google]
1482007225219.jpg
58KB, 600x415px
what's a good strategy for a dynamic growing buffer? reallocating with 1.75 or so will just explode the size for bigger buffers
>>
>>58630046
/g/script interpreter
>>
>>58630009
just read up on string operations and regex. regex sucks btw.
>>
>>58627087
>using namespace std
triggered
>>
>>58630133
>regex sucks btw
Regex is great. A lot of people just don't use it properly though, and don't understand its limitations.
Also, most regex implementations are known for being astronomically shit.
>>
why the fuck cant I send direct messages anymore on bitbucked?
>>
Are there algorithms like binary search where I can efficiently find an int in an array where the array has elements strictly increasing up to a certain point and then strictly decreases?

We havent even touched binary search in my class and I cant tell if the professor would be happy enough with just a typical for-loop incrementing through it cause its O(N)
>>
>>58630378
Yes, it's called binary search.
>>
>>58630378
hillclimbing?
>>
>>58630380
cool thanks, then ill figure it out. im new if you cant tell
>>
>>58630378
Binary search on first half and another binary search on second half
>>
>>58630390
Eh, you could use a quicksort prior to searching, and then search.
>>
>>58628746
I know a physicist, that taught her daughter string theory and such instead of lullabies. He also raped her and caused her to seclude herself in an imaginary world of magic and fantasy.
>>
>>58630434
Why would you search after sorting? This would have horrible performance compared to just looping through it once.

Also, anon clearly stated it was already sorted, just find the point where the array is increasing and then decreasing and then split it.
>>
>>58627646
>the clean subset of C++
ftfy
>>
>>58627646
Not even the people who make c++ pretends its a proper superset of C.
Why should you?
>>
>>58630378
If you know what the index of the place where the list stops increasing and starts decreasing you can search the low to high range for your value using binary search and then search the high to low range using binary search, except the second binary search must be aware that the sort order is different.
>>
File: DSC_0048.jpg (3MB, 3840x2160px) Image search: [Google]
DSC_0048.jpg
3MB, 3840x2160px
Can anyone explain how this possibly returns a string into a variable called StringA if promptandgetstring(StringA) is called, I dont get it
>>
>>58628746
I've heard young children aren't all that capable of abstract thought. So they're good at stuff like playing the piano or learning long sequences of names. But programming (actual programming, not just using libraries like they were lego's) is probably not for them.

I wasn't given a good introduction to programming. I started when I was 6 with mom showing me what she had learned about visual basic. And then there were many years of me asking her to teach me programming to no avail until she gave me a book on visual basic for intermediate programmers in English which I didn't even know at the time.

Don't do that. It's absolutely terrifying/depressing for a child to be given a task that's far too difficult (might say impossible) after having asked for it for years (I was 10-11 at that time)

So teach the kid C. C isnt super abstract, it's a very simple language and it's always gonna be relevant or be relevant knowledge.

If I ever have kids id probably focus on not letting primary school suck their curiosity out of them. It's more important.
>>
>>58627817
I pronounce GUI as gooey, but that's just how you'd pronounce a word written as 'gui' in Norwegian.
I still call SQL by its letters. There is another query language actually called SEQUEL, predating SQL, so... why would I call SQL SEQUEL?
>>
>>58630866
Everything about this makes me scream internally
>>
>>58630866
I'm not an expert on scanf. Especially not the f in scanf. But you're passing the pointer called 'str' in the function to scanf. It doesn't 'return a string into stringA'. It writes into the memory where stringA is.
My guess is that you should read that scanf format line as 'take the first character of the input and put into junk, then put everything until there's a new line into str'.

Not sure what I could say to help you here. But the short and simple answer to your literal question is that scanf is writing into the address (pointer) you passed the function (StringA in your example, str in code). Whatever memory is allocated for stringA is gonna stick around after the function naturally. So that's how you see the effects of the function outside of it.
>>
File: JWwwzoX.png (61KB, 252x221px) Image search: [Google]
JWwwzoX.png
61KB, 252x221px
>>58630866
what am i even looking at
>>
>>58627840
>SQL
It's sequel.
>CLI
It's command line interface.
>GUI
Graphical user interface.

Why are you saying individual letters for acronyms? It's like you don't know what acronyms were made for.
>>
>>58630959
Thanks for the help senpai, everyone's gotta start somewhere
>>
>>58628503
See that "done yet" bit?
That's the problem. Start by figuring out what the smallest amount of work you can get away with, and make that. THEN you go and get some more. That's the problem you were supposed to solve with Spiral, RUP, Agile, etc.
>>
I'd create a new thread, but I don't expect the general population of /g/ to understand this thought experiment.

Take two storage devices of equal performance. Say you want to maximize read performance of a chunk of data. Write performance doesn't matter, we just want to get the data off the disk and into memory as fast as possible.

How do you accomplish this?

Striping every other bit between the devices after compressing with, say, LZ4 (something that can process bit streams), would be one of the fastest solutions, no?

Assuming the data is large enough, though, proportional to the read speed of the devices, would it be viable to have a huge dictionary hosted on one device, and have the other only contain data? Or does this merely improve compression at the cost of read speed?
>>
>>58630968
>whatever memory is allocated
To be perfectly clear and not confusing:
No allocation is happening in the code presented here. I mean whatever you pass in from outside has allocated memory at some point. If it was declared locally like char[1000] stringA; it's statically allocated.
The string that's in main is gonna still be there. You just asked scanf (via promptandgetstring()) to write to where that statically allocated memory was.
>>
File: jew.jpg (325KB, 750x500px) Image search: [Google]
jew.jpg
325KB, 750x500px
guys this whole open source contributing thing is too overwhelming. it would take me weeks or months to understand the code before I could contribute even a single line of code.

what am I supposed to do
>>
>>58631004
You'd have to profile it. But in general I've found that compression is preferred until the throughput of your decompression is lower or equal to your disk read speed.
Approximately. How many disk reads your cpu can queue is also important.
>>
>>58631035
Just write patches you expect people to throw away.
>>
>>58631053
Ah fuck, I don't grasp that concept.

And yeah, it will definitely depend on the type of data. I was thinking of a image, though. Like, a RAM image. The idea being to quickly restore a state. But then again, I've just been pondering this as a general thing.
>>
>>58630942
>There is another query language actually called SEQUEL, predating SQL
Why is it "another" when it's just old version of Structured English Quéry Language?
>>
>>58629834
Why? It seems pretty okay.
>>
>>58631035
That heavily depends on what languages the project is written in. For example, making sense of a C++ or Haskell codebase is many magnitudes harder, even with docs, than with some simpler language like Go.
>>
>>58631035

Welcome to working with any pre-existing codebase ever. Either make something new from scratch or sit down and learn the codebase. It's a skill you'll probably need at work.
>>
>>58631134
It's a big topic.
I'd say if you aim to quickly restore a state you should aim to keep the state in memory if possible. Buffered async io is a lot of work for a system that only has a temporary throughput problem (you don't want to restore the state all time. A system that'd have more gain from buffered async io would be a database where you can spend time processing other users while waiting for disk reads and you want to ensure the fastest time for every individual).
If your memory image is too big then likely compressing it and saving it in memory isn't the right tradeoff to make. You should rather save it lightly compressed/uncompressed to disk.
>>
What's the proper way to do asynchronous programming?

The Linux system calls are good for socket I/O I guess but they don't work with regular files.

Why do people simply not design an interface that works with everything
>>
>>58631656
>>Why do people simply not design an interface that works with everything
Because the right way to do things is the wrong way for someone else and vise versa.

The magic of open-source and collaborations.
>>
>>58631656
>asynchronous programming
pure FP
>>
>>58628110
What are they gonna do about it? Ban your IP like 4chan does to banned users? LMFAO
>>
>>58629766
Who's this titty monster?
>>
>>58630157
>Also, most regex implementations are known for being astronomically shit.

Confirmed

https://swtch.com/~rsc/regexp/regexp1.html
>>
>>58630977
>It's sequel.
That's stupid.
>>
>>58631004
mmap. Let the OS figure it out
>>
Is there a better way to make my buttons different color, using some bool values? My problem was if i declare one isPressed bool value and switch it each time everything gets broken if i for example want to deselect one button and select another one. Current solution works but i have a sense some cool bool logic could still be implemented

        private void ButtonClick(object sender, RoutedEventArgs e)
{
Button _btn = sender as Button;

if (_btn.Name != "pressed")
{
_btn.Background = Brushes.CornflowerBlue;
txtBox.Focus();
_btn.Name = "pressed";
}
else
{
_btn.ClearValue(Button.BackgroundProperty);
txtBox.Focus();
_btn.Name = "NOTpressed";
}
>>
>>58631684
I just don't want to get cucked by Linus and his "just start a thread if you want async file I/O lol"

Basically I want to integrate all OS events in one single queue, from socket and file I/O events to stuff like input device events

I can't do this on Windows because window events can't be pumped like socket events, Linux seems to have a good general input api that doesn't even need X
>>
>>58631802
Every button should have its own event handlers
You could throw them all into a list and just do a foreach loop to clear the background from each one and then set the background for the one that was clicked
>>
>>58631766
giant warrior nagi
>>
>>58631825
This even is shared by all buttons already
>>
>coffee is addictive
>will be more sleepy than if you didn't drink coffee

Can deny, drank coffee for the majority of the past 3-4 months. Stopped drinking it last week, feel just fine. Only feel tired when I'm actually deprived of sleep.
>>
>>58631844
I'm feeling sleepy AFTER taking a coffee.
>>
>>58631844
>of the past 3-4 months
Try drinking close to a gallon a day for years.
Spending hours just finding the right balance between caffeine and water without feeling like shit.
And then try cold-turkey quitting and being shut down with a four-day migraine from hell.
>>
>>58631864
your own fault for getting addicted in the first place
>>
>>58631864
Why would you drink a gallon of coffee?
>>
>>58631873
coffee is just too good.
>>58631878
how someone drink mountain dew/whatever pop for the taste, is how I drank coffee.
>>
>>58628070
sell it faggot
>>
>Unsafe memory allocation is about 10-12% faster than ByteBuffer and Direct ByteBuffer
but when I go into the source the direct bytebuffer does the exact same thing and uses the unsafe too. so why is it slower?
>>
>>58631864
D O O D

S T O P

Take caffeine pills. They're dirt cheap (90 count 200mg caps for like 4 bucks) and they dont fuck with your stomach. No bloat, no liquid, no frequent piss breaks unless you choose to chug water alongside it.

I've felt 6000% better since stopping with the coffee/energy drink nonsense.
>>
File: 9794718235780.jpg (13KB, 154x199px) Image search: [Google]
9794718235780.jpg
13KB, 154x199px
>>58627731
>>58627731
>haskell
>implying not too autistic to leave house
>interact with mortals

Anon...
>>
>>58631914
>I've felt 6000% better since stopping with the coffee/energy drink nonsense.
note the part about me quitting.

But same here.
>>
>>58631914
Some of us actually enjoy drinking coffee.
>>
>>58631926
am i the only one here who hates coffee?

tea only
>>
>>58631941
I drink ceremonial matcha tea. Tea & Water are all I really drink.
>>
>>58631926
I enjoy coffee too. Even shit office-tier folgers is comfy to sip on.

But, where I worked, the coffee wasn't that strong so chugging it for energy was just bad. I have a temperamental stomach so I felt a lot better when I moved from coffee (and occasional Monsters) as my primary caffeine. I still did have a cup in the morning though.

>>58631941
I like tea too, but usually prefer the kinds that happen to not be caffeinated. Like chamomile, mint, peppermint. Those are my favorites, aside from pu-erh.
>>
so, you cl-fags are okay with 60mb binaries?
>>
File: 1469286936822.jpg (76KB, 1065x859px) Image search: [Google]
1469286936822.jpg
76KB, 1065x859px
help. maximum optimisation slowly turns into an obsession. how to fight it?
>>
>>58632046
Embrace it, and write better software than everybody else.
>>
>>58631982
https://common-lisp.net/project/ecl/static/manual/ch26.html
>>
>>58631982
>what is ECL
>>
>>58632051
I would but Im simply using the wrong language for this
>>
>>58632091
Master C then.
>>
>>58631425
I meant more to retrieve a (volatile) memory state from storage, for an unpowered machine -> state in the shortest time possible.
>>
>>58632091
...ehhh. A lot of gains happen from architecture and design. A lot of financial trading places that need almost instant service times use java, not C and manage to do well enough. But they write code in a way where the GC doesn't run once it starts, and pay a LOT of attention to protocols and data-structures.

Now if you want to milk EVERY last drop out, you need something like C++ or C.

>>58631004
>How do you accomplish this?

>Striping every other bit between the devices after compressing with, say, LZ4 (something that can process bit streams), would be one of the fastest solutions, no?

There is no one right answer, unfortunately. It depends entirely on your workload and your hardware.

>Striping every other bit

I hope you mean "bit" to be a largish block aligned chunk, and not an actual bit, because not only will this NOT improve throughput, it will absolutely tank it.
>>
why does C have it's on general thread?
>>
>>58632246
insecure c babies can't handle their language's slow decay into irrelevance.
>>
>>58632246
Because this board is apparently /g/ generals now. We have a general for phones, a general for thinkpads, a general for macbooks, a general for laptops, a general for programming, a general for web programming, a general for C programming, a general for Haskell programming, a general for funcitonal programming, a general for battlestations, a general for wallpapers, a general for BSDs, a general for FreeBSD, a general for Linux threads, a general for stupid questions, a general for networking, a general for networking security, a general for networking certifications, a general for careers and certifications, a general for builds and guts, a general for torrents and private trackers, a vim general etc.
>>
>>58632272

are you implying that's a bad thing?
>>
>>58632272
Forgot the general for phone wallpaper/backgrounds and the android general and the speccy thread.

>>58632290
Not at all.
>>
>>58632290
it is. generals devolve into themselves.
happens on /vg/, /mu/, /int/ and /sp/, /g/ is no different.
>>
>>58632177
>pay a LOT of attention to protocols and data-structures
isn't this supposed to be the norm, though?

I can get if someone fudges a simple private project, but if you want performance, you better understand OOP. Especially when you're using OOP for the purpose of harnessing the power of OOP.
>>
>>58632302
I would gladly not ever see macbookfags or audiophaggots or mechanical keyboardfags ever again
>>
>>58632302
There's a greater signal to noise ratio though. If you dislike the signal that's being put out, create your own or stop listening. Compare sifting through threads like: HELP ME PICK GPU, HOW DID I HACK, LMAO LINUX SUX, HI WHAT COMPUTER DO I NEED FOR RUNNING X GAME

Instead you can just easily search for a general, and it'll be on topic, generally.
>>
File: 764.jpg (20KB, 500x375px) Image search: [Google]
764.jpg
20KB, 500x375px
So, I have extensive background in web development but recently I'm willing to get into system programming, which language should I start with?
Valid options (as I can perceive) are C++ and Rust, any tip would be very much appreciated, thanks!
>>
>>58632393
I think /sqt/ is the only general that's positively added to /g/ in that like.
>>
>>58632264
What is going to replace it? Objective-Python? Javascript? Go? Ahahahahaha.

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

Honestly now, no matter how many new flavor of the week languages that come out C/C++ will always be relevant.
>>
>>58632371
>>58632301
>>58632272
Shit forgot that as well, audiophile generals, mechanical keyboard generals.

Damn, we have a lot of generals. Didn't we at some point have a Go general too?
>>
>>58632423
D.

The committee has already implemented some of their stuff.
>>
>>58632393
I think generals are *generally* a good thing, but things like C general is a bit too far. I can't imagine that general being very active.
>>
>>58629405
What about S and K?
>>
>>58632366
>you better understand OOP. Especially when you're using OOP for the purpose of harnessing the power of OOP.

I hope you're meme'ing. I mean the do things like separate shared data by cacheline to prevent false sharing, pay attention to who is writing to what to prevent contention, etc. Not that they know about trees and vectors. It's an orthogonal concept to OOP.
>>
>>58632456
>garbage collection
Into the trash it goes.
>>
>>58632495
They're moving to full @nogc
>>
>>58632394
C
>>
>>58626687
Is there anyone here creating a desktop applications in c#? I have a project to do (soon) and I wondered what are the tools/technologies one should use for such project.
>>
>>58632503
So what is the actual benefit? Relearn a whole new language, scrap all the old libraries and rewrite everything, for what exactly?
What is actually better in D that C can't just add to their new version?
>>
In D
why does:
auto splitString = splitter("ls -l"," "); //could omitt ," " and use default whitespace delimiter
auto command = execute(splitString);

give me:
Error : none of the overloads of 'execute' are callable using argumen t
types(Result),
candidates are : / usr / include / dlang / dmd / std /
process.d(2132, 6)
: std.process.execute(const(char[][]) args,
[...]


It's very confusing. Why does it tell me that the type is "Result"? How am I supposed to know how to work with that?

When I send it to writeln it does what you expect and prints
["ls", "-l"]

But I don't see what to do based on this error..
>>58632503
I'm still learning but what are the facislities for ensuring allocations happens through your own memory management system?
Are we supposed to litter our code with factories, myAlloc() and other such calls?
It's something I was hoping to get away from.
>>
>>58632562
WPF is what you're looking for.

XAML has a bit of a learning curve, but it's ultimately really easy to get a desktop application up and running with C#/WPF.
>>
>320 / 23 / 80 / 4
>>
New thread:

>>58632639
>>58632639
>>58632639
>>
>>58632578
>Relearn a whole new language, scrap all the old libraries and rewrite everything, for what exactly?
D has full C and 99% c++ interfacing.
D is merely a modern and proper C++.

No more headers alone makes D 100% more usable.

>>58632600
Which version of dmd are you on?
D is very implicit with Voldemort types.
Post more though.
>>
>>58632635
Thanks for the quick response!
I'll check it out.
>>
Quick question for anyone that uses LUA
Hooking functions is pretty simple when you're dealing with things like
>something.doShit
but I'm not sure how/if you can do so with
>something:doShit
I do know the main difference is an implied first argument for self, but how do I hook shit like that? Can you copy and replace namespaces defined like that?
>>
>>58632688
WPF can be both incredibly easy and INCREDIBLY frustrating. Prepare for a lot of stackoverflow browsing
>>
>>58632527
like, plain C?
>>
>>58632394
Learn C first. It's the lingua franca of just about every system.
>>
File: btnReset.jpg (20KB, 264x148px) Image search: [Google]
btnReset.jpg
20KB, 264x148px
How do i create a command in WPF for 1 button to deselect all buttons with changed backgrounds?

My current logic for pressing buttons is
        private void ButtonClick(object sender, RoutedEventArgs e)
{
Button _btn = sender as Button;

if (_btn.Name != "pressed")
{
_btn.Background = Brushes.CornflowerBlue;
txtBox.Focus();
_btn.Name = "pressed";
}
else
{
_btn.ClearValue(Button.BackgroundProperty);
txtBox.Focus();
_btn.Name = "NOTpressed";
}
>>
>>58634260
You're posting in a dead thread on page 10.

Migrate and repost question, FFS.
Thread posts: 331
Thread images: 25


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