/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=SDTZ7iX4vTQ
choicescriptdev.wikia.com/wiki/ChoiceScript_Wiki
store.steampowered.com/app/318330/Mecha_Ace/
boards.Sup
picto-chan.herokuapp.com/`
picto-chan.herokuapp.com/wg/thread/7063822/battlestations-thread
picto-chan.herokuapp.com/gif/thread/11618765/redheads
en.cppreference.com/w/cpp/thread/condition_variable
picto-chan.herokuapp.com/wg/thread/7060547/you-save-you-lose
youtube.com/watch?v=fjbwWivYabU
pastebin.com/yn8hMegy
en.wikipedia.org/wiki/Design_by_contract
youtube.com/watch?v=xZoRetAKLfs
twitter.com/NSFWRedditImage

Are beards the new mustaches?

Someone made an app that tries to edit out makeup
There's a fucking shitstorm of butthurt women

What's the best advice you have to become the best programmer?

learn theory and make some crazy discovery and then live in a space castle

So how does WASM work?
I write my C program as a shared object library and then compile it with emcc and then import it within javascript and then call my C functions directly from there?

The Woman is immunized against all dangers: one may call her a slut, whore, tramp, cunt, it all runs off her like water off a raincoat. But remove her make up and you will be astonished at how she recoils, how injured she is, how she suddenly shrinks back: “I’ve been found out.”

Is a switch for a three-way-fork overkill? Should I just nest ifs?

>What are you working on, Sup Forums?
Rewriting the winapi headers as clean x86/x64, WinXP+, c++ friendly headers

>when your code review leader pulls out a pencil to shit on your code so you pull out your 9

youtube.com/watch?v=SDTZ7iX4vTQ

>write code
>compile to wasm
>browser runs wasm

That's literally it my dude, its just a new compile target

ok how does that work?
I can't find any way to simply compile to .wasm

I'm disgusted by my career and it hasn't been six months. I'm not even programming, just rewriting other people's SQL with minor modifications. And sitting in meetings with power-hungry management cunts and pajeets for over half the day.

I miss college and the love I used to have for programming. At first I was writing a roguelike in my downtime, but now I can't even be assed to do that. I mean, I'm glad I'm not a wage slave, but that's about it. How do those here with IT careers postpone their inevitable suicide?

alcohol

gods work, user

Figure out a specific area of expertise that has meaning for you and get good at it.

How hard would it be to make an executable version of
choicescriptdev.wikia.com/wiki/ChoiceScript_Wiki
I'm not really a fan of the idea of being cucked out of 25% revenue or publishing under their company because of shit like this.

"Do the characters reflect the full diversity of the society in which the game is set?

Are all types of people (especially groups traditionally underrepresented in media) treated respectfully and non-stereotypically?

If there is romance in the game, are there equally satisfying romance options regardless of the player character’s orientation?"

Looks simple enough, shouldn't take long if you know what you're doing.

Sucks for you. My IT job is pretty great.
>be on a 10-person dev team with leaders who are both adept programmers and knowledgeable in the field that we're making software for
>no dead weight as far as I can tell
>a 1-hour meeting per week and the rest are small-person meetings that all seem necessary
>get assigned a project to optimize a complex mathematical system which is extremely relevant to our product release line (mostly just constructing a bunch of data sets then arranging them into a Simplex algorithm, but still)
>when I got nothing to do in the office, work on my personal project, which has come a very long way and is extremely useful and satisfying to me

There are still good IT jobs out there if you're lucky and in the right area.

What is this, a VN specific language?
Is the specification legally open and not encumbered?

I don't know what I'm doing.

Its for interactive fiction, not even VN's.

store.steampowered.com/app/318330/Mecha_Ace/

Is an example of a game. They don't have sound and only have very basic image display. I think you have to either publish with them using their actual authorship or you have to publish as a hosted game. Both situations leave you with a 25% revenue cut. Maybe that's normal, idk, it certainly seems like you're getting mega-cucked though as an author.

>I don't know what I'm doing.
Start learning then. Probably a few days of work tops depending on how much you know.

No, that isn't normal.
They have a 75% cut of your profits.
Not even steam does that, and they take 30%.

I'm going to guess something like this is not open source.
So long as you're not making a compiler for the exact language they described, you can do whatever you want without getting sued.

Remember when software just fucking worked without the bloat/flash/unless shit that you don't need. Anyone remember the classic WEP games made by MS in the early 90's. Fun games, addictive games, games people still remember and play now. Games that also are (by today's standards) primitive as fuck and use only maybe 5MB with all of them. 5MB! Meanwhile games now use maybe 15-20gb and a lot of them are shit. OS's are the same so's at lot of other stuff. I dunno if the code base has gotten way sloppy or what but just cause you can "insert nameless gimmick here" doesn't mean you got to. If something works, leave it be, sure update the source code to allow new h/w support but leave the working bits alone, don't add useless shit that won't make anyone's daily tasks better. I don't need a lot of flashy shit to check my e-mail or surf the "net" or to play games or do actual work on a pc.

Wow, someone actually applying the simplex algorithm. You sound like you lucked out.

I think I'll stay for 2 years at least for the resume, then find something better. I don't want this to be my only established on-paper skillset for life.

>in order to use a wasm module you have to host the .wasm module with a web server and then fetch it with XMLHttpRequest because javascript has no concept of input or output

> in order to use files on the server you have to host them on the server

ok user?

Better Sup Forums porn pretty much. Made this today.

Replace `boards.Sup Forums.org/` with `picto-chan.herokuapp.com/`

picto-chan.herokuapp.com/wg/thread/7063822/battlestations-thread
picto-chan.herokuapp.com/gif/thread/11618765/redheads

is using while(s) as shown in code below a good way to make a thread wait for other thread to reach a point
and change the shared signal?

will the CPU understand that the thread will wait for other thread to send a signal to resume the thread, or it will idiotically
looping until the time-sharing governor change the active task on the CPU?

if the latter, then is there any better way to pause a thread without joining them, and recreate a new thread?

char s;
void stuff()
{
//do something
while (s) //pause here until signal s became 0;
{ }
//do stuff
}

int main()
{
s = 1;
std::thread foo(stuff);
//do other stuff
s = 0;
//continue the program
}

while (s) will literally keep polling over and over until a condition is no longer true, this is basically the worst possible way to handle multithreading
use a sleep function, or a spinlock

Use the actual threading tools like join and en.cppreference.com/w/cpp/thread/condition_variable

Don't try and hack together a custom signalling system yourself, use the language tools that are meant for this. They're probably tying into the OS kernel in clever ways that you'd never even know how to do.

nice!

gonna use it in the future

but i can't see the video progress bar

I am using the "make" command to make an executable will in the ~/urbit-0.4.5 folder. So I can then run it.

However, I get this error. Anyone know what it means?

Also, do I always need to use make for such a thing?

while(s) IS a spinlock ya dingus.

i consider a spinlock to be a while loop with a sleep call between lock acquire attempts

Well, that's incorrect. The whole point of spunlock is to wait for something for a short while without thread going to sleep.

so does beautifulsoup just take the raw html text from a webpage and convert it into a massive string?

i still cant get over how clean the new firefox is

Huh? Isn't that how web pages always start out?

Yes, I'm still working out the UI. I'm not very good at UI.

Perhaps I should bring back the video controls then vertically center the forward and backwards buttons?

Very open to suggestions.

picto-chan.herokuapp.com/wg/thread/7060547/you-save-you-lose

That's a wait lock. A spin lock is done without sleeping if the expected latency is lower than the expected time for the thread to yield and be scheduled again.

im learning python, how bad is it to work as a freelancer, will I be poor

You do realize the original quote you're adapting is horseshit right? I'm a jew and if there's one danger I'm very especially immunized against it's being called a jew. Frankly it doesn't even register as an insult, hence my overt willingness to identify with the label.

>I'm not even programming, just rewriting other people's SQL with minor modifications.
Welcome to the life of the average programmer. If you want to actually be a "developer" in a meaningful sense then you'd better have a damn good idea and damn good people skills because the only way you're getting the job you really want is by heading up a startup.

>Quickly he turns the attacker’s charges back on him and the attacker becomes the liar, the troublemaker, the terrorist.

neat. bookmarking this. Maybe add a button for downloading individual images or bulk downloading a thread.

>freelance python

yes

>uses a mac
>shops at trader joes
>probably vegan judging by his dyel physique
How wrong is this hot headed nigger?

youtube.com/watch?v=fjbwWivYabU

what should I learn, for ez free lance mony


average money im fine with idc

Can someone show me an example of how you handle debug messages in your language?

Do I basically just want to wrap every message in a function that checks if we're writing to stdout, stderr, or nowhere, every time a message is supposed to be printed?". I'm having trouble coming up with a convention.
So far I have thought something like this
MyPrint("formatted message", PrintLevel, vargs);
or having a dedicated function for each level
DbgPrint(""), ErrPrint("")...

Both seem like bad solutions, any advice?

ho w do i search for a pacific string from within a text file in c

#include

I am trying to make a calculator that will tell me how much the monthly payment will be on a loan as the interest increases. It is giving me NaN as the output and I don't know how to fix it. Here is the code.

function computeMonthly() {

var loanAmount = parseFloat(document.getElementById("loanamt").value);
var startInterestRate = parseInt(document.getElementById("startrate").value);
var endInterestRate = parseInt(document.getElementById("endrate").value);
var years = parseInt(document.getElementById("years").value);
msg = "";
var monthlyPayment = 0;

msg += "Loan Amount:$ " + loanAmount + "";
msg += "Number of Years: " + years + "";
msg += "Starting interest rate: " + startInterestRate + "%" + "";
msg += "Ending interest rate: " + endInterestRate + "%" + "";

//Starts table
msg += "";
msg += "";
msg += "Interest Rate";
msg += "Monthly Payment";
msg += "Total Payment";
msg += "";

for (var count = startInterestRate; count

You definitely want to wrap everything in a error handling scope (be it functions or a class) is so you can change on-the-fly where it outputs the error. Maybe when you're developing you want everything to go to the command terminal or even make everything throw un-catched exceptions, but when it's ready for release everything then it throws it to a log file or emails it to an account which developers can see. And you don't know right now how you'll want to handle them in the future

In general I'd say you want three major and separate functions:
Log, Warn, Error

Create sub-priorities inside those if you want, but it's fairly standard to have these three levels clear and separate.

it say that not a file
pls help

isnt the correct usage of math.pow

math.pow(base, exponent)?

I have no idea.

well the answer is yes

The formula is loan amount * monthly interest rate * (1 + monthly interest rate)^number of months / (1+ monthly interest rate)^ number of months -1

Rate my Rust:
pastebin.com/yn8hMegy

>contract
I don't even have to read it, you picked a faggy design pattern.
Reconsider your life choices.

you have to be 18 to browse the board, sonny

Huh? The algorithm is all mine.

It doesn't use any design pattern other than "implement this trait properly and this function will work".

Since this is an unsafe trait, if the contract is broken, it will most likely segfault.

Thanks for the information. It's always been a hurdle for me, sometimes I just remove it all before release and sometimes I'd just leave it. It's been pretty bad so I want to stop doing that.

The basic motivation behind the design is that the pieces should be as easy as possible to formally verify using Coq.

It should be usable in a real time setting, since it uses no recursive calls, and works on data structures that you'd typically allocate in a pool.

You shouldn't make a contract with your compiler, it should shut up and trust that your code does what you think it does.

Stuff like this keeps coming up whenever I read books on "good practices", with grandiose language like "contracts" and "responsibility", they make it seem like programmers are powerful arbiters and keepers of the peace when 99% of them write write garbage or get tasked to maintain garbage.

The functions that take raw pointers should be marked unsafe.

>SAL everywhere

>You shouldn't make a contract with your compiler, it should shut up and trust that your code does what you think it does.
It does. The contracts are documented for the user, that's all.

I'm going to google to demo a website that my team and I have been working on for a few weeks. I'm pretty nervous.

why curry lads

That's another reason you want to handle everything "that's supposed to be there" with explicit debug functions: because if you ever do insert direct prints that shouldn't be there (something I do way too often), a quick search will find them so you can get rid of them before release.

It's shitty use of the terminology, is what he's saying. Contracts are for complex subsystems interacting with each other, explicitly defining what you need to give and receive so that parallel development does not constantly run into version problems. Treating everything you do as a contract between you and the kernel is both pointless jargon that confuses anyone who's not on the same page as you and undermines the very idea of a contract.

>ooh look at me I so smart I make big words everyone look

I need a way to gauge my skills as a programmer especially in comparison to other junior devs.

Can you take a story and complete with little to medium help from senior devs? Do you have a decent enough understanding of your product & codebase to be able to make meaningful changes , some even architecturally, to the repo? In meetings do you actually provide input?
That's about it to be mid-level, maybe even border-line senior at most places.

Dude, in this case the code will literally segfault or free random parts of the heap if you don't implement the functions exactly as described.

What would you call it if not a contract?

if(x > x+1) {
// Is it possible to take this path?
}

incorrect code?
faulty code?
user error?
programmer incompetence?
Certainly not a "breach of contract".

en.wikipedia.org/wiki/Design_by_contract

>if you do the wrong thing bad things happen
woooooow

x was never declared
unknown type
+ operator may not act the way you expect it to for whatever type that is
overflow may be possible

sorry, i'm dumb and that was extremely poor wording by me. I don't have a programming job. I meant to imply I wanted to see how good I am as someone who only pursued programming as a hobby and doesn't have any formal training or education, in comparison to guys who are pretty much fresh hires.

Almost like a contract.

Brainlet here -

What is the formula to calculate the yearly total payment of a loan. For example if at 4% interest you are paying 87.55 a month the total payment is 12607.61.

but a contract implies that you can't back out of your design decisions because you're bound by the terms of the contract now

I would multiply the monthly payment by the number of months in a year.

I don't think so.

>if at 4% interest you are paying 87.55 a month the total payment is 12607.61.
How?

Oh, the initial loan was 10000. Forgot to mention.

Can you give us a better description?

Why does Kosaraju's algorithm work?
I get how it actually computes the components, but I can't wrap my head around why it always works?

Enter loan amount: 10000
Enter starting interest rate: 4
Enter ending interest rate: 9
Enter how many years to borrow: 12

Interest rate 4% = Monthly payment 87.55 = Total payment 12607.61

Interest rate 5% = Monthly Payment 92.49 = Total payment 13318.42/

etc.

I am trying to figure out what formula to use to calculate the total payment.

Sup Forums wont let me post my code, it is giving me a connection error.

rrrreeeeeeee

Your dumb

That's valid, retard.

I mean the actual interest calculation, because I've tried a dozen things and not got 12607.61

The window owns the chain, it's possessive. No?

go back to elementary school retards

Wait no that's wrong, `its` is possessive.

youtube.com/watch?v=xZoRetAKLfs