/dpt/ - Daily Programming Thread

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

Attached: D1tlffuWkAAiNX1.jpg:large.jpg (750x1076, 91K)

Other urls found in this thread:

boats.gitlab.io/blog/post/await-decision/
reddit.com/r/rust/comments/bld06g/a_final_proposal_for_await_syntax/
github.com/ksimka/go-is-not-good
godbolt.org/z/lDOlPt
twitter.com/NSFWRedditGif

i want to be knotted

Will you show me your newest JavaScript project? I-I just want to see it...

Attached: 1557112658031.jpg (800x1200, 123K)

what is a "moot"?

So I somehow landed a job as a CS student.
My professor recruited me for whatever reason to his company.
they mostly do php and mysql projects for their clients.
Im literally shit at php learning it rn on the job very underqualified.
Should I just do my best and yolo it or quit or wait to get fired in case i fail

...

The only javascript I ever wrote was to change the background color on a site. Never again.

Attached: 1552643416719.jpg (1024x768, 286K)

Are there too many or too few programmers nowadays? I'm hearing conflicting statements on this

Too many bad programmers.
Too few good programmers.

Who is the best programmer you know?

So, what do you guys think about Rust adopting the "dot await" postfix syntax? It's gonna be async_stuff.await?.other_async_stuff.await where `.async` is an *operator*, like in `if` or `return`, and you're supposed to use syntax highlight to distinguish it from a field access. The discussion so far is quite heated, with no consensus in sight.

The proposal with some discussion: boats.gitlab.io/blog/post/await-decision/ .
The dumpfire reddit thread: reddit.com/r/rust/comments/bld06g/a_final_proposal_for_await_syntax/ .

`.await` is an operator*

Fabrice Bellard

Attached: 1557014824768.jpg (224x224, 11K)

I get the reasoning behind it but it's definitely strange. Monads would have solved this.

Excellent choice! I like Bisqwit's perfect blend of personality and skills

Attached: comfy-guy.jpg (200x285, 11K)

What happened to him?

Attached: the platform master.jpg (2048x1536, 365K)

Could you folks help me find a solution to this problem? Should be simple, really, but I can't find anything on google.

I'm using prepared statements. One of my strings contains a few '?' characters, and I'm getting the "not enough arguments bla" error. How do I escape the '?'

mysqli (php), btw

yeah but im from the Balkans theres less competition here and even being a freelancer on the internet can be an option since the wages are so low

This
If you want to get into an area where profficiency is not required (aka javascript), good luck.

myself

>a jew
>personality
good goy

When I use pip on Windows, some packages come with these little executables in Python\scripts directory, like pylint.exe or jupyter.exe, presumably to launch the actual scripts. How are these things generated?

Attached: 63891408.jpg (459x468, 62K)

From a machine perspective, what makes it possible to drop the boolean value comparison in a loop? For example, the following mean the same:
>while (a==1)
>while (a==true) in some languages
>while a
What makes it so that you can drop the comparison like in the third example? What makes the machine interpret the "lack of a value" as true?

>JS
>an area on its own
sasuga retarded dpt-kun

>What makes the machine interpret the "lack of a value" as true?
The machine

someone on /sci/ is memeing me into reading Modern C by Jens Gustedt.
Anyone has experience with it?
Is it good?

in sql I have a query doing
update table t
set t.price = (select price from ...)

and i would like to do
update table t
set t.price = (select price from...),
set t.option = (select option from ...);

both subqueries being exactly the same. Is it possible to concatenate both in one ? Like
update table t
set t.prince, t.option = (select price, option from...)

Just ignore, Julia and Python are your go-to scientific languages

>What makes it so that you can drop the comparison like in the third example?
if it's constant or not

Im already cenile,im just asking about this specific book.

I want to make dict from a single list, but I'm retarded?

class Card:
card_rank = [str(n) for n in range(2, 10)]
card_rank.extend(['Ten', 'Jack', 'Queen', 'King', 'Ace'])
card_suit = ['Spades', 'Clubs', 'Diamonds', 'Hearts']
card_value = {card_rank: list(range(1, 14)) for n in range(1, 14)}

Attached: 1536802104238.gif (480x455, 57K)

Blocking and non-blocking are complicated enough the easy part is naming, the hard part is all the other bullshit because in one situation blocking may be completely appropriate and in another wholly wrong.

terry davis

have you tried a '\'?

this

True is not 0. The first and second would be equivalent in most languages, with a possible complaint if a was the wrong type or equivalent of '1' or "true", but the third has a very different meaning.

Yup, I get the same error

How about '\\'?

the real question is when you should even do
>(cond==true)
>(cond==1)
since the condition is already a boolean, and thus comparing it is redundant, like saying
>(true==true) //returns true
>(false==true) //returns false

What exactly is blocking Golang for being used for other stuff than Webshit, isnt it fast as fuck? Why isnt it used in gaymes as a scripting language if they use freaking Python sometimes (Godot) or as language for applications

Attached: 832823728376.jpg (9999x9999, 1.55M)

Tests should always be explicit, because one may not know the return value of functions, and certain things are undefined behavior (such as !pointer, depending on language).

If you're working under certain code standards like MISRA, all comparisons requires explicit values to compare against. If you're using a half-decent compiler, it will probably get optimized out anyway.

Just implemented (naive but working) diagonal line drawing in my OS. I've used it here to implement the CPU/memory usage graphs.
I accepted an offer today to do some crazy embedded R&D for a while, starting in three weeks. It will be interesting to see how much it cuts into my OS hacking time.

Attached: Screenshot at 2019-05-07 17-21-42.png (1920x1080, 1.07M)

It’s a good read if you are working on operating or embedded systems, probably overkill for scientific computing.

>tfw applied for over a year, at least four jobs a week, and couldn't get hired for jack shit
It's hard to apply to new jobs because all I want to do is kill myself.

Attached: 161.jpg (1000x750, 56K)

Nothing. Go ahead and use it for other stuff than it was intended for if that is what you want.

It's a really shitty language designed for retards by people who've been out of touch with reality for 30 years: github.com/ksimka/go-is-not-good .
> isnt it fast as fuck
No, it's not. It's faster than Python, but it's slower than other compiled GC languages like Java and C# and much slower than non-GC languages like C++ or Rust.

Attached: Da9Cp2l.png (680x680, 118K)

A conditional expression is a boolean

Garbage collected
No generics, empty interface has horrendous performance
Very slow C FFI for some reason

Its great for small or simple projects which benefit from concurrency. But it doesn’t offer either the abstractions or the performance control to expand much outside of those domains.

I know how much it sucks to apply to jobs, sorry user :( Don’t forget to allocate some of the downtime to improving your skills, even if you’re not motivated.

>but it's slower than other compiled GC languages like Java and C#
Wait really, thats fucking bad.

The assembly is a conditional jump which jumps if the value in the register is zero (False) and falls through otherwise (True).

Depends on the benchmark, however go routines are miles more efficient than Java’s concurrency solution.

How would a lazy monad talk to a cute girl?

Attached: BFFF59C9-56BE-4D64-94C7-5958C27CA1BF.png (658x855, 617K)

Shitty languages are often used for shitty aplications (like webshit).

> no generics/polymorphism
> interface == void*
> nil not necessarily nil
> variable shadowing fuckery
> no while loops
> no enum
> some std libraries are trash
> very slow performance
> bloated shit
> most things you make are second class citizens are you are rob pikes cuck

Worst part and the reason it will never apply to anything but webshit:
Go fanboys who refuse to improve their own language will justify all its bullshit rather than admitting there's a problem with it.

Why wouldn't it be? Go's compiler is an outdated mess Pike dragged with himself from Plan9 while JVM and .NET core both have state-of-the-art JITs. Go's GC is very primitive, even with the recent improvements, compared to the industrial-strength JVM GCs with decades of refining behind them. Go's runtime is as heavy as JVM/.NET Core since it needs to support gorutines, which also makes FFI extremely slow.
Plus the language itself prevents you from writing efficient code, by not having generics for example.

Attached: Screenshot_2019-05-07 Which benchmark programs are fast Computer Language Benchmarks Game.png (620x348, 59K)

How can a user improve the language except for creating libraries

>That C#

Will the money Micro$oft pumping into this shit to make it not shit i guess its really worth learning

It’s a testament to how a simplicity trumps efficiency. People want to write code in a small language they can fully comprehend.

With a pull request

>Tests should always be explicit, because one may not know the return value of functions
poor justification.

if (condition)
is asking, "is [condition] true?"

while (condition)
is saying, "as long as [condition] is true"


saying "while (condition == true)" does nothing but add an extra check. At what point would this ever be useful rather than just terse?

polymorphism is good
while loops are hacky

>generic
>efficient
By definition generic code cannot be the most efficient, so you probably meant something else.

You're gonna make it user!
seconded

Attached: 1554459704852.gif (500x558, 1.46M)

Not true, std::sort is way faster than qsort because being generic over the functional argument means you can inline the function. And in the Go's case, not having generics means people use interface{}, just like cniles use void*, and it's very bad for the performance.

You got a return value from a function. Is the value an indicator of success/failure, is it a number, is it a pointer, is a non-zero non-one value an acceptable outcome?

>poor justification
No, this is literally the most valuable justification, because programming should be explicit to have what you want to happen happen you dysfunctional retard (see what I did there). You're the kind of moron that'd do !pointer and say "well so what if it's undefined behavior, works on my machine". As long as you're not the tard wrangler, being a tard is fine for you I guess.

Java bullshitology coming through.

I'm learning my way around Spring and I think I fucked up with Spring Security.

Scenario is as follows:
> DB with tables items, users, user2item
>guests may view all items, but not edit/delete/add
> user1 has CRUD access to item_a_1, item_a_2, etc
> user1 has CRUD access to item_b_1, item_b_2, etc

How df can I implement RBAC so that every user may only have CRUD functionality for their designated items?

Attached: 1555454828349.jpg (1080x1079, 121K)

>simple
nigger try writing industry code and then call the abomination you've birthed "simple"
simple depends on scale, a seemingly simple implementation on a small scale may yield an overly complicated fucking mess when you try to scale it up.

>i need to make libraries in order to try and improve this shitshow
speaking of, the community libaries are sorely lacking, many are abandoned, etc. Furthermore there are less useful ones and less in general than python.

If you dumb gonigges want simplicity and libraries, then fucking use Python. For all its faults that shitlang is a million times better than the trashfire of a language that Go is.

sepples would like to disagree

php7 is a nice language. just learn basics and then jump to some framework. i am working on a laravel project and it's very comfy

Go is very readible so it wouldnt be a problem with a gigantic project

No it’s more nuanced than that, it depends on the type and the operation. Operations on container structures of similar size should have similar performance. Operations on data may have different performance, some languages let you handle this with dynamic dispatch so you can implement troublesome types specifically and let the compiler generate the generic code for the rest.

> Go is very readible

Attached: EVc3Nm0.png (770x478, 427K)

Inlining isn't always efficient, especially the more complicated the function gets (binary size vs function call cost). Inlining sorts is kind of impossible because they're recursively used and you wouldn't know your run-time requirements.Not sure how you'd need them to be generic, since if you're using a standard vector you're sorting a non-generic component of the vectors, which is not the same as fully sorting the types, which is always going to be more efficient. I have a feeling you might not get that a "generic" function must always expand into all possible function types at compile-time or run-time. It results in less code, but more behind-the-scenes stuff.

Learning what the fuck this means is 30 seconds now try to teach someone writing in Java his whole life to read C++ code in a decently small amount of time good luck with that

training neural networks to do some keypoint detection for me. which brings to the question:
is it in any way significant if i have my pixel values scaled to (0,1) interval and keypoints coordinates to (-1,1) interval or can i just as keep them in (0,255), resp. (0,224) range?

>Inlining sorts is kind of impossible because they're recursively used
Only in languages with tail-call optimization. Most languages implement their standard algorithms iteratively.

>Is the value an indicator of success/failure, is it a number, is it a pointer, is a non-zero non-one value an acceptable outcome?
Perhaps you should not use a language where any of those can implicitly be cast to a bool.

Should I die for filling a buffer with sprintf?

Attached: 1556777998717.jpg (799x765, 115K)

>learning a retarded return value format is comparable to a memory managed language vs not in completely different paradigms
shiggy

>Go fanboys who refuse to improve their own language will justify all its bullshit rather than admitting there's a problem with it.

point proven

Nigga inlining removes the function label. You can't infinitely substitute a function because it cannot call itself if inlined. If it used some loops and stuff that's fine, but inlining literally removes the function handle.

It looks like you have no idea how generics in compiled languages work, just run the test yourself, the conclusion you'll get is that
> STL’s sort runs 20% to 50% faster than the hand-coded quicksort and 250% to 1000% faster than the C qsort library function.
and the reason behind this is templates.

>having bools in your language
>literally only being complicated enough to handle true and false
enum your goddamn error codes/return statuses you mongrel

Attached: 1432471765932.gif (475x347, 486K)

Why would an iterative algorithm need to call itself?

Attached: A902B482-4CC3-4060-A77C-7B8E4FD0214B.jpg (225x225, 9K)

No thanks, I have discriminated unions.

Generic code cannot run more efficiently than type-specific code. Full stop you dumb shit. Generic code expands to type-specific code. That's it. whosever ass you pulled that from is probably not as dumb as you for believing it.

>certain things are undefined behavior
Oh shit nigger I think you have fucked up then and no if condition or tests will save yo ass

Standard sorts are recursive, by iteration (recursion over a fixed size) or ever-expanding recursion (like dumb factorials).

no you

enum {
TRUE,
FALSE
};

Attached: fufu.png (454x404, 140K)

Sure, but are you gonna hand-code full quicksort implementation for every combination of types and comparisons?

He means that std::sort inlines the comparator, not that the sort itself is inlined.

godbolt.org/z/lDOlPt
seems to work fine in sepples

That’s not the definition of recursion. A loop is used to avoid recursion so you don’t create too many stack frames.

Attached: 09BFC53D-D47A-4703-9907-5137435E1263.jpg (306x344, 42K)

> Standard sorts are recursive, by iteration or ever-expanding recursion
> recursive by iteration

Attached: e55.png (680x680, 150K)

>name calling
please don't bully user

>!pointer
i will grant you this. for the purpose of some instances where its not completely clear what the onditional will do, having a boolean comparison makes sense. However, that doesn't mean you should do it where it isn't needed.

A loop is recursive, and recursion can be done iteratively. Try to define the difference between a non-unrolled loop and unrolled loop without saying a non-unrolled loop doesn't refer back to the start of its block.

It has nothing to do with the machine. That's just how some languages are defined.

That's not how it works.

The thumbnail looked like loli stepping on me :3

How do you define mutual recursion with this definition?