/dpt/ - Daily Programming Thread

Old Thread: What are you working on Sup Forums?

I dunno user, seems to be a ton of faggotry here

this lol

why is it animeposters don't think they are mentally diseased?

I'm going to make a CLI program that runs on Arch Linux and Windows 10 with the specific purpose of
-calculating production costs and profits for registered ships, ammunition, and modules in EVE Online
-Forecasting profit margins
-Scheduling shipping and production flows to various stations I plan on staging out of
-Scheduling and tracking Planetary Interaction output, and possible profitable applications for the output in production.

I'm going to write it in D.

Why aren't you using the C programming language to develop all your applications?

>writing a script in a compiled static language
Disgusting.

how exactly are you going to accomplish this?
I tried this in GTA V and it was hell, due to not having direct access to the pointers and being unable to simulate the network activity from the game programmatically (had to fake mouse movements in the end)

functional languages are better

I typically do. I sometimes write some simple shit in Bash though.

>When I find out SDl 2.0 is zlib

I'm not hacking the game or anything, I'm literally just tracking data and putting it through formulas. I may refactor it to use API data from EVE central but that sounds hard. Right now I'm just going to manually imput prices by storing them in a text file or something.
This is my first time using D so I figured it would be a good learning experience. Is there a language that would be better? I thought about trying Python, I've only used C#.

eyed3 or mutagen?

>FSF approved
>OSI approved
>GPL compatible
What's wrong with that?

Sounds like it's basically just a calculator.
Why not save yourself a shitload of time and just write it in python or something?

There's an awesome dynamically typed object library for C with only one type you really need, the type is called "PyObject *"

>reccomending the meme snake
Don't do that shit, even in jest. That's just too far.

Yeah I'm thinking thats a better choice. I also should learn Python so its also a learning experience.

like least squares regressions?
the real problem is it only shows you obvious things, really. unless it's fully automated it's not worth inputting shit because it's so obvious the trends

dynamic languages are officially a meme now

Sounds like R would be the language of choice for something like that.

ironic shitposting is still shitposting, user.

python's easy as fuck, this should be the only real "learning" experience you need for it.

Shit's practically english

>ironic
I'm not being ironic. Python is shit.

how does python not even have match patterns

>What's wrong with that?
Nothing, exactly the opposite. I'm currently sweating profusely over being able to do whatever the fuck I want with my SDL projects, including changing the SDL part itself, without having to worry about getting cucked by the FSF, and release the final product under whatever license I want.

I'm not tracking market trends. I want to be able to set up my own very specific scripts for production outputs for shit thats basically only relevant to me. For example I have X minerals in this staging production station.

Using X I want to be able to find out how many of these specific fits I can produce (ship, ammunition, modules, ect) up to a maximum of 10 in each station I'm selling at on a lowsec boarder system, how many NPC meta 4 modules I have to buy and ship, the prospected profits of doing so, and then the left over minerals afterwords.

you mean like regex?

oh I see yeah that's definitely doable

it's like a switch statement on steroids

python has regex tho

Posted in wrong bread :
Rust is complaining that a variable does not live long enough. That variable is declared in main() it wants it to live after the program exits. We skynet now.

not talking about regex

I would suggest looking up exactly how lifetimes work in Rust before trying to do anything complex in the language. It's a bit more on your face about this shit than C++.

i learned c# and wpf while in school over the past 2 or so months by making an anime downloader with some file managing / series tracking features, it essentially just looks for the torrent off nyaa and downloads it into the directories but it's still helpful to me atleast

What is wrong with this code? I will post the errors and the header files below.


// Fig. 11.9: fig11_09.cpp
// Testing class BasePlusCommissionEmployee.
#include
#include
#include "BasePlusCommissionEmployee.h" // class definition
using namespace std;

int main()
{
// instantiate BasePlusCommissionEmployee object
BasePlusCommissionEmployee employee( "Bob", "Lewis", "333-33-3333", 5000, .04, 300 );

// set floating-point output formatting
cout

||=== Build: Debug in Module 8 Quesiton 1 (compiler: GNU GCC Compiler) ===|
obj\Debug\prog30.o||In function `main':|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|11|undefined reference to `BasePlusCommissionEmployee::BasePlusCommissionEmployee(std::string const&, std::string const&, std::string const&, double, double, double)'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|24|undefined reference to `BasePlusCommissionEmployee::getBaseSalary() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|23|undefined reference to `CommissionEmployee::getCommissionRate() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|22|undefined reference to `CommissionEmployee::getGrossSales() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|21|undefined reference to `CommissionEmployee::getSocialSecurityNumber() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|19|undefined reference to `CommissionEmployee::getLastName() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|18|undefined reference to `CommissionEmployee::getFirstName() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|26|undefined reference to `BasePlusCommissionEmployee::setBaseSalary(double)'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|30|undefined reference to `BasePlusCommissionEmployee::print() const'|
C:\Users\user\Documents\CodeBlocksProjects\Module 8 Quesiton 1\prog30.cpp|33|undefined reference to `BasePlusCommissionEmployee::earnings() const'|
||error: ld returned 1 exit status|
||=== Build failed: 11 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

#ifndef BASEPLUS_H
#define BASEPLUS_H

#include // C++ standard string class
#include "CommissionEmployee.h" // CommissionEmployee class declaration

class BasePlusCommissionEmployee : public CommissionEmployee
{
public:
BasePlusCommissionEmployee( const std::string &, const std::string &,
const std::string &, double = 0.0, double = 0.0, double = 0.0 );

void setBaseSalary( double ); // set base salary
double getBaseSalary() const; // return base salary

double earnings() const; // calculate earnings
void print() const; // print BasePlusCommissionEmployee object
private:
double baseSalary; // base salary
}; // end class BasePlusCommissionEmployee

#endif

You wrote it in C++.
>BasePlusCommissionEmployee
>.getSocialSecurityNumber etc.
Jesus christ. You really shouldn't drink the OOP coolaid.

shit like this is the reason programming should be taught as part of the standardized school curriculum.

Everyone can find a use for programming even if its just making a shopping list application or a schoolwork tracker.

#ifndef COMMISSION_H
#define COMMISSION_H

#include // C++ standard string class

class CommissionEmployee
{
public:
CommissionEmployee( const std::string &, const std::string &,
const std::string &, double = 0.0, double = 0.0 );

void setFirstName( const std::string & ); // set first name
std::string getFirstName() const; // return first name

void setLastName( const std::string & ); // set last name
std::string getLastName() const; // return last name

void setSocialSecurityNumber( const std::string & ); // set SSN
std::string getSocialSecurityNumber() const; // return SSN

void setGrossSales( double ); // set gross sales amount
double getGrossSales() const; // return gross sales amount

void setCommissionRate( double ); // set commission rate (percentage)
double getCommissionRate() const; // return commission rate

double earnings() const; // calculate earnings
void print() const; // print CommissionEmployee object
protected:
std::string firstName;
std::string lastName;
std::string socialSecurityNumber;
double grossSales; // gross weekly sales

double commissionRate; // commission percentage
}; // end class CommissionEmployee

#endif

>le OOP is bad meme

Java runs on like 4 billion devices.

I made something similar. Mine is just a console application that checks RSS feeds and downloads torrents based on a simple regex match. I only made it because uTorrent 2.2.1 RSS downloader is broken.

Mine just downloads to a folder and uses the uTorrent "auto load" feature.

Are you seriously saying that , and aren't pure garbage?
>Java runs on like 4 billion devices.
So? Just because something is popular, it doesn't mean that it's good.

Where the hell do you live? Because the semester is over where I live.

I'm doing another semester.

Edit: The semester is over and new one doesn't start until May 26th where I live.

So where do you work user? I assume you are a high up at Google or Apple or something. You probably graduated at MIT at the top of your class right? I should totally listen to what you have to say about OOP even though Google and Oracle have built empires on it.

So?

i essentially started off of something like that with a python script, but i also wanted to manage moving around watched files and or tracking stuff about the series as a reference later on (like if i wanted to add it on MAL or whatever), and sometimes i would have a ton of episodes and wanted to easily make a playlist to separate series so i dont watch the same twice, etc. etc. and found that too cumbersome to do through cleanly through a CLI (though that speaks more to my inexperience)

Java is garbage tier language for babbies.

I only program in ANSI C and sometimes I open a lisp terminal and stare at it for a few seconds before closing it.

Sarcastic comments like this are why I come back to Sup Forums.

>appeal to authority
Fuckwit.
Stop being a stupid cargo cult programmer. Don't add complexity that you don't need. Don't use a shitty methodology that doesn't fit your problem.

>Stop being a stupid cargo cult programmer.

You probably use FP.

Since you didn't counter with, "I have a job at X and I graduated from Y" I am going to assume you are an autistic NEET not worth talking to.

I write procedural code that favours pure functions and minimisation of unnecessary state.

I was being partially sarcastic but where I work right now they literally force us to use C89.

Question: Is using os.system('curl [stuff]') bad practice?

>not being an autistic neet

Fuck off normie.

FP, but you don't want to say FP.

Nice red herring tripnigger.

I'm pretty certain he'd say the same about pure FP given how he responded.

Well this finally gave me an idea. Like an app that makes it easy to download anime while trying to keep older downloads alive by distributing seeders.

What the fuck? Why are you using a 25 year old standard? Is your boss too stupid to add -lstd=c99 to the compilation flag list?

not every target system has a mature compiler~

>So?
My point is that it's an odd time for shitter skiddies like you to be posting your homework on Sup Forums begging for help.

The way I program is a functional style, but is not pure FP.
FP actually has value. pOOP does not.

Essentially, I just called you the fuck out. You OOP-shitter-shitters are literally all the same. Cookie cutter.

Not interesting in the least.

I'm taking an OOP class next semester. It's part of my graduation requirements but it looks like pure garbage.
I looked at some power points and they talked about OOP as the wonderful invention that brought programming out of the stone age.

Essentially, I just called you the fuck out. You OOP-shitters are literally all the same. Cookie cutter.

Not interesting in the least.

I'm not an oop shitter anymore, I'm /RacketRocket/. Still, you were detected.

Try not to be a complete cockend in the future, and it won't be so easy.

Essentially, I just called you the fuck out. You OOP-shitter-shitters-shitters are literally all the same. Cookie cutter.

Not interesting in the least.

Reminder that DRY is the only principle that matters

Oh lord, I've done a thing, now.

i need a skirt wearing trap gf lads..

only good thing that came out of OOP is interfaces, rest is shit

I did an 'OOP paper' in university. Assuming that yours was anything like my one, it will be fucking terrible.
It was going on about """Design Patterns""" and other such atrocities, as well as bullshit like agile and scrum. Basically, it was "How to be a code monkey: the paper".

got u covered senpai
pls be in straya

minsk, belarus

jesus lol
good luck finding a trap gf there

It basically looks like that. They mention waterfall and UML. The only good part is that we'll be implementing Battleship throughout the semester.
The book is also 13 years old, and one project involves making an applet, because applets are relevant in current year.

tfw

>mfw my teacher who is teaching python doesn't really know it herself
>we have been using python 3.x but the quiz is graded using 2.x syntax

NICE

Can anyone give me advice on whether its feasible to land pursue a programming career without a degree?

I'm in college for a medical field and i graduate next year, but i'd much rather be a programmer. I can't stop now its too late. But the past few days ive been doing simple shit in java and its been really enjoyable and I want to learn more.

I'm probably going to pursue it as a hobby at the very least. But can I turn it into a career or does my ass have to get back to school all over again?

>Can anyone give me advice on whether its feasible to land pursue a programming career without a degree?

Sure

Make a bunch of projects that are portfolio-worthy
make a website
apply.

Is the field really that accepting? I'd fucking love to do this shit for a living once I'm more experienced.

What kind of stuff should i focus on first? Sorry if thats a dumbfuck question

Guys is it possible to land a job in software development even if I have a degree in it? I've heard 75% of software companies like Google are now only hiring HS grads without college degrees. If I apply at Google, is it illegal to lie and say I've never earned a degree? Please help.

in companies staffed by young people? Yes, you can get away with no degree if you're competent and have proof (portfolio)
in big and stuffy corporate multinationals with clueless old people? yeah, you need degree, and 5 years experience

are you making fun of me

Well, projects tend to be a better litmus test that you're competent than a degree with no projects. A degree with projects, would perform better than no degree, but perform worse than someone with work experience.

>I've heard 75% of software companies like Google are now only hiring HS grads without college degrees

where the hell did you hear that from?

I know google will hire people with no degrees but damn son those interviews would be hard as fuck for an 18 year old to deal with.

My question wasn't whether or not i could get in WITHOUT a degree, it's whether I could get in WITH a degree. As in, can I get a job even if I DO have a degree.
I'm making fun of the emphasis some companies have on "HEY GAIZ WERE HIRING PEEPS WIT NO DEGREEZ N SHIET SO COME ON DOWN NIGGA!" to the point where it makes you wonder if you'd be better off claiming to have no degree. It's like applying for a job in disguise as a black guy so they hire you on Affirmative Action.
Also the shiiters who say that college is a complete waste of money when you can learn it for free. Learning it tends to be easier in a structured environment with an instructor for most people and even positions where a degree isn't essential it's still a bonus.
I didn't actually hear it anywhere. It was a shitpos- I mean satire.

Can someone tell me why I cant open a file in my program.
I made some changes to a program and now suddenly it fails to open files. But I swear Ive gone back and reverted everything I was aware of and it still wont open the file.
I dont have the original source but I have the exe created and it works as intended so I dont understand what Im doing wrong.

Working on some code challenges for another job.

Got a verbal offer for one not sure if I should take it. A variant of Assembly is their entire production code with a smattering of C/C++ and Java.

Their stack has some old stuff, and the average age of their workers is like 40 and their still doing the shit they got hired to do decades ago.

Not sure if I can parlay that into a new job since I have zero interest in the problems they solve. It's all bullshit travel finance stuff.

Are you on Windows? What language was your program written in?

What the fucking fuck is a malloc memory corruption error and how is it distinct from a segfault? I've never seen one before but have been getting them with a bit of code.

I've only seen segfaults, and can't find info about what a malloc memory corruption error is, other than it having a chance to crash my stack unlike what a segfault does.

If it helps it was happening in a part of an object being linked into a .so file that I'm compiling with -fPID. The bit of code causing it was very distant from malloc, or at least I think it was. No idea. -fPID might have changed that.

Now I'm no expert, so I'm pretty much speculating ehre, but since malloc is a method of memory allocation, it's possible that the object was attempting to allocate memory in a similar low-level way as malloc does, and when it fails for whatever reason, the system throws a malloc memory corruption error because it thought you used malloc in the first place.
more deets, please?

You probably overwrote the heap memory table.
You gotta be extra stupid to pull that off.

>What are you working on Sup Forums?
didn't feel like writing too much code today so I'm writing about computer science education (and Scheme :3)

trying to think of an elegant way to parse arm instructions.
foo(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int):
str lr, [sp, #-4]!
add ip, sp, #8
ldmia ip, {ip, lr}
mla r0, lr, ip, r0
mla r2, r1, r2, r0
ldr r0, [sp, #4]
mla r0, r3, r0, r2
ldr pc, [sp], #4
foo():
stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, fp, lr}
nop
ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, fp, pc}
main:
mov r0, #0
bx lr


should i just consume skip all white spice and consume "tokens" and use a bunch of "find-first-of"s?
There's gotta be someone's project on GIT that does this already

Working on learning C++. I can't even print Hello World. Any tips?

(define you "faggot")

is there a semicolon after your "endl"??

I can't see it because your IDE colors are so shit, and this picture looks pretty potato.

Yes, this is it.

He then tried to perform some operation on the heap and libc detected it/crapped out.

this image is really low quality but it looks like you're missing a ";" there.
And it looks like its not resolving those symbols at all which makes me believe that you're missing the entire standard library in general.