/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1566526623928.jpg (905x1280, 374K)

Other urls found in this thread:

docs.rs/nix/0.15.0/nix/unistd/fn.getuid.html
cplusplus.com/reference/cstdio/getchar/
en.cppreference.com/w/cpp/string/basic_string/getline
twitter.com/SFWRedditGifs

Lisp is the most powerful programming language.

I want to make a python script that allows me to enter command line commands to auto generate html entries in a html file to create html linked study notes I can read from a browser.

Rust!

Attached: E7EAE7DD-D54D-4FCE-8395-FB2A5FAB77EF.gif (540x540, 605K)

revised proper C++ that will properly attempt to consume infinite memory even on servers where memory is a precious resource, you monster.
#include
#include

auto main() -> int {
std::string buffer;
int c;

while ((c = getchar()) != EOF)
buffer.push_back(c);

for (auto i = buffer.rbegin(); i != buffer.rend(); i++)
putchar(*i);

putchar('\n');
}

My app

Gives a simple proposal - create a program that, with a single command line , enters data to an html sheet and auto parses it so its legible from the front end

How would it be done in lisp? I would love to hear some advice on lisp since I'm new to programming

Are you fags that post the same shit every thread bots or just hyper-autists?

Use a range-based for loop you mong

>NOOOOOOOO YOU CAN'T JUST ENTER A NON-ASCII STRING

Attached: b6xa2ujdr2d31.png (785x1000, 254K)

I like C!

This. It's just reversing the bytes instead of the proper code points.

Why do you keep hurting my feelings?

I'm neither a bot nor an autist. I transcend space and time.

The world must be better if Lisp is more popular.

this is not a valid thread until JS doll-chan is posted

non-ascii is good for
1. foreigners
2. emojis
3. nothing
I only wish that I could more easily oppress characters that aren't in early Latin, like J

check your privilege, bigot

>NOOOOOOOOOOO YOU CAN'T JUST USE MATHS ITS A BLACK MAGIC TO OPPRESS MY PEANUT BRAIN IQ STATUS

Attached: 23043.png (400x299, 13K)

C int and long sizes varying across architectures is evil.

explain "html sheet"

I'm doing stuff in Qt right now and I want to know: what the heck is a "mouse grabber"?

Delete your Javascript folders anone~

Attached: 1561228792593.jpg (1536x2048, 586K)

ASCII is perfect for smoothbrained C users

>int c;
Once a ctard always a ctard

Attached: 1566271993038.jpg (540x720, 33K)

#include

then use the fucking standard int types
int_fast32_t for example

#include

docs.rs/nix/0.15.0/nix/unistd/fn.getuid.html

and what would you use? Another language where the I/O primitives return optional types?
to print out the chars in reverse? how?

>and what would you use?
char, because im not a ctard caveman
> Another language where the I/O primitives return optional types?
Rust is better at handling strings so yes

...
in favor of Elm?
don't say we're just giving up, doll user!

You're fucking retarded. int is used instead of char for a reason.

Imagine using a language that doesn't have default values for prims.
imagine actually dealing with uninitialized errors in the current year.

>char, because im not a ctard caveman
cplusplus.com/reference/cstdio/getchar/
The function returns an int though..

>char
getchar() returns two things
1. a char
2. EOF
what's your plan to distinguish between #1 and #2?

My shitlang that is lower level than both C and sepples can do that in two lines. There must be a better sepples implementation than what you posted.
_main =: _sl strreverse strgetline

>getchar
EWWW Learn C++ first, cavemen

if you've optimized your shitlang for the expression of trivial programs like this, at least don't brag about it.
that's like implementing HQ9+ as other than a joke.

I have no interest in learning the worst language that has ever existed.

imagine having to deal with a shitlang like rust

Does it shit the bed when you try Unicode?

Who's this girl?

yea, ur precious c is implemented in c++ nowadays.

who cares about commie jew encodings

>all these fucking replies that just say "no you're wrong" without providing an alternative
>all these followups where alternatives are finally provided and immediately shown to be fucking wrong
I can't learn C++ because my textbook hasn't been published yet. What do you want me to do, learn from a pre-2000 book?
But since you've learned C++ user, tell me how I'm supposed to read input char-by-char except with getchar() ?
bear in mind that char c; cin >> c; skips empty spaces because someone thought scanf() had the right idea.

I went to school for CS and dropped out over 6 years ago.
I learned basic JavaScript and C.
I want to complete my degree and maybe have a career in development/security.
I can't really right anything right now except for some hello world shit.
What are some good resources to brush up on/learn coding so I pass a reentrance exam or apply for a job?
I couldn't into maths so I ended up dropping out and basically haven't tried to do anything computerwise since.

Attached: 1386629565582.gif (244x139, 477K)

so im trying to make my own dummy profiler, my idea is to have a singleton that contains a map , then i just plan the begin_timer(name) and end_timer(name) anywhere i want
how does that sound?

Attached: is_this_normal_office_behavior.png (949x631, 702K)

>I can't learn C++ because my textbook hasn't been published yet.
lol what

en.cppreference.com/w/cpp/string/basic_string/getline

Not if you know it's unicode beforehand. I just have to index the strings in chunks of 2 bytes instead of 1.

You couldn't be more wrong.

conceptualize the odor

>reading in char by char
>you're doing that wrong
>how should I do it?
>you shouldn't do it
oh. thanks.
yeah, although it's really attractive, the idea of making my code longer and uglier and worse, with no gain whatsoever, not even an efficiency gain given stdio buffering, just so I can avoid 'int c', I think I'll stick with int c.

sir i have done the needful please send payment thank you

#include

int string_length(char*);
void reverse(char*);

main()
{
char s[100];

printf("Enter a string\n");
gets(s);

reverse(s);

printf("Reverse of the string is \"%s\".\n", s);

return 0;
}

void reverse(char *s)
{
int length, c;
char *begin, *end, temp;

length = string_length(s);
begin = s;
end = s;

for (c = 0; c < length - 1; c++)
end++;

for (c = 0; c < length/2; c++)
{
temp = *end;
*end = *begin;
*begin = temp;

begin++;
end--;
}
}

int string_length(char *pointer)
{
int c = 0;

while( *(pointer + c) != '\0' )
c++;

return c;
}

>NOOOOOOOO YOU CAN'T JUST INCLUDE COMMONLY USED FUNCTIONS LIKE ARRAY REVERSERS IN YOUR STANDARD LIBRARY THAT'S CHEATING

>gets(s)
RIGHT AWAY a buffer overflow

>maybe if i spam it enough people will start finding it funny
kill yourself

Fucking hell, none of you should be allowed to write code.

Yes, that was made apparent in K&R C.

Also my new problem is from K&R C; I need to write a program to remove all the \t characters from a text stream.

smells like hot summer and warm puffy thigh

Most of /dpt/ doesn't write code. That's why there are so many weird opinions here, like hating right tool for the job thinking.

The only right tool for the job is Lisp.

Best first language?
Also fucking atom looks so pretty but visual studio seems so much better.

post some code, nerds

Just finishing up a python selenium script that goes on the local lawyers directory and gets the name of all the lawyers practicing in the area.

I'm pretty sure I can apply this technique to make money somehow but just not sure how

Attached: selenium.png (1680x1050, 698K)

Python. You can learn it quickly and it makes you instantly employable. After that, venture out into whatever langs you feel like.

Common Lisp

I just read all of PEP8 and it doesn't dictate project naming conventions anywhere. Why do most Python projects force "Py" in to the name?

To be fair, this is the only thing I've posted that I've actually written:

#include
/* read a string into s[] one character at a time, count its length, then print out s[], one character at a time, in reverse */
int main()
{
char s[100];
int c, j;
int i = 0;
while ((c = getchar()) != EOF) {
s[i] = c;
++i;
}

for (j = i - 1; j >= 0; --j)
printf("%c", s[j]);

printf("\n");
}


And I'm only (semi) proud of it because I've just started teaching myself C.

>Best first language?
whatever's most aligned with the asker's interests. Learning to program is hard to the point that language differences don't really matter (just look at Guido; he did research and came to a bunch of conclusions and then threw up his hands and said fuck it, made a language contrary to research, and then let people shit features continuously into it).
these days, JavaScript is probably the best for anyone genuinely new to programming. They definitely have a JS interpreter around, and they can immediately play with it and get results.

most langs do stuff like that.

they don't force it. They want it. They're flashing gang signs. It's basic human behavior.

Probably Python. Its syntax is simple so you can dive in pretty easily. You could also try C if you want more in depth knowledge of how computers run so you can write more efficient code.

depends on your interests, user. python is a good starter.

C is for doing the wrong thing very fast

You'll never be an elite C++ programmer
#include
#include

[[nodiscard]] auto main() -> int {
std::cout

Gibme projects now

Attached: 1566746528248.jpg (378x329, 24K)

Write an x86 emulator xDDD

You know the documentation for games like Median XL where its almost like an ebook with chapter titles you can click and subchapers you can click and a home page you can go "back" too and you can link people from X to Y nd shit.

basically like offline Wikipedia if it was all in one document and just linked to different lines in itself

contribute to HaikuOS

Are the Khan Academy courses good things for getting into programming?

Attached: 3df62adc3b28cc69ea9099a435646caa.jpg (236x282, 22K)

>nodiscard on main
>trailing return type
>pointless lambda
peak autism

if you just want to kode, not really, just use JS libraries to do all the shit for you
you can create GUI applications without knowing how to do division
but knowing how to do division is a good indication you have a brain smart enough to copy paste code from stackoverflow (no kidding, people actually do this, so dont feel bad if you ever kopy kode)

Overflows lol

Doesn't defining the string length prevent overflows though? Or would I need to do it manually?

I like how your version only accepts a single line of input. That's a good, uh, improvement.
Had to read from /dev/zero instead of /dev/urandom to accomodate.
$ dd if=/dev/zero of=blather bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 2.32153 s, 463 MB/s
$ time ./getchar < blather >/dev/null

real 0m5.918s
user 0m4.951s
sys 0m0.957s
$ time ./pointlessreverse < blather >/dev/null

real 0m12.869s
user 0m11.908s
sys 0m0.942s
wow! elite!

Attached: wowsavings.png (954x160, 11K)

What are you talking about? I don't care about muh benchmarks, what bothers me is the lack of unicode support and how I had to generate non standard warning

>I don't care about being slow as shit
>what bothers me is the lack of emoji support
the C++ elite isn't what what I was led to believe.

All languages with C in their name were a mistake. How a single letter can curse programming forever in so many ways is beyond me.

>NOOOOOOOO YOU CAN'T JUST ENTER A NON ASCII STRING MY SPECIAL FIZZBUZZ WILL BREAK

Attached: 1565781051557.jpg (785x731, 112K)

My highest level of math is highschool calculus. Is it even worth trying to git gud at programming unless I go back to college to take some more advanced classes?

Attached: 1510773152497.png (882x758, 16K)

nope
it's not worth going back to school either

Nope, you have to do a check on the length yourself. C is notorious for these types of bugs

What about Clojure?

i'm dumber than you and people pay me to do it

Math has no impact on programming, as long as you have the knowledge of the language and any kind of deductive reasoning you can get a job as a code monkey.

not even tears sufficient to flood the Earth will make me care about emojis, sweetie :^)

Then how the fuck do I learn this shit? I'm sick of being a brainlet. I did fine in calculus but I was a lazy fuck during college (double major in two meme humanity degrees) and I am regretting it bigtime. I just graduated last may and I feel like ending it all.

Attached: Dez Crybaby Bitch Bryant1.png (305x227, 99K)

you just do it

In C, why is this
*y++

an lvalue but this
x++

isn't?