/dpt/ - Daily Programming Thread

This is /dpt/, the best subreddit of Jow Forums

previous thread at In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment

/!\ ** Read this before asking questions ** /!\

mattgemmell.com/what-have-you-tried/
catb.org/~esr/faqs/smart-questions.html


What are you working on?

Attached: timetocode.webm (1152x648, 2M)

Other urls found in this thread:

dotnet.microsoft.com/
botnet.microsoft.com/
gnu.org/software/emacs/manual/html_node/elisp/Dynamic-Modules.html
spec.commonmark.org/0.28/#container-blocks
spec.commonmark.org/0.28/#setext-headings
hackage.haskell.org/package/kan-extensions-5.2/docs/Control-Monad-Co.html
twitter.com/SFWRedditVideos

First for C#

Attached: 1529221728563.png (295x285, 108K)

>purely proprietary languages
>mfw

Attached: vlcsnap-2019-05-31-15h26m35s589.png (624x480, 203K)

Settle down dunning-kruger

>proprietary
dotnet.microsoft.com/

Attached: wow anon.jpg (884x574, 78K)

>MOM, I said it again!
>You're so smart honey

Attached: 1556864280237.webm (1034x900, 2.94M)

This thread is invalid reddit garbage. Do not post in this thread.

Real new thread:

fuck off newfag

Your only real options for web development at an enterprise level is C# or Java. And Java is nothing but shit. While C# has been improving consistently.

bump

Attached: 1544890466284.png (850x1193, 1.64M)

When you have an IDE with autocomplete Java is a good programming language.

There, I said it.

gta3script is the best language, if you want a subroutine to return true or false, you need to use IS_PC_VERSION (always true) or IS_AUSTRALIAN_GAME (always false) because there isn't another way to do it. based rockstar.

LISPis the most powerful language

Tell me more about LISPIS.

A program that will list all the items in my PlugY stash. I didn't realize how ridiculous this format is.

eat shit plebtards

go back

Has anyone ever actually taken a look at the Vim sourcecode?

It is bar none, with no exaggeration, and I say this without hesitating, the worst codebase I have ever seen

Naming "conventions" are not conventions. They're idle suggestions that choose how they're formatted just by seemingly just rolling the dice. All the variables are imparseable strings of text that you can read and potentially delineate some kind of meaning if you have the Vim Lexicon next to you

The comments are the most useless thing in existence, and either just say what the code is doing (/* read 4 bytes into memory */) or are incredibly obtuse, simple instructions like /* initialize vrtcarrbittptr based on delineated spec */

There are hundreds (yes hundreds) of lines of nested ifndefs. I don't know why, I understand the C language and I cannot make any sense of why he wants to use preprocessor statements

There are 500 line functions, and 1 line functions that just call another function
There is a folder at the root directory ambiguously named "tools" with a single file that's just a batch makefile

These are deliberate things that I can look at and comment on, but until you've sat down and stared at this wasteland of obtuse text you can't appreciate just how impossible to make sense of it is
It is impossible to believe and impossible to describe

How anyone is able to program a mindwarpingly complicated program like Vim and do it like this is beyond me

Attached: 27a.jpg (1320x1020, 670K)

How to build a dynamic library (.so) with gcc?

Python: How do i modify dictionary i am currently iterating over so iteration is not stopped? NFA to DFA conversion user here, i have DFA table in form of dict: { state: {char1: [], charn:[]} and if get value that is not in dict.keys i need to add such key to dictionary, and then continue to iterating over it

gcc -shared -o libx.so -fPIC x.c

Is it normal to love and hate programming at the same time?

You've made a typo
botnet.microsoft.com/

that's quite simple actually. nice. emacs now support dynamic native modules.

Writing a markdown parser is hard

Attached: vs.png (1928x1208, 186K)

Literally not

gnu.org/software/emacs/manual/html_node/elisp/Dynamic-Modules.html

>It should also export a symbol named plugin_is_GPL_compatible to indicate that its code is released under the GPL or compatible license; Emacs will signal an error if your program tries to load modules that don't export such a symbol.

TOP KEK

Attached: rmsjobs.jpg (640x360, 97K)

Show me yours

I haven't written one. But it cannot be difficult. There aren't even any nested elements in it.

Is it your first time writing a parser?
Maybe that's where the difficulty comes from.

Yes, I understand why it's a common CS course project now.

Yes there are. You'd know this if you even bothered to read the spec.
spec.commonmark.org/0.28/#container-blocks

Fuck you guys, Rust is pretty cool. It's like C++ with an emphasis on functional programming and that doesn't live in the fucking 90s.

APOLOGIZE NOW

for insert_iterator it, what's the difference between

>*it++ = i;
>*it = i;
>it = i;
>v.insert(v.end(), i);

and what is preferred (and why?)

I'd like it if it weren't for the borrow checker and generally being a little too conservative for a lot of the tricks you can accomplish in C++

Can't you bypass the borrow checker with unsafe?

Right there are lists. Still, if you make a line-by-line abstraction, you are 90% there already

Yes, but it's a pain. You shouldn't have to do that, and you shouldn't have to juggle all the different pointer types. It should just werk.

Book recommendations for proactive security and auditing programs systematically?

Attached: 1552520754038.png (1314x1054, 51K)

If you go line by line you still have to backtrack because of:
spec.commonmark.org/0.28/#setext-headings
It's not hard hard since it's somewhat designed to be easy to parse I'm just totally unfamiliar with this sort of problem.

Turns out you can work for decades as a developer and not need to know how to do shit like this.

learning JSON and data formats

>load in data for variations of an object
>use data to create variations of object
>hold those variations in a container
>create a copy of those those variations when needed

is this okay?

What's a good way to generate numbers that satisfy the following:

W, X, Y, Z all between 51 and 462

W*X*Y*Z = T

90mil < T < 111mil

How can I get good sets of 4 numbers within the total multiplication window, without redoing random generations until all the numbers fit?

C++:
An ultra advanced language with incredibly convoluted and contextually dependant templated polymorphism with different kings of abstraction that segfaults because a string wasn't null-terminated

Rust:
A language that keeps a butter knife in a locked safe, and requires you to say "I am not going to cut my throat with this" every time you wish to open the safe and use to butter toast

le horseshoe theory might turn out to be true after all

currently hacking together a little curses app to let me handle jira & sharepoint shit at work

if current line starts with ("---") then prev line type = header1

What is exactly required from a programming language to being able to say that it has "higher-kinded types"?

>I'd like it if it weren't for the borrow checker
I'd argue the borrow checker is the best part of the language. It's just more overtly annoying because instead of the code compiling and segfaulting the borrow checker instead stops compilation and looks like it's getting in the way.

Obviously this isn't always the case, you can write logically correct code which the borrow checker will still complain about. However, the nice thing about just following the borrow checker is that it'll make parallelizing the code pretty painless should you so choose to later.

I guess instead of simply having a "Sex" type, you should be able to have variants of sex like "Gay Sex" and "Straight Sex"

>that segfaults because a string wasn't null-terminated
std::string doesn't rely on the null terminator. It uses a size.

It still has a null terminator so you can do .c_str()

templates?

I know, my point was it doesn't rely on it.
It doesn't even need one, it works just with the size.

And whatever shithead came up with std::string decided it should have a size_t for length. That is absolutely insane, 8 bytes of overhead for such a commonly used type on 64-bit? You rarely even need strings longer than 256 chars.

It's far, far better than the alternative.

size_t is literally the perfect type for string length. What the fuck are you smoking.

based

why didn't you tell me there was a new thread?

unsigned short would be reasonable and cover 99.99% of cases. For the unusual cases where you need big strings, they could have make a std::huge_string

Lisp is the most powerful programming language.

--- parses as a thematic break and you already parsed the previous line as a text block.

But there isn't.

std::huge_size_t my_penis;

>cover 99.99% of cases
Not good enough, nigger.

Does the standard specify what the size type should be?
Isn't up to implementations?

the standard specifies it's size_t

You're right. It should handle 200% of cases (more than 100% because it needs to handle the cases that don't even exist). Let's make strings a linked list of individual characters instead

there's a reason vim hasn't changed in god-knows-how-many years and is effectively unable to get good extensions.
It launches quickly and edits text, it cannot do anything else largely due to its nightmarish design.

Seriously, 1/10,000 cases you want to fail? Do you understand how fucking many strings are created a second worldwide?

For fucks sake, why don't the janitors delete their jobs and delete shitposting threads like this?

Anywhere, real /dpt/:
Don't post in this fucking retarded reddit garbage thread.

Gotta.b tarded.
1) faster to load and store machine length words in most cases.
2) your code may not know the max length upfront.
3) introducing a secondary string type 'huge_string' is just asking for non-expert programmers to mess up even more than they already do.
4) small string optimization already negates the storage hit in many cases i.e. when you would benefit from 1-byte count and capacity members.

if the janitors deleted their jobs, they wouldn't be able to delete the shitpost threads.

Hey guys,

I'm turning 27 tomorrow and beginning to realize that the skills I've developed thus far in life are insufficient for me in this job market. I am technologically incompetent. What is a programming language that I should learn in order to make me marketable to potential employers?

Java, JS and C# are all safe choices

This is why I stopped using vim. It doesn't help the base install is some ~30mb either.

The vi source is still pretty badly written but at least it's shorter. One day I'll rewrite it.

Attached: 1557569996786.jpg (1152x865, 276K)

AutoIt script

McDonalds doesn't require a programming language

Do not choose Java, JS, or C#. You will waste a lot of CPU cycles doing a lot of dumb things. Choose an efficient language like C++.
If you can't handle C++, that's okay. That's just a sign that you shouldn't be touching computers. In which case get out of computers forever.

Use Vis.

I'm going to blindly accept this advice and attempt to learn C++. Do you have any recommendations as to how I should learn it? Did anyone here begin with apps?

Learn Lisp. You can't say you've programmed if you have never user lisp.

Start by reading the C++ standard then start building things to develop the skills.

Start with GUI programming

>apps

Attached: 1508653944674.png (1440x1440, 827K)

Unless you want to set the limit of small string optimized length at some insanely short value you're gonna have enough extra room for that size_t anyway

>dependencies
>libtermkey
>curses (recommended)
>Lua >= 5.2 (optional)
>LPeg >= 0.12 (optional runtime dependency required for syntax highlighting)
>TRE (optional for more memory efficient regex search)
$ wc -l *.c *.h
24747 total

Is this meant to be a joke?

Attached: 1558198923499.jpg (631x571, 49K)

most string implementations do SSO anyway.

>Learned nothing but functional programming languages the past 4 years. (erlang, elixir)
>Now want to do GUI programming
What are the real options for GUI programming in a functional language.
I'd really rather not bother with OOP languages like C++ if possible.

Attached: 8cea0998efc704c9657a560e89cb2bbd.jpg (827x1223, 397K)

hackage.haskell.org/package/kan-extensions-5.2/docs/Control-Monad-Co.html

>mfw

Attached: 1557315218788.jpg (125x128, 5K)

look at other markdown parsers to see how to do it. this is how the pros work.

I'm just saying that it has all the same fundamental faults as C and shits the bed for the most basic of reasons.

How do you put up with that interface? There's so much shit on the screen it's honestly ridiculous.

Attached: 1559352563475.jpg (483x589, 78K)

People without autism can deal with external stimuli without losing it.

It's true I have autism. Here's my markdown parser btw.

Attached: 2019-06-01.png (1920x1200, 18K)

I hate c#.

I just got hired for a c# role, how do i learn to love it

Sounds like homework so I'll just give some hints. Imagine how you would do it if the middle constraint used addition instead of multiplication and follow the same algorithm. Also, it might be helpful to think about how you would do it with 3 variables and then extend it to 4.

Hahaha, I like the wallpapar. Regex though? user, plz

How many times a day do you think he jacks it to his mom?

faggot jannies, faggot thread

>how do I modify what I'm iterating over
You don't.
Never do this.
Output a new dictionary instead
foo = {'ura': 'fgt'}
bar = {k: v for k, v in foo.items()}
baz = {
**foo,
'no': 'u',
**{k: 'nothing wrong with me' for k in range(1,4)},
'4': 'let the bodies hit the floor'
}

Not much point having a wallpaper with a tiling window manager. Sometimes I change the color with xsetroot.

Sans a full tokenizer regex is the easiest way to do it, that's how the original markdown.pl was written. You could implement your own regex library with good coverage in ~200 lines of C/C#.

Attached: 1558610787645.jpg (1280x720, 142K)