/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last threads:

Attached: 1431401741492.png (600x600, 661K)

Other urls found in this thread:

pastebin.com/p9asiZhU
en.wikipedia.org/wiki/Windows_Subsystem_for_Linux
twitter.com/NSFWRedditVideo

reply to this post with the following:
favorite language
number of sex partners you've had

I’m touching my penis and writing and Todo app in C

Haskell.
Lost count.
All men.

Lua
Zilch

I'm not working on anything right now but I feel like I should be.

Attached: 1551480905584.gif (500x357, 935K)

You could always start on one of these, user.

Attached: g projects 4.png (3840x2160, 1.61M)

>Lisp interpreter
>Difficult

why this no work:

print(format(C, '1.1f') (" Celsius = "), format(F, '1.1f') ("Fahrenheit"))

so wierd, twice in a row posting my question here and seeing it in a monochrome font has made me see the error immediately

If that's python, your format is all fucked up. If not, what language is that?

print("Celcius = {0}, Fahrenheit = {1}".format(C, F))

Decided to try and remove some explicit casting from my C code as per a discussion in a previous thread.
Not only did it compile, run, and do exactly what it did before, it made the code look a lot cleaner as well.

Why don't more people do this? (Assuming they aren't programming in the common C/C++ subset)

>Why don't more people do this?
They do? I know of lots of projects where explicit void * casting is disallowed.
>(Assuming they aren't programming in the common C/C++ subset)
This is a terrible idea for many reasons. I don't think you'll see many people try that these days.

Casting malloc doesn't add any type safety, it makes it worst if you mess up typing your cast. It basically says to the C compiler: I know best, don't warn me if this is dumb.

>What are you working on?
pastebin.com/p9asiZhU

Attached: FizzBuzz.png (1920x1080, 209K)

its python, heres how i fixed it:

print(format(C, '1.1f'), ("Celsius ="), format(F, '1.1f'), ("Fahrenheit"))

it was a clear syntax error. anyway, im in my mid 30s and today was day 2 of my first ever programming class.
your code looks nicer
i should point out that my assignments are turned in online and the website is fucking insanely picky about output. in fact i had 2 identical outputs but it failed me for using a tab instead of 4 spaces, even though the output was literally identical

You're hired!

Attached: 1548783299052.png (447x483, 200K)

this failed
print("============\t=========")

this passed
print("============ =========")

it was aligning with lines above it that were spaced using tabs. for fuck sake

public class FizzBuzz {
public static void main(String[] args){
String output;
for (int i = 1; i the eternal Javeet persists
I've actually never done this before or heard of it until recently, loooooll

Like 90% seem way way too hard for me (Even the "easy" ones), a couple seem challenging, and the rest are things that seem way too simple. Am I the only one?

I'm not going to claim the difficulty scale in that image is perfect but it might just be that you don't know anything about those topics so it seems hard. If you research most of those you'll find they aren't that difficult.

Python
Semantic Segmentation Model that I'll import into dl4j

rolling

Sepples
none

Anyone else /nightprogramming/ here?

Attached: 1429697736410.jpg (1920x1080, 955K)

I sleep at night.

same, idk enough but I feel like i can do these because I actually already done some of the orange ones

good morning say it back

Attached: 1547818803978.png (325x410, 149K)

roll

not me, I'm staying up but for UX design :(

Currently writing a vimscript plugin to make/view/edit jira issues from vim. I looked around and no such shit exists yet, so I decided i'll make one.

Attached: terrys_revenge.jpg (900x599, 104K)

Java
4

Ruby
0

haskell
22

how is that possible in the marriage monad

>marriage

ohayou

Attached: 3.png (627x611, 423K)

>Dot and cross product
>Medium
Literally basic math how tf is that medium

map() {
local L
while read L; do "$@" "${L}"; done
}

filter() {
local L
while read L; do "$@" "${L}" && echo "${L}"; done
}

evenp() {
(( $1 % 2 == 0 ))
}

seq 1 10 | filter evenp | map printf "=> %s\n"

Attached: 10.png (900x419, 352K)

Remember to % 145 + 1 your post.

I dont get how that's even a project, both are literally one liners.

Not everyone is a mathfag that considers vector calculus to be basic

I can see that, consistent you think dot and cross products fall under vector calculus.

not that user but even if you don't consider those basic, it's not a medium difficulty project like said.
you can look up the equations and easily turn it into code.

Then that just means you're too stupid to do basic projects. No need to put them up to medium just because they're too difficult for your small brain.

>Turing machine
>Red
How? All it is is a double headed list to hold the tape, a lookup table to store the rules in, then a function that takes the tape and lookup table, reads the tape at an index, looks up the rule, then writes a value, or changes the index, or stops and returns the tape. Propably less that 50 lines of code.

wrote a typeearuasing future using threadpool and other async utiltiies so i can finally claim my c++17 anime image researcher/tagger/ranker/browser actually competes with the naive javascript implementation in IO

Attached: 1547332149025.png (450x520, 104K)

post code

explain, i cant understand what you are trying to convoy

my anime reverse image searching used to be blocking, but now its only limited to the API ratelimit

but a nearly naive js implementation would already have async IO with nodejs or something
is what im trying to say

I started off learning C++ but switched a couple months in to Python because I had been hearing that jobs are far more available for Python than C++.

Was I mislead?

hope you have a datascience phd lol

In my city there are ~1700 python and ~1500 sepples jobs.
So pick whatever you like the most, I guess.

fuCK

Depends on the location but C++ is far more complex and C++ jobs have far higher requirements.

The catalyst for the decision was the barrier to entry in the industry and since the requirements for jobs that I saw for Python were pretty much, 1. Know how to code 2. send us your favorite meme xddddd

So yeah...

i have a lot of personal projects, and even products that went to market in c++ but no degree
am i gonna make it?

I want to learn sepples. What are the best resources for that?

Attached: 1542268905571.jpg (485x336, 40K)

Do Python. I switched from C++ and it was much easier to find a job (9 month search vs 2 month search).

just fuckin program and read cppreference if something doesn't make sense

if you already know another language just read c++ indepth by bjarne
any other answer is wrong

if you dont know a language, learn c first

Attached: Illya 341 (MM).jpg (1920x2082, 1.12M)

sorry i mean 'a tour of c++' by bjjarne

Sounds good.

I only have experience with babby tier languages like Python so I doubt this would work.

i wouldn't recommend starting c++ if you 'just kind of dabbled in python'
learn c first

just don't forget to delete after you new and you'll be fine

Attached: 1550693127364.png (1920x1080, 1.99M)

I wouldn't recommend C++ unless you have some pressing use for it, or enjoy excessive complexity.

absolutely don't delete before you new though!!!!!!

Attached: 1522164370930.png (500x280, 170K)

you shouldn't have a single raw new or delete in your code ever

Is there any way to learn shell script without installing linux?
I really dont want to go trough the trouble of setting up a dual boot.

>excessive complexity
Either you have no idea what you are doing or you are a really bad programmer if you can't see why C++ is worth learning.
C++ have more "features" than C, but it doesn't mean it is impossible to learn or even that it is harder to learn as the magical new programmer.
A lot of things are easier to do in C++ because of those extra features.

en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

>Java codebase with a gazillion annotations

Why do Javapoos do this?

Attached: 1356870904949.jpg (704x528, 75K)

can vouch for this, it basically does everything you need

>wake up
gunna write meself a neat and pretty CPU renderer in C++

>What are you working on, Jow Forums?
Nothing. I am crying right now that my robot died yesterday. One of it's servos released le magic smoke. RIP in peace my fren ;_;

I think i should start working on simulating it and maybe redesign it a bit. New servos are on their way anyways from china. This time not even counterfeit ones

Attached: goodfeels.webm (1280x720, 2.39M)

Anyone familiar with AHK?
I don't understand what the illegal character is.
Trying to read the title of the active window and see if it matches a string.

Attached: 234098367.png (341x212, 10K)

No C++ does have excessive complexity. It implements features from almost every type of language in sometimes haphazard ways. So there are often many ways of accomplishing the same thing, and which you want to use will be unclear without experience.
It's also easy for new developers to be mislead by outdated or plain bad information from earlier versions of the language.

Would you rather have poo boilerplate that builds up like pic related? All of this shit can be replaced by annotations and a modular design.

Attached: poo.x.jpg (858x400, 50K)

I enjoyed watching him grow.
F

>Router router = Router.router(vertx);
>not Router router = new Router();
Is this the new ultimate form of POO?

Spring is shit. Supposed to give the illusion of simplicity when all your code is configured through annotations. But you still have to be an expert in the inner working of the framework when you use it for anything but painfully trivial cases. Avoid if you can.

Looking at AHK docs apparently it uses a single = sign for comparision, what if you try:
if (%Title% = "Authentication Required")

I get the same error.

How to sort map by its second element using lambda in c++?

Pretty much. Factory methods and only dealing with interfaces are kind of ubiquitous in java nowadays.

put the pairs into a vector and sort them... using a lambda
[](const auto a, const auto b){ a.second > b.second);

>sort
>a map
what

thanks

lazy bum approach:
std::map fst = /* whatever */;
std::map snd;
for (auto&[k, v] : fst) {
snd[v] = k;
}

even
>Router router = new Router();
should be unacceptable nowadays

Try making a Turing machine that can create and use functions.

I am very much against the
>lets just ask on /dpt/
Aproach, it limits your growth too much.
Why not read and apply your knowledge of the language and come up with your own solution?
Doing it the way you are doing is like a crow feeding on a corpse.

Value-based sorting, not key-based.

I agree that you shouldn't use /dpt/ as a crutch, but it's useful to have input on things that rely more on experience. For example, I got some really good advice the other day on how to implement a thread pool (which wouldn't have occurred to me, since I'm fairly new to multithreading, unless someone explained the benefits).
Each way of learning has its pros and cons.

This works:
^!P::
WinGetActiveTitle, Title
{
if(instr(Title, "Authentication Required")){
Send, Hello world
return
}
return
}

how do I write a web server in forth?

I am not against tips and insights.
But literally posting the code for the user hinders him more than helps in the long run.

Anyone here have any experience with webassembly? I'm trying making a server-based browser game and experimenting with something along the lines of an express server with a worker running the game logic (which is C++ compiled to webassembly), receiving messages about player input from the main thread which communicates with the client, and responding with the updated game state. I'm a little unsure though as to how to get the webassembly to run continously while also being able to send and receive messages. Can I set up an event listener in JS in the worker that can call a messenger function to the wasm, without interrupting the game logic? Should I bother with the worker at all? I'm enjoying all this, but it's my first time dipping into it so if anyone has some experience with this sort of thing it could be a great help.

Interesting way to test my skillz

If the implementation is bad, it should be improved, I agree with that.
>which you want to use will be unclear without experience
Sure. With programming, there will always be several ways to do the same thing. There will also be a right way to do it and that way should hopefully be easier to use than the bad way.
>easy for new developers to be mislead
Maybe. I don't know any specific examples of that, but I don't think this is a big problem.
If a new developer learns that you should do X, so they do that for all their problems, having them improve in the future is easy to do.
I think it is impossible for a new programmer to learn everything they need to know at once, regardless of language.
C++ have some problems, but I don't think complexity is one of them. It is so much easier to learn how things work than it is to keep implementing the same things over and over again.