/dpt/ - Daily Programming Thread

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

Attached: 1543047295335.png (600x819, 655K)

Other urls found in this thread:

en.m.wikipedia.org/wiki/∂
twitter.com/SFWRedditVideos

Invalid thread.
Real thread here:

Na gonna stick to this one thanks though

This one is better

Attached: 1543202834516.png (569x569, 560K)

The OP is not your personal shitposting space.
Fuck off.

My anime girl is cuter and sexier.

not him but it kinda is, within reason

[CODE]test[/CODE]

test

Why does CLR align this structure using 8 bytes instead of 4 ? Is this normal? I expected size to be 12 bytes but it turns out to be 16 instead.

[StructLayout(LayoutKind.Sequential)]
public struct Person
{
public int Age { get; private set; }
public string Name { get; private set; }
}

var def = default(Person);
Console.WriteLine(Marshal.SizeOf(def));

>Fork rust
>make everything unsafe by defauft
>add a 'safe' keyword

Attached: 1432566035107.png (500x567, 69K)

Not familiar with CLR but under sensible semantics if string is an 8 byte reference type then there will be four bytes padding inserted between the int and the string.

This would actually be useful. The borrow checker should be conservative in the opposite direction.

What language should I learn if I want mass compatibility i.e just the ability to run on most systems without much messing about or configuration?

Why does Python3 exist when Python2 works fine?

Python

Python is the WORST language for this.
Do not listen to the fucking idiot , he's just trying to shill his shitty language.

Why do programming languages exist when writing 0s and 1s works fine?

why is it bad for this and what would be better?

You actually think I invented the most popular scripting language besides JS? I'm honored.

There is a massive difference from 0-1's and Python, but not Python2 to Python3

Because goduido didn't get it right the first two times.
Some might argue he didn't get it right this time either.

It's bad because of python2/3.
You have a better chance of a compiled program written in x86 assembly working on any given computer than a Python program. LMAO.

Look I know I was insulting you but I didn't insult you THAT much.

There is a considerable difference between Python 2 and 3 and the difference is only increasing. Python 3 is simply a better language and most people are switching or have already switched to 3. Why would you use Python 2 when 3 exists? It's not like package support is really an issue anymore.

How much more productive is Haskell programming vs. Java or C++?

Shouldn't I make proportionally more money with programming in Haskell vs C++?
C++ job $100k
Haskell job $500k?

or just start a business competing and making billions. imagine Facebook but written in Haskell instead of PHP. You could buy the whole planet

Attached: 1474220773777.png (836x964, 464K)

step 1. go to a jobs website
step 2. search haskell

It all depends on the job. You could shitpost on Jow Forums about Haskell being great for research while there's fewer research jobs available, or you could work nearly anywhere doing or

Where I was working we used C99 and Perl, until they couldn't pay salaries... one job offer later wanted me to go to a Javascript shitpost camp across the country for $8.25 an hour until I'd "probably" get hired immediately two months after.

And what would be within reason?

Lisp is the most powerful programming language.

( is it?

C

>used C99
I would honestly work for free if it was on C. That's literally what I'm already doing technically with open source shit.

Can any maths nerds help me understand this? I genuinely want to be able to do this but keep getting tripped up on the theory.

Attached: Capture.png (927x450, 40K)

Imagine willing to work for free in a trash programming language.
LMAO

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

This one is better.
Don't use the other one.

me

Are you a software developer/engineer? Curious about the scope of work they do

Haskell pays well, but not many people get paid for it at all. It's kind of niche, but it is by far the best lang in those niches.

Starting my own blog in Java. It will run on a Orange Pi One. I chose Jetty as my web container.

>Jow Forums, the "smart" board
>can't even write a program that, when given an arbitrary polynomial with integer variables, determines if there's a solution

Attached: 1539352235132.jpg (700x461, 48K)

Who's the artist?

never heard of it

Is it considered a bad practice to abuse exception to break an infinite loop?

*blocks your path*
come up with better homework next time loser

Attached: Annotation 2018-11-30 082327.jpg (758x228, 56K)

Yes. It's considered bad practice to use exceptions at all.

I like my anime girls like I like my functions, pure!

exceptions should not be used as control flow. they're for error handling and that's it.
just use a break.
also consider optional types.

just use call/ec

And useless?

also if you're not homosex, you'll implement your infinite loops as generators
def infinite_loop():
i = 0
while True:
i += 1
yield i

ints = infinite_loop()
print(next(ints))

Sometimes it's convenient to get reduce of forEach with termination with throw instead of installing lodash.
Also in OCaml it's common practice to break loops by raising exceptions, but in js it's rarely seen.

Please respond.

Attached: 1396571416586.jpg (278x278, 34K)

consider using well defined layers for machine learning instead of ones you pulled out of your butthole.

Doesn't work. The idea of the BC is that you guarantee that state is kept in a valid state and ensure it progressively while programming.
If you went the other way around you'll just have basic compiler warnings. Consider where your compiler in C++ can give you a warning because of a guaranteed null pointer dereference. That's sort of what you get.

The addition of a safe keyword would require the state used within is garaunteed safe on entry. Which means you'd have to ensure it is safe outside the safe block. Or override those checks.
To use safe effectively then you'd need to have a big block (or the onerous nature of the state import would be too much to bother) and it would have to just deal with other safe code (or you'll break the block, making small blocks).

It's not easy to do in an isolated way.

>The addition of a safe keyword would require the state used within is garaunteed safe on entry. Which means you'd have to ensure it is safe outside the safe block. Or override those checks.
baka

Well d notation means "the change in". b is bias. I don't know what w means. Mathematically speaking, d refers to the discrete/step change in, while delta refers to an instantaneous/infinitely continuous change.

>fork rust
>fork rust a lot
>modify the entire commit tree to jumble up the committers
>make subtle changes that are difficult for the average pleb faggot to verify that would ruin the language's usability
>abuse SEO practices to make your forks flood the google search index
>watch as rust burns to the ground
open governance or no governance

Attached: devilish.gif (425x481, 1.51M)

You can't. I don't even need any source code.
You just can't. :)
>Jow Forums, the "smart" board

Attached: 1421167516167.gif (600x337, 1011K)

I don't follow. How would you get around that? Overriding those checks just means you're still not safe unless you actually did garauntee it (and the BC didn't realize).

your tech isn't what matters the most in a business.
Make a blazing fast facebook, when 10times more features and I can guarantee you it won't ever takeoff.

This isn't sufficient.
It depends on how you classify error. If it's an error you handle is it not just a mode of function in your program?
Exceptions are for panic scenarios.
We need to allocate dynamic memory but our platform has run out and we don't want to handle that case.
Interesting that you come with this comment from a language that expressly encourages exceptions as control flow use. Ask any python programmer the pythonic way of writing a function to check if a string represents an int.

>gradient matrix
That's analysis in R^n -> R^m is it? Your course had taken an odd turn I guess, but maybe think about it as the functions having a derivative for each of their arguments, and they expect you to approximate the value at some point of each of those derivatives. Dunno if this helps

doing things the "pythonic" way is bullshit like 30% of the time, exception handling and duck typing is part of that 30%.
If exceptions and duck typing were so fuckin amazing, type hinting and static typing extensions in Python 3.5+ would never have happened.

The actual solution to "duck typing" is typeclasses/traits/concepts, not exception handling.

>Mathematically speaking, d refers to the discrete/step change in, while delta refers to an instantaneous/infinitely continuous change.
Isn't it delta discrete and "d" instantaneous?

How do you think Rust guarentees safety on exit of safety block and entry back into safe code?
Protip: it doesn't, it just assumes.
Same solution, just assume safe on entry to safe block.

>on exit of safety block
exit of unsafe block*

I think lowercase delta is continuous isn't it, while capital is discrete? I might be thinking of partials

And I'm telling you it's a bad solution. Are you so dense you don't see the issues with having safe blocks that are supposed to be safe but they offer you no garauntees? Then what was the point? It's lacking any sort of robustness to change even when it works.

Oh nevermind. Well Δ is discrete that's for sure, but I remember being told explicitly that the curved d that we used for partial derivatives was *not* the same as a δ. Lemme check le wiki

And of course Latin small letter d is continuous

It's not "my course" because I just got the materials from the web. It's what I want to do though so I'm slowly working through it. Very obvious I just need to go back through the different fields of maths that lead up to this one, like linear algebra.

Hey guys, I was starting to learn Java, and going through my book came across this, where the one on the left is what the book showed me, and the one on the right is my attempt at modifying the program to use, and output 1's and 0's from the books challenge, but I can't find any way to get the logical not operator to use the byte, but i can't assign 1 or 0 to boolean, so I'm kinda stuck on what I'm supposed to do.

Attached: bandicam 2018-11-30 06-06-25-865.jpg (1177x835, 294K)

I'm not the guy who made the suggestion. He is obviously shitposting.
I was just simply pointing out inconsistencies.

Yeah definitely

en.m.wikipedia.org/wiki/∂

QED

Bitwise negation of p is ~p in javacaca.

Thank you come again

Yes, he got it wrong, Delta is change, so discrete difference, while d is for differential or infinitesimal, which is the same for the partial "d", small delta would be the functional differential.

So now need a second infinite loop to call next on your generator? Perfect)))

Nah you just need list(ints).

Expand your mind through the power of abstraction man

I have never heard of any real-world use cases where two infinite loops connected via coroutines were a correct solution.
you could do it
but 90% of problems usually only use one infinite loop, the other loop is just "really long"

Infinite list with greedy evaluation, hmm... Really makes me think if you're trolling)))

Inconsistencies?
Like offering two potential solutions to a problem with various levels of success?

So broskis, i have a little problem, i have been learning "non-webdev" programming for a bit and everything is fine and dandy but...what do i even create, like each idea i have can be created on a website without any problem, like ok i use C# with Unity atleast so there is that but what do i use what i am learning on RUST for. What do you guys even do all day if it isn't web-dev?

Attached: 1541793058250.gif (680x502, 179K)

>excel macros have pointers
>Java doesn't

"Yikes!"

Define "pointer"

I honestly don't see much of a difference. On the web you're constrained to a browser. Outside webdev you're not. How is that constraint helpful? Are you thinking of how to deploy your software before you decide what to do? The web absolutely has much bigger ease of deployment.

You could do anything from building a robot to just doing the same thing you've been doing except as a non-web application.

Personally I'm either working on an embedded environment (work work, not hobby work) or I'm working on a data visualization tool for reverse engineering.

But outside of web you can't program wordpress with html.

That's what you meant by webdev programming?
That's not programming at all.
Try building a website from scratch using basic components and frameworks

Sorry I don't follow. Are you claiming you can't implement wordpress (whatever that is) and give it html in your own software?

I am not this guy Anywat its that, i just don't see any reason to go beyond the web, i fail to see a purpose in creating things that can be done (easily) in the web instead of "native". Also doing things in the web seems to be easier in terms of creating an UI for people using it thanks to CSS

My experience speaks in favour of web pages rather then against but I'll post it anyway.

I wrote an application that starts up a web server to share files locally because any device has a web browser. You can dislike this state of matters but you can't deny that or works.

I wrote bookmarklets. Easiest way to make your phone make non-normie stuff by far.

I had a job with enterprise software and I'm glad it was a web based solution because imagine doing Cobol or Visual-whatevertheshit in the year of Our Lord 2018.

Webshits are our allies not our enemies /dpt/.

that just means the only applications you want to make are effectively just front-end GUIs.
That's fine and all, but there's an entire class of development that would be better off if it were not constrained by the limitations of JavaScript and WASM.

Usually performance or communication oriented.

The reason you find it easier is because someone programmed outside of the web for you. There's plenty of things to do, you just don't find them interesting and are ignoring them, which is fine, but you not knowing about them doesn't make them not exist. The latency between the server, browser and then computer for example makes a lot of performance driven programs difficult to manage for example.

>css is neat
Depends on your preference. It's what you know so naturally you'll think it's an OK thing to use. Someone who doesn't know CSS might want to design their UI using what they know.
>seems to be easier
I would probably not be able to do my visualization tool on the web. I don't see it happening. And the embedded platform would have to be an entirely different thing. And your browser wouldn't exist if it weren't for someone writing it.
I don't know what I could possibly say more to aid understanding. Maybe go try or imaging to do something much more ambitious on the web. Hold no reason in your head for constraints. See if it works. See if there's ways of making this easier outside of the web.

>WASM
Is this available outside emscripten yet?

emscripten is just a toolchain
i assume you mean asm.js, and yeah, native wasm is available in a bunch of browsers

it is technically supported by all evergreen browsers (i.e. edge, chrome, firefox) but there's still a lot of work left.
they're going to let wasm rest for a while until the community starts using it and finds stuff to improve.
right now the main work is in getting interop from native languages for wasm.

This. Python3 feels a lot more like C, then Python2.

>the main work is in getting interop from native languages for wasm
WASM is also slow as shit and loses to normal javascript in most cases.

How? Most of the features people who use the language care about are focused on the fact that everything in python is dynamic.

I'm not talking about features of python, but the functions. A lot of the past function wrappers for syscalls had a syntax or name that abstracted away the underlying syscall.