/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous Thread:

Other urls found in this thread:

socialresearchmethods.net/kb/statcorr.php
en.wikibooks.org/wiki/Haskell
haskellbook.com/
youtube.com/watch?v=LR8fQiskYII
twitter.com/SFWRedditImages

First for C is a miracle of this universe.

Lisp is the most powerful programming language.

C is deprecated garbage. Enjoy your buffer overflows.

First for race conditions.

For something to be deprecated, something else has to deprecate it.
Tell me, what deprecates C?

Race condition: if you are an Indian, you can't work here.

Literally any modern middle-level language: Rust, Nim, Go, etc.

Indians can't work on Sup Forums?

Jesus Christ, you can't make this shit up.

C and Lisp are the only languages worth learning.

"deprecated" on Sup Forums has a different meaning. In the real world, it means "obsolete" but on Sup Forums it means "wahh, I don't like it. Stop using it. Wahh."

This is the most Sup Forums post I've seen in a while

Completely out of touch with any reality other than working on fun projects in your mothers basement.

>Reddit-spacer trying to talk down on others
I think you should probably kill yourself, mate.

>fun projects
What is programming without fun?

Software engineering.

>not recognising a Stallman opinion on sight

Stallman did a hell of a lot more than you've ever done.

Wage-slavery.

Making things to other peoples shitty specification

"By contrast, I find C++ quite ugly.

The flaws of C++, as I recall from when I studied the matter around 1990, include syntax and semantics. As for syntax, its grammar is ambiguous, and it is gratuitously incompatible with C, which blocks the smooth upgrade path from C to C++.

As for semantics, the abstract object facility of C++ is designed around the case where the real type of an object is known at compile time. However, in that case, abstract objects are equivalent to a naming convention for functions to call. The case where abstract objects add real power to a language is when the type is not known until run time. C++ does handle that, but it seems to be an afterthought, a poor relation.

I suspect that I would find plenty of ugliness in the template library, but I don't know. That was added to C++ after I studied it." -Ricardo Stallmanu

I'm a goddamn doctor. And not the fake, academic kind.

But more to the point, I never said otherwise; I was just pointing out that he failed to recognise an obvious Stallman reference.

Please, just go back to /r/eddit, and take your attention whore spacing with out.

I guess you're just trying to provoke, then. Have fun, dude.

>out
you*

What is a doctor doing shitposting on Sup Forums when he could be out saving people?

>I'm a doctor

>Anything I disagree with is reddit

So is Sup Forums a safe space now?

We get days off occasionally.

I'm the guy trying to hack user-defined disjoint types into R4RS Scheme.

Hells yeah. But not that one.

>"modern middle-level" = shit

I can't see how buffer overflows can still be an inherent part of the C language with gets() being removed from the standard library. Size-bounded functions must prevent any way of overflowing buffers. A strictly valid C program shall have no undefined behavior, hence no overflow or fatal error of any sort.

But writing strictly valid C programs is not easy. Theoretical verification is not achievable on account of the halting problem undecidability, practical verification can only help to find invalid cases, but not prove validity at 100%.

No. Redditors format their posts in a certain way, that is very easy to identify.
If you format your post in that way, like you have, it means that you're a redditor, and you should fuck off.

strlcpy and strlcat are still not part of the standard though.

>A strictly valid C program shall have no undefined behavior
Any program can be strictly valid C and still not account for user input.

That feel when after 8 weeks of wracking my brain trying to figure out how to extract the critical data from a big report, I finally figure it out. And its so simple, it can be implemented in a function that is only 12 lines long.

Sometimes I think I might literally be retarded. Like quite literally.

8 weeks is quite a long time. Did you ask anyone for help?

Welcome to programming... too busy thinking about complex shit to realize the answer is easy and staring you in the face is the usual.

Kinda-Sorta. I've asked my coworkers/boss for more information about the process and about the data we're working with, but their response is usually either "I don't know" or something along the lines of "Just do your job and leave the scripting to Engineering or IT".

I don't actually work in the Engineering or IT department. I work as the support technician. I'm not really supposed to be working with any of this. I just assist the operators.

But in my off time I've been writing utilities to automate bits and pieces of our job. One of the things I've wanted to do was replace one of their existing wizards, and integrate the replacement with the other automation utilities.

But I couldn't do that, until I could figure out how to extract the critical data from these report files. (and only the critical data; this data will serve as input for my dynamic FDA adjustment calculator)

I quit math grad school and now I'm learning Haskell and programming language theory for fun.
Why does Sup Forums hate Haskell anyway?

If you spent anything more than a weekend doing that, you might be.

What does it do?

Sup Forums doesn't

PLT is great

>he does it for free
You better be asking for a promotion.

/dpt/ loves Haskell, which is why it talks about it so much.

However, it's a good trolling point, so you get haters and false-flaggers fairly often, too.

>quits math grad school
>learning Haskell
It all makes sense now!

Basically we take readings from 3 perfect phones for a bunch of radio frequencies.

Each series of readings is stored in XML form in a report file. (along with a bunch of other useless junk; the report file is structured very weirdly)

We use the measured values compared to the acceptable-threshold to calculate how far off that phone is.

We do this for all 3 phones.

Then we find the statistical correlation between the measurement-values and the FDA db Adjustment Values.

We use the statistical-correlation and the readings to generate an adjusted FDA, and we re-run all 3 phones.

When all 3 phones finally are correlated within 1 db of eachother, we use that FDA as the active FDA file.

I want to automate a lot of the grunt-work we do, but to do so, I needed to understand how to extract the values from the report file that are actually being used as inputs to the FDA Adjustment wizard.

Next, I need to plug them in to the correlation formula. (hope i've got the right one)

Then I can write the fda-adjuster, and integrate it with the other pieces of my automation utilities.

Forgot to mention:
source for pic is this page: socialresearchmethods.net/kb/statcorr.php

>We use the measured values compared to the acceptable-threshold to calculate how far off that phone is

far off from what?

Need help!! I just made a guess the number game. It works great. Then i tried add "do u want to play again" option but program doesn't enter into the while loop again. What did i do wrong? Here is the java code:


import java.util.*;
public class gamey {
public static void main(String args []){

int num1;
int num_guess;
int num2;
int num3 ;
boolean value = true;
String answer;

Scanner scn = new Scanner(System.in);
Random rnd = new Random();

num1 = rnd.nextInt(100);
num2 = num1;

while(value){

System.out.print("Your guess : ");
num_guess = scn.nextInt();

num3 = Math.abs(num2-num_guess);
if(num3 > 50){
System.out.println("Very Cold");
}
else if(num3 > 30 && num3 20 && num3 10 && num3 0 && num3

how far off the phone's measured RF output (in decibels) is from the target value.

The target value is the median of the minimum accepted value and the maximum accepted value.

I think the min and max values are just some static value we get from the government or something. I don't really know where they get their numbers. But the RF transmission power must be within a certain threshold. The phones' deviation is based on their measurement and the median of the threshold.

And we correlate the values of 3 phones to get the ideal Frequency-Dependent-Adjustment (FDA) values that should be used to test all other phones of that model.

This is the science as I understand it. But most of this I've picked up from chatter, no one has formally taught me any of this. I don't really get much opportunity to talk with the engineering guys.

You don't need a separate exit variable. The basic game loop should look something like this pseudo code.

while(true) {
//print shit here
if(answer == trueval) {
// set num values, perform game logic
} else if( yes == falseval) {
//Do your cleanup / exit message shit
break;
} else {
// Invalid input yell at the user
}
}


I hope that is enough to finish your homework.

First of all, write Switch statement for all those if elses

Second, write a Method that will perform your calculation

If you set value to false and then select play again: Y you just call that method

Right now it just sets the value to true and it ends the program, it doesn't iterate again

Best C++ textbook that people actually read? (Not the 1k pages bibles that no one actually reads pls)

thank you i'll try this.
Also this is not my homework i am teaching myself how to program.

>i want to learn to program in 100 pages

Turbo Pascal

imagine i have this folder structure
.DS_Store
├── folder1
│ ├── 1.txt
│ ├── abc.txt
│ ├── cnkjsdf3.txt
│ └── kkfgfg.txt
├── folder2
│ ├── 2
│ ├── 2_1.txt
│ ├── 2_2.txt
│ └── 2_3.txt
└── folder3
├── 12
├── dassdsad.txt
├── asas.txt
└── zaza.txt


if i put in my .gitignore something like
*.DS_Store

it will prevent DS_Sore from appearing in all folders and subfolderes, or only where it is located?

A good thing to be conscious of is the difference between "=" and "==" the former is assigning a value and the later is a comparison operation.

>I'm a goddamn doctor.

That's cool I thought I was the only doctor on Sup Forums

lazy default makes it really hard to reason about for performance
if OCaml had HKT and type classes then people would move there (or if idris gains traction)

Cool. What type?

I'm sure there are a couple of PhDs hanging around, at least.

Post a programming challenge. Not one of the stock roll-for-a-challenge images, but a single problem for everyone to solve in different languages. Bonus points if it isn't FizzBuzz or inverting a tree.

The medical type.

Can you specifiy an empty array with a fixed size?
I want it to be of length n, but I don't want the int array to be filled with zeroes.

Fair enough, I meant speciality.

Write a maze in as few lines as possible

bonus: it's only vertical and horizontal lines

Create a trainable model to judge the level of shitpostiness of any given Sup Forums post.

Invert a FizzBuzz tree.

Oh, well I don't have one yet but I'm a neurology resident.

Given two strings X and Y, write a program that determines if X is a substring of Y. Optimize for speed and space.

For C#, which comes first: learning about events or learning about delegates? Trying to implement some legacy VBA script that makes subjects "dynamic" for mail merge in my C# program.

>Optimize for speed and space.

fuck you

Awesome. I mainly do acute medicine and intensive care (common training pathway in the UK).

>Optimize for speed and space.
The bright folks that wrote the standard library implementations already did this for me.

I'd just call the default contains method.

Shoulda gone into psychiatry.

BUMPERINO

Write a Quine in your language of choice.

Yes.

Find the 2nd smallest integer in an array of N integers. Runtime restraint: N + O(log N) comparisons.

Bumping your post that has literally only been here for less than 15 minutes is maximum faggotry.

I was about to answer you until I saw this post.

Off yourself.

did i trigger your autism?

Devise and implement a data structure that can be used to hold character strings and that allows you to reverse arbitrary sections of the strings efficiently.

Example application: DNA sequences.

That's awesome. Back then in medical school I got to shadow one of my city's most respected doctors; he was the head of my hospital's ICU and they actually named it after him. It was really intense.

I will, once I'm done with neurology. I want both specialties.

What's the challenge there? You just N comparisons.

Yeah, I got to do my elective in ITU in medical school. It was way over my head, but great fun.

>I want to learn something without actually learning it

ez
kek :: [Integer] -> Integer
kek = (!!1) . sort

21656d6167206120676e696b616d206d2749

Is chapel good c++ alternative?
Designed for parallelism
Manual memory management
It looks like way better D.

How do I choose what programming language should I learn? I just want to learn programming.

en.wikibooks.org/wiki/Haskell

haskell honestly
haskellbook.com/

Choose the most popular ones and adjust to your needs (scripting/gamedev/business apps etc)

So it's Java, C#, C++, Python

Choose one and enjoy infinite tutorials and books

his needs is
>I just want to learn programming

is it a silly idea to write a front-end for wget?

i said programming language

yes, then we said Haskell

youtube.com/watch?v=LR8fQiskYII

thanks for the idea

So, have you been able to apply your programming ability to medicine in some way?

I'm looking for opportunities on that front. So far, they helped most when I needed to crunch numbers for papers. I feel I should be doing more. I started researching about electronic health records because the systems I used in the past sucked so bad...

I also like how many parallels exist between concepts in computer science and biology in general. Biochemistry was such a fun subject. I've always liked stuff like life support algorithms. I can't look at them without feeling that I'm some kind of medical machine executing them as a program.