/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?
Previous Thread:

Other urls found in this thread:

youtube.com/watch?v=7lnud-xVnqk
twitter.com/SFWRedditImages

...

(in retrospect it'd be better to have a list of types as a parameter)

Making a password generator in asm.

Does anyone actually writes programs like this? Outside of the collage I mean

No. That code smells.

other than the weird newline after the type definition of main i don't see anything wrong with it

all professional work uses a framework or library of some type

you will hardly ever do a File -> New Project professionally

No, that only serves to teach you the basics, i.e. how to not be a retard.

>weird newline
I always do that. It helps me to recognize the function name because it always starts from the 1. column.

youtube.com/watch?v=7lnud-xVnqk

this is how sick you bay area and seattle cucks are

reminder that Sup Forums has LITERAL faggoty google shills among its posters

hey /dpt/
what's the comfiest LISP?

Shen

The one you write yourself.

An AI that can discover footjob scenes in every video on major porn sites, aggregates and cuts the scenes and publishes them on a separate website

#include
#include
#include
std::string wstring_to_string(const std::wstring &wstring) {
if (wstring.empty()) {
return std::string();
}
int size = WideCharToMultiByte(
CP_UTF8,
0,
wstring.c_str(),
wstring.size(),
nullptr,
0,
nullptr,
nullptr
);
if (size < 1) {
// system_error is appropriate because while WideCharToMultiByte and
// MultiByteToWideChar might not seem to be system calls in the truest
// sense they do prefer to report errors the Windows API way through
// GetLastError
// funnily enough they are provided in kernel32.dll
throw std::system_error(GetLastError(), std::system_category());
}
std::string string("\0", size);
if (WideCharToMultiByte(
CP_UTF8,
0,
wstring.c_str(),
wstring.size(),
(LPSTR)string.data(), // not const since C++17
string.size(),
nullptr,
nullptr
) < 1) {
throw std::system_error(GetLastError(), std::system_category());
}
return string;
}

std::wstring string_to_wstring(const std::string &string) {
if (string.empty()) {
return std::wstring();
}
int size = MultiByteToWideChar(
CP_UTF8,
0,
string.c_str(),
string.size(),
nullptr,
0
);
if (size < 1) {
// system_error is appropriate because while WideCharToMultiByte and
// MultiByteToWideChar might not seem to be system calls in the truest
// sense they do prefer to report errors the Windows API way through
// GetLastError
// funnily enough they are provided in kernel32.dll
throw std::system_error(GetLastError(), std::system_category());
}
std::wstring wstring(L"\0", size);
if (MultiByteToWideChar(
CP_UTF8,
0,
string.c_str(),
string.size(),
(LPWSTR)wstring.data(), // not const since C++17
wstring.size()
) < 1) {
throw std::system_error(GetLastError(), std::system_category());
}
return wstring;
}

FUCK sepples
FUCK windows

#include
#include
#define wstring_to_string(wstring) (std::wstring_convert().to_bytes(wstring))
#define string_to_wstring(string) (std::wstring_convert().from_bytes(string))


#include
#define wstring_to_string(wstring) (boost::locale::conv::utf_to_utf(wstring))
#define string_to_wstring(string) (boost::locale::conv::utf_to_utf(wstring))

FUCK boost

>C++

When will Sup Forums grow up?

daily.reminder.this.is.not.the.official.thread()

other than the lack of an anime image it literally is tho

what's official then?

>hating c++
when will reddit learn?

still writing that language

with "second_file"

love(x, y) is
my = "waifu"
x = 0
y = 0
start
put "#{my} is at #{x} , #{y} OwO"
=>love:i32

bjarne did nothing wrong

delete this

What are some good lectures

Jordan Peterson Personality lectures.

Sort yourself out, Bucko.

I fucking hate proprietary software.

I used to be kind of indifferent to it, but for my current job, I need to get data from measurements using software from a research company. I have never wanted to scream at incompetent programmers more.

>Image names can't be more than 17 characters long (what the fuck?)
>To do something as easy as giving data an offset, you have to go through a bunch of fucking hoops
>In certain cases, the data is saved in-software (you need to access the data from within the software. You can't find it on your OS)
>No macros to help me
>User interface is not intuitive at all. You basically need to know the software front and back to do anything
>Current version of the software actually feels like a downgrade from previous versions

Mike Thermofvitch's Goriller Mindthet

...

go write your own free as in freedom version then

What software is it?

I work with medical software. Every program is proprietary win98-tier mess. They were clearly programmed by turning electronic health software standards into feature checklists; they saw "daily backup" and made a .bat file that copies mysql's entire directory to some other place on the same computer. It's the kind of mess that you could improve upon by copy-pasting from stackoverflow. It's that bad.

There's also software that interfaces with the gigantic medical machines like computerized tomography or magnetic resonance imaging machines. Nobody is madman enough to reverse-engineer that shit. Due to the sheer money involved they tend to be better, but they're still borderline unusable windows crap... Radiologists are making too much money to care though. Since they're fuckhuge appliances they could easily fix all these problems by recording all data in volatile internal memory and allow interfacing and transfer via a web browser, or even a HTTP API electronic health record systems could make use of to drive the machine and import imaging data directly into the patient's record.

I have to calculate sin(x) using the taylor series [spoiler] in Prolog [/spoiler]

My brain is full of fuck. I thought it would be easy since I already calculated e^x but I have no idea how to deal with the alternating sum and substraction in the series with recursion. I want to cry.

lmao

A cute anime AI trap girlfriend to give me a footjob while I dress her up on my screen.

whats the term for when its someone trying to make your algorithm perform in its worst case?

Wait are you telling me those giant machines a just giant dumb peripherals?

So a 30k+ monster is being led on a leash by a fucking legacy workstation?

>tfw refactoring my colleague's code
>tfw correcting his terrible spelling in comments
>git commit
>before I delete the comments entirely
>git commit

What does everyone think of Streams and Lambda expressions in Java 8?

>My brain is full of fuck
>I want to cry.
Stop, no really, math people have already done this for us, use the facilities available to you.
C promotes doing everything yourself, this is a bad idea, use libraries that have proven themselves functional, you will quite literally go mad otherwise.

Reminds me of Ruby.

Do it 2 terms at a time so that there is no alternating sum.

can someone answer this? i'm having a brain fart but i know it's not rival or nemesis. it's a specific word used all the time

dude it's right in front of you. can't write a loop?

whadda ya think it is?

javascript?

Not as powerful as LINQ.

>prolog

In C#, are enum's static or can you add additional items to them after declaring them?

I'm new to C# and what little background I have is in Python. I assumed they were the equivalent of lists but is that the case?

> Commenting the stdio header.

#include /* printf and scanf */
// comment to include stdio
//comment to include the comment to include stdio
.....

main(i){for(i=0;i++

...

Nigger they literally give you the formula there.
(defun factorial (n)
(cond ((zerop n) 1)
(t (* n (factorial (- n 1))))))

(defun cosine (x &optional (n 10))
(loop as i from 0 to n
as 2i = (* 2 i)
summing (* (expt -1 i)
(/ (expt x 2i)
(factorial 2i)
1.0))))

out
(mapcar #'cosine '(1 2 3 4 5))
(0.5403023 -0.4161468 -0.9899925 -0.6536434 0.28366297)
[4]> (mapcar #'cos '(1 2 3 4 5))
(0.5403023 -0.41614684 -0.9899925 -0.6536436 0.2836622)

>but I have no idea how to deal with the alternating sum and substraction in the series with recursion.
That's what (-1)^n is for. For even values of n (-1)^n == 1, otherwise it is -1. All you need to do is to increment n for each level of recursion.

I always assumed they were running on updated versions of those wonky programs the original designer made.

Like whatever the giant magnet equivalent of proto SQL was.

Then some modern terminal with a "so ez a 84 year old docotor can do it" gui sent it instructions.

I didnt think it was just sending fat reams of data back to the box for distribution.

adversary is the term i was looking for

>adversary
wtf

never heard of term applied here

Hi,

Still working on my alarm clock. Im almost done adding the TTS portion, but I am stuck.

For user created functions, how do you decide what to import and what to just keep on the main file?

I feel like I could have my main file be 3 lines of code made up of functions inside functions inside functions.

Or it could be 1000 lines with only built in libraries being imported.

What are the PROS AND CONS.

thanks a bunch.

unsigned char sleeve[] = {
0xaa,0xad,0xfd, 0xe9
};
unsigned rotr(unsigned x, unsigned n) {
return (x >> n % 32) | (x

>Still working on my alarm clock
what alarm clock?

One thing i'm thinking about implementing in my language is returning function names as short-hand versions.

function is
//declarations go here
func

func


But, i don't know, maybe that'll make the compiler have to do too much back tracking. Personally, i like having short function names, but I also know it's a pain in the ass for anyone who has to clean up my mess afterwards.

>Radiologists are making too much money to care though. Since they're fuckhuge appliances they could easily fix all these problems by recording all data in volatile internal memory and allow interfacing and transfer via a web browser, or even a HTTP API electronic health record systems could make use of to drive the machine and import imaging data directly into the patient's record.
Brb figuring out how to get into this industry. I have the skillset to write software for these shitboxes.

you'll see it used if you read papers about the stuff

input: abc
output: 476UUUUUOGcÂ


is this supposed to happen

Correcting comments has to be the lowest priority shit ever. Don't bother unless there's nothing more productive to do.

Gonna be honest, I won't touch any version of Java unless I'm forced to. Lambdas can only make the language mildly more tolerable at best.

do you have a particular set of skills?

yeah kinda

Beginner here.

Why does my makefile detecting changes to my main.cpp file even when all I change is a single character, but not when I change a single character in my class files? How do I get around this without having to use a make clean all the time?

>Gonna be honest, I won't touch any version of Java

what do you use, hipster fag? ruby?

hahaha

sometimes i think tripfags make posts they don't actually even want to make, just because they feel obligated to post

think in terms of boxes. Lets say you want to tidy up your room. You would probably put things you want away, like shoes, shirts, magazines, CD's, etc. However, you would also want to be able to find them again, so you'd put those things in the same area (shoes go in a box, shirts go in drawer with socks and pants, etc.) You can do the same with your functions, putting similar things in similar files.

you sound inexperienced with make, so it's probably doing what you're telling it to do in the makefile

is the class file listed as a dependency?

makfiles work like this:

file : depency1 dependancy2
commands

dependancy1 :
commands

dependancy2 :
commands

make looks at the first listed file in the makefile, in this case "file", and checks if it has been changed."file" is considered changed if either dependancy1 or 2 have changes in them as well as if "file" has changes

if only file has changes, only file's commands are ececuted
if dependancy1 has changes, it's commands are ran, then file's.

you can also have things like this

notactuallyafile :
run some commands

(activates only when "make notactuallyafile" is called from the command line

I've seen this a lot in C++ documentation examples but not in any real code

Name me one reason why you would use Java over any of the languages that do its job faster, and cleaner?

>any of the languages that do its job faster, and cleaner

and what languages are they?

Asylum Research, AFM Software.

Can't... Don't own the hardware that the software controlls

Still don't know why no one has invested money into updating decades-old software.
Sure it takes time and money to do so, but so does maintaining it.

It depends on what I'm doing. If I need to quickly process a bunch of data once, you bet your ass I'll write a Ruby script, and I'll get it done faster than had I used Java. If I need to write an application to be used by other people, I'll probably use C++. I'm more productive with it, and I can produce a better, faster application with it.

Since did a good job of explaining why your makefile doesn't rebuild when you change the header, I'll give a few ways to fix this:

1. Use the touch command on every file that includes the header so make will have to rebuild those.
2. Add the header as a dependency in the makefile
3. Just use cmake and let it handle your dependencies.

C++, D, Red

I think I got what my problem was: It's not that it didn't detect changes to them, it's that they didn't check for these files at all. All it checks are .cpp files, so if I modify my .hpp files it won't see any changes and will tell me it's up to date.

So I either split the classes into definition and implementation, no matter how tiny they are, or I make clean every time I make a change to the .hpp files. This is annoying.

>Since (You) did a good job
thanks
feels good man

man makedepend, user.

a guy was bitching about an operating systems class where everyone failed an assignment to make a makefile for some program, and he was mad that the professor didn't grade. i thought he was joking. it's such a simple concept. read

>make looks at the first listed file in the makefile, in this case "file", and checks if it has been changed."file" is considered changed if either dependancy1 or 2 have changes in them as well as if "file" has changes
>2. Add the header as a dependency in the makefile
>man makedepend, user.

I'll look into these, thanks. It's my first time making a makefile at all, and it seems I'm having a bumpy start.

n_factorial(0,1).
n_factorial(X,R) :-
X > 0,
X1 is X - 1,
n_factorial(X1,R1),
R is X * R1.

n_cos(_,0,1).
n_cos(X,N,R) :-
N > 0,
N1 is N - 1,
n_cos(X,N1,R1),
N2 is N * 2,
n_factorial(N2,F),
R is R1 + (-1 ** N) * ((X ** N2) / F).

If you're not committed to creating only copyleft software then you should leave this thread.

no it's just for teaching

this is an anime general, not a communist general

kys commie scum

ANIME COMMUNISM

COMMUNIST ANIME

mapToObj
Fuckin chug a tall, frothy gallon of bleach Larry. Not even Google can prop up this shitshow.

what the problem, bucko

stop talking like that faggot

I release all my work into the public domain where possible, BSD license otherwise. GPL licenses are faggotry and infringe on the freedom of software developers.

like what, hector?

clean your damn room

I am writing an alarm clock program as my debut into python.

So far it
>fetches Daily news from Democracy now youtube channel as the alarm
>plays music on weekends isntead
>reads tts of date and time

I still need to create a GUI for it and connect it to my work schedule so it can tell me what time My shift starts.

I was using my name before to prevent confusion, but I was being flooded with questions about my opinion on diversity in tech and requests for feet pictures.

this

>I release all my work

what work?

lel

>maybe I'll get a reacharound after some company packages my code into a proprietary product and sells it