/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: iec_61131.jpg (1400x1376, 115K)

Other urls found in this thread:

txt.do/dz8bu
eloquentjavascript.net/1st_edition/appendix2.html
i2p.rocks/spinnycube/
my.mixtape.moe/ihndna.webm
reasonml.github.io
my.mixtape.moe/fzdcjl.mp4
notime4name.itch.io/laserjuice
twitter.com/NSFWRedditVideo

>No chinese cartoon girl in the OP
Please stop this senpai

Asking again since last thread is spartans.
Any people here actually work in enterprise?
I got a job offer and I need some non meme opinions on what to do.

>non meme opinion
>in slash dee pee tee
uh oh

>spartans

Attached: 3khrnri[1].jpg (610x357, 79K)

what is "enterprise"

dead

AbstractFactoryFacadeBean

Hi guys, I am new to Makefiles.Can some please tell me why I am getting this error when trying to run this Makefile?
make: *** No targets specified and no makefile found. Stop.

I am running on Linux.Here's the Makefile(the source code is called calc1.c):
CC = gcc
CFLAGS= -g
#
# Compiler flags:
# -g -- Enable debugging

calc1: calc1.c
$(CC) $(CFLAGS) -o calc1 calc1.c

clean:
rm -f calc1

>3DPD thot edition
fuck off karlie

I'm not sure but I think that there are no targets specified and no makefile found.

> Any people here actually work in enterprise?
yes

I can confirm that this is the case.

no I'm a NEET living off of good boy points jerking off to the anime girls in headphone threads

did you call it "Makefile" with a capital M?

I'm currently a junior enterprise java dev, been working for 2 years at this company now. Standard enterprise stack, Java Spring Hibernate etc. and now I have a job offer to become a JIRA developer
i.e. ditch the spring stack for knowledge of Atlassian products
and I wonder if that is a good enough career path.
I understand I'll get a lot of hate her for being a Java dev but any real answers would be great.
EU based btw.
slav here actually.

Yes, I did.

Ok, so how do I specify said targets, and how do I create the "Makefile". I created the "Makefile" on the same directory as the source code.

>EU based btw.
so what's your yearly comp, 20k in monopoly money?

>3DPD

Attached: 1530494617063.jpg (285x281, 34K)

plcs are gay

If the job offer comes with a higher wage, take it. Atlassian is also a well known name, good for your resume. Did they say what language you are expected to write code in?

Perhaps you have a really old version of Make or something. I made a sample project and tested it with your Makefile and that works.

Perhaps try editing it to
CC = gcc
CFLAGS= -g
#
# Compiler flags:
# -g -- Enable debugging

all: calc1

calc1: calc1.c
$(CC) $(CFLAGS) -o calc1 calc1.c

clean:
rm -f calc1

The wage is higher but my current boss wants me to stay and told me he will give me a raise to equal the job offer.
I will not be working at Atlassian.
The company that wants me is a platinum partner of Atlassian (or something like that).
I will be responsible for creating plugins and workflows for JIRA (Java + React). There is a lot to do with integrating JIRA with other services a client might have.

The win condition is much simpler to write with a set based representation. You can specify all win conditions declaratively and then you only write one loop that handles all possible win conditions.

With array representation you need separate blocks of code to check rows, columns, and diagonals because the index math is different for each one.

nice feet desu

I'm working on a water levels program that was probably a homework of some Jow Forums user weeks ago.

The amount of possibilities is a nightmare.
After 2 days I managed it make water 'drain' if there's a leak (0 or less value) and to check if user isn't starting the list with values that are equal - no place for water.
I still need to make the water 'lower levels' if there's a value that's lower than the previous edge of the basin.
* * *
* * *
* * *
3 3 3 - no water

. * ~ *~
. * ~ *~
* * * * *
1 3 1 3 1
The final 1 should be empty - there's no edge to "hold" the water, but also if the second 3 would for example 2 the water level in center should lower to 2 so only 1 ~.

Complex. Python btw.

Actually, there was some fuckery when it came to the directories, and I got it to work. However, thanks for the example user. Btw, if you don't mind me asking, what exactly is the meaning of the "all" line, and the "clean" line. I also don't understand what's the point of this line either "calc1: calc1.c". Sorry for the dumb question, I am just a brainlet trying to learn.

here

There's nothing wrong with taking an offer if it advances your salary by a nice amount. You are also young so you can pivot again after 2-3 years. In the long term, I'd be wary not to paint myself into a corner, by knowing only a specific vendor's stack. But that's long term, you can always go back to Spring later, if you like the offer take it. There's value in trying out different jobs early in career and you're not really closing any doors by switching jobs (except for these exact companies you leave, they probably won't rehire you, but there's always a lot of companies).

Don't feel stupid, all the differnt C build tools feel insanely arcane to use. The name "all" doesn't really mean anythign special, it is just normal to use the term "all" as a name for a target that builds EVERYTHING (eg. imagine a game that has seperate binaries for a game server and the game itself).

target:

You invoke a target with
$ make
So eg. "make all" or "make clean". make defaults to the top-most target. I figured perhaps you were using some weird nonstandard variant that looked for that specific name or something. Whatever.

"make clean" is the standard way of removing output and temporary files.
Also rtfm :)

The desired effect should be something like picture related.

Also if there's 0 anywhere - the basin is 'leaking' and nothing gets filled.

I made the left side not fill if there were no inputs over 1 (edges higher than 1), but the basin still "fills" if there's nothing on right, or if the edge is lower than the one left.


The code in python, valid for next 1h.
txt.do/dz8bu

Attached: Untitled.png (741x162, 8K)

>rtfm
I will take that advice to heart user, thanks for your guidance.

Thanks for the reply. What you are saying sounds very reasonable. The thing that draws me towards the new company is that they follow strict practices (git flow, clean code, code reviews, CI/CD) and pride themselves on being good software engineers. My current workplace not so much, so I though to myself that even working there for a year or so I could gain much in terms of being a better developer in general.

Make sure to ask questions about the job, environment, and things like that.

If you think you will like the new job better or it will be better for your career, absolutely take it. Loyalty is a bad reason to stay at a company, even if they raise your salary. They pay you for work, and will fire you if they no longer want you. It's just business. And if you stay, you may always think "what if".

Also remember it will always be easier to be rehired by an old company that knows you than getting new opportunities. People can vouch for you.

The only reason not to go is if you think the new place will make you miserable.

Just a remark, all these partnership certificates in IT are as valid as bachelors diploma in social interaction. A title for the sake of having a title.
Oracle /IBM /Microsoft partnership certificates hanged in most Halls of my previous employers or places I've just visit.

Also, make will run the first target defined if not given an argument on the command line. Typically the first target is called 'all' so you build everything if you don't give an argument.

That sounds like one small step above "SharePoint developer"

Yeah the last thread is so XXXTENTACION

So I'm trying to implement a fixed point library in C++ for use with C++ and Python via pybind11. I'd like to make the fixed point sizes template constrained (for quicker math), but that's obviously not kosher for Python. So any C++ that would interface with Python and an external library would take size constraints on construction. Then I would dynamic_cast that in the pybind11 wrapper. Is that a good idea?

Noted, I see the purpose of all more clearly now. It is a way to "execute" multiple files/arguments at the same time. Otherwise, it would just execute the top as you mentioned. thank you very much user. I see how useful make files are now.

Bump for any advice, please.

This is the first time I'm writing anything this complex and any input is valuable. I already rewrote it twice.
Or at least any hint on how the program should proceed.

Well the real power is that make determines what source files have been modified since the last run and only update and link those object files that have been changed. And you can define arbitrarily complex dependencies.

How would you have a continuous 1ms cycle check an array for specific values in all its objects without it having an abomination of a runtime complexity

Attached: question.png (1478x446, 35K)

>keep checking every 1ms all elemements for a value
This by definition cannot exclude
>having an abomination of a runtime complexity

What do I need to do for an interview? Have three interviews this week, hoping the lack of a CS degree won't hurt and the fact that my portfolio is decent will go a long ways.

depends what kind of job it is.

Depends on the hiring company. Do you do well under stress?
Show portfolio btw.

I'm making an incremental game like Cookie Clicker, how can I make it know if the user's amount value >= an upgrade's cost and that upgrade hasn't been bought already. I'm lost

>tech stack this and tech stack that
glad i'm not a java/js-devvo whose entire work experience is subject to fashion

What are you writing the game in?
Try the observer design pattern.

All are entry. One is for a Java developer, one is WebDev, another is SQL.
They're local companies, and I'll like my Git in a second once I finish up something, but it's really not that impressive, just three apps written in Java, three websites, with one of them being for a local business I went into and asked if they wanted me to make a website for them.

You could track changes on array or get new array every couple ms.

assuming it must be visible as a button at all times as a gui option, just check before drawing the element
if not, check on attempt to purchase

>One is for a Java developer

could you tell me the difference between

String a = new String("abc")

and

String a = "abc";

user-kun?

Attached: scat.jpg (636x932, 24K)

Hello sir I too am of the makings

Work in progress, obviously

Attached: makeshit.png (1312x938, 42K)

wrong (you), I meant the other guy

Attached: 1440984156112.gif (540x400, 898K)

I see, interesting, I will try to dive deeper into makefiles. They seem to be a godsend for C programmers. Thanks for the gold nuggets user.

I have a shitload of free time and nothing (fun) to program. What do?

Do this

An operating system like TempleOS

>What are you writing the game in?
In JS. I'll check out that pattern, thanks

Thing is that the user doesn't check if it's available, it 'makes itself available' so to speak. When the user's amount gets >= the cost of an upgrade then the of that particular upgrade has an additional CSS class attached to it, so it looks lit up and is available. So this isn't user-directed and I would like to preserve that UI design decision

Seems very expensive

>half of /dpt/ struggles with C, let alone an actually difficult language

An interesting thing, only particularly useful if you're doing a fuckton of code re-use:

If you have a "master" include file, you could write a preprocessor for your makefile. You can use #include thing1 #undef thing2 from your master header to include or exclude rules from the makefile. Link different libs, set different compilers, etc.

At work it went as far as to only scan C files that could be ensured to be in the application (the code base was huge)

>Thing is that the user doesn't check if it's available, it 'makes itself available' so to speak. When the user's amount gets >= the cost of an upgrade then the of that particular upgrade has an additional CSS class attached to it, so it looks lit up and is available. So this isn't user-directed and I would like to preserve that UI design decision
What a disgusting way of handling that. Never thought I would say this but I would recommend you redo that with JS. It would be saner.

can you repost the original assignment?
not that much time

Different user, but I'm a brainlet and I wanna take a shot because I want to eventually do something with my loser life. I believe that if you make a String object in the first example, it's saved to the heap memory as well as being able to be referenced later on, such as if xxx.toUpper.equals a, etc.. If you make the String literal without making it a new instance of a String, then it's essentially a reference point, and can be called upon again without making a new instance of the object. How wrong am I?

those same people unironically shill go over rust while saying you don't need rust as you can just do c correctly

Are you using vanilla JS?
This would be trivial in stuff like Vue or React.
If you don't want full blown frameworks check out RxJS and a thing called Observables.

we're in a situation where people don't want to learn more than one language, and they want that language to be extremely simplistic, so we're headed for a world of c, go and js

If this problem is what I think it is, then I've solved it before. It was infamous for being one of those trick interview questions that is easy to solve once you know the trick.

Only possible types of squares are air, land, and water, water drains into air, and the ultimate question is how much water the landscape holds, yes? You can calculate this directly for each column without simulating the rules.

Here is a hint for the picture here .

min(6, 4) - 1 = 3

eloquentjavascript.net/1st_edition/appendix2.html

Use heap Max

>eloquentjavascript
talk about an oxymoron

If it's simple enough, just have some limits on your rows for height. If it's a negative number, it's a wall, if it's 0, it's a drain, if positive, it's water.

An array of ints is plenty. explicit impassable walls on 0 and max. Between the bounds, anything that's a positive number looks left and right. If left is less, and the *next* column left is less than current, add 1 to left column. Repeat on right. Anything 1 + 0 equals 0, so we can have drains at certain parts of the wall.

Init "changed" to 0. Run through every (other) column. If anything changed, set a value to 1. Repeat paragraph, else it's steady state and you're done.

That's easy.

Put all upgrades into a list and sort it by cost. Every time user buys an upgrade remove it from this list.
Every time you want to check which upgrades can be purchased, you do a binary search with user's amount, which returns an index. Everything below this index is buyable by the user. Then you need to check the item at the index itself. If it costs exactly the amount user has, then this item and items at higher indexes that have the same cost can be purchased. I can throw together Java code that does it.

Oh, if you have left and right bounds 0s, then you can ignore them for purposes of scanning. Anything that drains into them per tick drains empty if they can pass the wall

I did save it together with that anons drawing.

> In your favorite language, write a program that takes a list/array of numbers which corresponds to a bar chart, where water can fill any gaps in the bars. Calculate the total area/units of water (bars are integers).

> Water drains off left and right sides, and an array value of zero is a bottom hole that also drains water.

> Pic related demonstrates concept.


But in my imagination the program grew into a program that takes input of bars that don't necessarily limit the basin.
Ex the last and few first bars (1 , 1 , 1 , 5, 2, 3, 1) can be empty. Also there can be bars in middle that will be empty. I didn't focus on calculating amount of "water" at all.

Attached: water levels.jpg (231x271, 14K)

Dang. If you want to have water *on* walls then you we want two whatevers so we can keep track. Wall array and water array.

Thanks, you spelled it out quite well so I don't need the code, I'll work it out myself.

In that case I would not switch, unless you know that your current company is no longer profitable.
As it is, switching to new job would just be a risk without much reward. It's a very specialized domain you'd be developing for and you might not even like it

So, I started to learn Python and R for my data science class. Do I really need to memorize what every single one of this codes do or just be mindful that they exist and what can I do should I need them?

Attached: D8CRtMS.jpg (374x374, 39K)

>data science
what even is that?

I want to start new web project, but unsure about lanuage. It should have support for functional paradigm, or at least do-notation. What are my options? Anything beside clojure (that has macros)?

If you are lazy you can skip checking to the right of the index you get with bisection. This will create a bug in that when user has the exact amount for some upgrades, they won't light up. But since in cookie clicker games the amount keeps going up fast, then when someone has exactly 100 points, they will soon have 101 and it will enable 100 cost upgrades.

PureScript?

forgot to mention, I meant as replacement for in-browser javascript (so it would actually be clojurescript in provided example).

will check it out, anything more?

I'm a retard when it comes to the design side of programming. I'm reading through SICP and have a copy of Data Structures and Algorithms on the way, and will also throw in a Java 9 book because Java is big in my area still so learning its features would benefit me. Any other recommendations?

BEHOLD! For I have created the alex cube
i2p.rocks/spinnycube/

feed it your techno and it'll dance :^)

example: my.mixtape.moe/ihndna.webm

reasonml.github.io

read the uncle bob trilogy.

Attached: umarusummer.jpg (848x480, 56K)

>recommending unclue blub

newspeak for statistics

but more marketable, I take it? back when I was in school statistics was just part of the CS program

the default experience my.mixtape.moe/fzdcjl.mp4

I'm not sure I understand quite well, doesn't this do it? (golang)

package main

import "fmt"

func main() {
total := 0
max := 0
basin := []int{3, 2, 1, 2, 1, 4}

for _, n := range basin {
if n > max {
max = n
} else {
total += n
}
}

fmt.Println(total)
}

>starting new simulation project
>why not use Julia
>Julia 1.0 - everything's broken, from logging tools to LibCURL to HDF5
>ah well, use 0.7 instead

I swear, if this doesn't pay off in the long term, I'll hack my nuts off.

just finished my Ludum Dare 42 compo entry.
Its a small top down shooter game called LaserJuice, written purely in C++ using the SFML library. Feel free to give it a try, its only 3MB.
If you dont trust my exe (which you really shouldnt) , source code is included, just go ahead and compile it yourself :)

notime4name.itch.io/laserjuice

what are you simulating, user?

why not use a language not based around fake benchmarks?

>exe
where the fuck do you think you are

you should take in jest but also as a gentle request to consider non-windows users