/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Old thread:

Attached: 1544551052481.png (1052x1342, 769K)

Other urls found in this thread:

docs.oracle.com/javase/tutorial/collections/implementations/list.html
twitter.com/NSFWRedditImage

nth for Nim!

First for Python!

JavaScript rocks!

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

I'm working on a language where you write functional algorithms and separation logic specifications which then are used to synthesize imperative programs.

JavaScript rocks!

Attached: javascript rocks.png (1000x494, 134K)

>then are used to synthesize imperative programs.
why

you could atleast flood /b/ or /trash/ with this instead.

shiori has no interest in programming, don't misrepresent her pls

Attached: __shiomiya_shiori_kami_nomi_zo_shiru_sekai_drawn_by_ninnzinn__43b915a42476d3f0dbc3f6336eec0515.png (1125x1500, 1.2M)

This fine poster is obviously made in Python, scraping and sending data is extremely easy

Well it's really just compiling the functional program based on the specifications, but I want to make the distinction between that and e.g. graph reduction like Haskell.

there are plenty of languages where it's easy, user
sounds like you have some experience with python, that's all

Proof that Nim is too fast, and Python is too slow, they're not even playing the same game

Can programming cure my depression?

Yes, or may push you to the edge and you kill yourself

put that depression into developing an AI to be your gf.

yes, insofar that it will be a distraction and occupy your mind
no, insofar as it's not solving the root problem

>get hired as a jr dev 4 months ago
>company is switching me into networking/infrastructure dept now

gz

any good articles on react native vs native performance on android?

Who the fuck makes these dumb ass decisions to jump to the newest and retarded frameworks at company's
>moving from .net to node.js to "reduce bloat and cut the fat"
>jumping to angular for reasons despite the fact it slows everything down
>jumping from angular to Vue
>jumping from Vue to react

Attached: 1548810855169.png (1000x432, 165K)

That makes sense, but couldn't they just make it so the variable can only hold instances at most as large as the largest derived type the compiler knows about at the time? It sounds unpredictable, but if you actually think about it, it could work. After all, if the compiler doesn't know about a type when it reaches a certain section of your code, it follows that you haven't included the header that declares and/or completes that type, right? So by extent it follows that your code doesn't need to deal with that type. I guess the very fact that a possible implementation of by-value polymorphism is the matter we're discussing does change that a bit -- seeing as you could write code that uses by-value polymorphism, and then later try to call that code on an instance of a derived type declared later than the by-value polymorphic code, and it would still result in the instance being truncated -- but they could just decide you're not allowed to do that. That is, you're not allowed to use a by-value polymorphic symbol to store an instance of a type declared after that symbol. Sepples has plenty of gotchas and UBs anyway, what's wrong with allowing more to exist.

Why are lists such a pain in the arse in Java compared to Python lists?

because youre a brainlet

It's to create artificial work. If you don't switch frameworks every week, management will start to wonder if you guys even do any work.

try C, you'll beg for a Java list

Not him but A) it's very easy to implement a list in C, and B) you don't even need lists because you have realloc

The fuck you smoking? Handling a dynamic list in C is a pain in the ass.

Python lists (from the very limited exposure I had to Python before switching to Java) were far easier to utilise. I spent ages reading trying to get Java concise list explanations from Stack Overflow, and eventually decided "Fuck it, I'll just use ArrayList".

it's the first program I'm attempting to create independently, and it's just a basic ATM that accepts a PIN and gives a list of cash amount withdrawals, from which you can use the Scanner function to select how much you want.

>array == list
this is your brain on python

>Scanner
protip: this works surprisingly well as a brainlet poster filter for some reason

How so? I just learned about the Scanner function in my Java night course recently. Why is it a brainlet test?

>im smart because i do things harder for myself

If you use anything except Python I would just assume you are 30 IQ points lower.

>tfw 30 IQ points above average so I can assume that anyway

Attached: 0A01CBE3-B156-41FA-ABC7-A1B52B323BE5.png (540x443, 255K)

>Java
>night course
>recently
also consult the archives

Attached: JediTemple2.jpg (2048x1152, 724K)

python is the most difficult language

i have to keep the type of variables in my head rather than just having them on the screen

Yes, everyone on Jow Forums is just a 180 IQ genius.

Also, you were so close to six digits there

Or you could add comments to your functions explaining their input and output.

comments arent a substitute types faglord

he killed Terry

okay, retard

Command line programs use command line arguements or a TUI. Never scanner.

If only there was some way to name your variables so you know what they store.

Which is a good language for mobile programming? I plan to make an Android app for my personal use but don't wanna get stuck on only building apps for that OS.

Maybe something that can compile for multiple platforms?

Make a web app and use a browser

#include
#include
#include

namespace ayy
{
namespace lmao
{
namespace lmao
{
namespace lmao
{
namespace lmao
{
namespace lmao
{
namespace lmao
{
namespace lmao
{
namespace lmao
{
void ok()
{
std::cout

Isn't that the whole point of most Android apps being Java/kotlin?

Lisp is the most powerful programming language.

What's wrong with Scanner? Why wouldn't you want to make your life as easy as possible when programming?

gg

public boolean add(T elem) {
return table[Math.abs(elem.hashCode() % table.length)].contains(elem) ? false : table[Math.abs(elem.hashCode() % table.length)].add(elem);
}

Can someone explain why this is throwing a nullpointerexception when the table length is set to 20 and i try to add a new element?

Abstraction

Because abstraction. Python is doing all kinds of wild crazy bullshit you dont know about that is both horribly inefficient and great for introducing unwanted bugs.

Python is arguably a hard language once maintenance is a factor because nothing is commented, uses FORTRAN length names, and who the fuck knows what is gunna return from a function.

No they chose Java because there was already an ungodly hoard of java programmers and it doesnt introduce memory safety problems like sepples.

I'm getting seg faults from dereferencing a null pointer, but I followed the code flow and found that nothing ever changes the pointer, at least explicitly. So I set a watch point on it with gdb and the pointer seems to change value when I'm calling malloc for another unrelated pointer.
Why is this happening?

You're going to need to post code.

>found that nothing ever changes the pointer
doubt.exe

Perhaps you are modifying it by indexing into an array out of bounds, and modifying that. Or something similar. Like other user said, we're going to need to see the code

>So I set a watch point on it with gdb and the pointer seems to change value when I'm calling malloc for another unrelated pointer.
Depends: does the pointer's pointed-to value change, or does the pointer itself change value?

In the prior case, your problem is that you're storing the pointer itself in unallocated or deallocated space.

In the latter case, the pointer *points into* unallocated or deallocated space.

In any case, you should install valgrind and run it on your program.

>std::getchar();
spotted the poor wincuck

The code is terrible spaghetti spanning files, which I'm sure is reason why this is happening. It happens when I'm calling malloc for an array of char* in a loop though.
I've had this same problem happen before and I remember it causing heap corruption. I never solved it and just did a crappy hack job around it.
So pretty much it's being caused by repeated calls to malloc.

You probably triggered some undefined behaviour and the compiler graciously optimized your pointer away.

I'm bored and feeling motivated, anybody need help with some little problems? I don't even mind working on homework.

Languages of experience:
C / C++
Java
Groovy
JavaScript
Haskell
Python
Ruby (some)
Lisp (some)

Attached: haskell.png (868x1229, 1.45M)

Does anyone use Docker or Kubernetes?

Or is everyone here limited to command line apps?

Attached: 1549318888646.jpg (2560x1440, 746K)

Help me sell my computer

>So pretty much it's being caused by repeated calls to malloc
have you tried memsetting to some value and then dereferencing the pointer to see if you get that value back?

>Does anyone use Docker
Yes
>is everyone here limited to command line apps?
I use CLI Docker, yes

If you pass a pointer to a function it gets a *copy* of that address and stores it in a stack variable. If you realloc or malloc into that stack variable but *do not repoint to original pointer*, e.g. a double pointer, then your previous pointer ends up in the nethersphere.

TL;DR post code

Selling a computer is dumb user. You can always use an old machine for something and you never get the money you want out of it. Turn it into a media pc or a server or something.

I use both at work.

Attached: 1545537206137.gif (834x870, 327K)

>its being caused by repeates calls to malloc
I guarantee you malloc is not the problem. Youre mismanaging a pointer reference somewhere, most likely not using a double pointer when you should've between two functions.

whoops, that was it
thanks

You know you can cast a pointer to an unsigned long and print it wherever right?

Perl is fun you should learn Perl

Attached: generator.png (2560x1392, 369K)

Because Python is more like Lisp than Java is.

Python is literally Lisp but better

Python is the most powerful programming language.

Python is fucking garbage.

>but couldn't they just make it so the variable can only hold instances at most as large as the largest derived type the compiler knows about at the time?
Because that's incredibly fucking retarded.

>So by extent it follows that your code doesn't need to deal with that type
Wrong.
void foo(Base &b) {
Base@ b2 = b;
}

b could've come from literally anywhere and could easily be a type that that translation unit doesn't know about.

>but they could just decide you're not allowed to do that. That is, you're not allowed to use a by-value polymorphic symbol to store an instance of a type declared after that symbol.
Really, really, fucking stupid idea.

>Sepples has plenty of gotchas and UBs anyway, what's wrong with allowing more to exist.
Fuck off, dumb retard. You don't know what you're talking about.

How do you learn to understand complex API's? I find that using them generally boils down to using just a few key functions, but when they have like over 150 functions with a million different options each, it seems overwhelming.

Remarkable how wrong you are

RTFM

Can I program my own isolated CAN system out of a basic bitch 5V microcontroller? I have read up on it and understand how can works, but Not sure if I can get it out of a microcontroller

first you get the problem, then you get the tool, then you get the women

Attached: scarfacenew.jpg (1680x1050, 349K)

The manual designed for brain surgeon rocket scientists?

How I make games with Python?

Find a project that uses the API and read their code. Or if there is official example code, read that. Once you've wrapped your head around the core concepts, you can comfortably read the docs to fill in the rest.

You don't need to learn every whack ass option. Just use what you need, and live with the fact that you don't currently understand all of it.

>You can always use an old machine for something
No nigga. Don't fall for the tech hoarder trap.

Sometimes it's better to let that P233 go than to run it as a 75W idle DNS server.

there are no problems in the world except capitalism

t. Commie

You probably believe in other disgusting things, like functional programming

...

Capitalism is the best system out there, even though it has many, many flaws. Maybe economists need to come up with a good solution.
This is off topic though.

Attached: 1549201508463.jpg (300x168, 9K)

Best drugs for programming? I've found luck with Amphetamines, as well as Alcohol if you don't go too far past the Ballmer peak.

Attached: dva-dpt.jpg (919x920, 79K)

water

Good sleep

>capitalism
so in the context of complex API's, you're referring to Barnyard Soupysoup, Morgan Stanley and sepples?

Drinking makes me dev faster, more focused and enjoyably. It is scary. Turning 27 soon and don't want to start a very bad habit.

drugs are bad, don't do drugs. also ketamine

I like ugly 4-5/10 girls and I like how ugly generic Rust looks too. I think there's a correlation. I'm naturally repulsed by 8-9/10 bimbos because I know they'll just waste my time.

Attached: 1540869080905.jpg (225x606, 74K)

Idris is excellent.

>List is an abstract
>docs.oracle.com/javase/tutorial/collections/implementations/list.html
List new_list = new ArrayList();
new_list.add(null);

Are you sure you're not just stupid?

dumb frogposter

>mutable
eww gross