/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

pastebin.com/9ZGvUhYb
twitter.com/NSFWRedditGif

JUST

who /procrastinating/ here

currently comfy and watching yuyu

Say I have an object with a list (vector) in it, and I want to create a gui that will put it in a list view. From the gui thread, I cannot access the object.
Whats the best way create a functions that can interact with the object and return something to the listview to fill out.

How the fuck do I come up with project ideas? I know C++ for college and I guess some Python. I don't want to do GUI stuff or webshit. All I've written outside of classwork is just scripts to download files off of a site. I love Linux and OpenBSD and mostly just learn about that in my free time, but I don't want to be a sysadmin my whole life. I get straight A's in my classes just want to apply the stuff I learned.

Come on guys, teach me your tricks for coming up with project ideas

look around you. look for what you can automate. automate it.
for example you want to download video on youtube. you can use youtube-dl but the command construction is a bit long. you create a tool to generate the command for you.

Alright I'll try to think of things to automate, thanks.

also there is a book about automating boring stuff in python.

>community 2017

>I know C++
Oh then…
>or webshit
oh. never mind (._. )

>tfw learned a programming language, but have no ideas for projects, so picked up another programming language, but still have no ideas, so picked up another

time to make a programming language then.

>black background
Let me guess, you wear programming socks as well?

Looking for project ideas should be the fun part of programming user...

why would you not want a dark background.
it's easier on the eyes.

yup when you decide on an idea, that's when the procastinating fairy kick in

I'm trying vscode for the first time today and I have to admit it's quite comfy (on Linux). Just need to get VIM emulation working and I'll be set.

Is this really true through? Would using black 75% of the time and white 25% of the time be better for the eyes? Also, I like my Python IDLE white background

is regex a meme, or is it actually useful?

lets make a Sup Forumslang

it useful to check for sequence. it's a meme when you decide to use it to parse html

I don't live in a dimly lit basement with my brightness cranked up to the max

how low-level do you think it should be?
how about memory management?

It still confuses me until this days. Why would anyone want to parse a HTML???

Well I had one idea which was to write a client authenticator for like a secured business network. It would scan processes on a client computer and check them against a blacklist, then they would be let on the network if they weren't doing anything shady. I just think that that's too complicated of a project to do yet, so I'm trying to think of a simpler project to do first. I can think of a few ideas now, I don't know what my mind block was before.
Thanks, I'll pick it up soon. Looks solid.
I use it for find and replace in vim. Also fine for one-off web downloader scripts even though that's not The Right Way(tm). Can't speak for anything else

It's true for me.
I don't understand how anyone would want blinding white.

I can maybe understand if you use f.lux and have screen tint, but just raw white is awful

i have a similar scenario:
suposedly you want to get data from a website.
but that website have no way to directly get data, no api or such.
what can you do?
the only way is brute force the website and parse the resulting html page.

Don't you have to parse any language or am I wrong? Pls no bully if I sound stupid.

I use regex pretty frequently.

What do you do?

Isn't it best way to tokenize string?

but that's the opposite.
you'd have a white background if you lived in a dimly lit basement, because your the white BG helps you see better..since you live in a dimly lite room.

Not a meme; unavoidable/invaluable in the real world.

Could be useful to parse HTML if you want to find the most commonly used word on a website as an example

parse HTML pages for fun

nooo Z A L G O H E C O N S U M E A L L

That scenario seems really manual intensive task. If it is going to involve manual task, isn't it better using another way to find some token like for example grep?

wget + curl + sed + awk

right guise?

it's useful for anything related to string fuckery

I use it a ton when scrapping sites.

How about a really high level language similar to python, but behind the scene, the compiler only translate the source code to C++ code, then call another C++ code to compile it?

So unless you're looking for a really long string, there's no point?

well at the time i was naive.
like i use autoit to parse a website. there is a function that will extract every tag that match a regex from openning tag to closing tag. that's pretty much it.
get the job done without installing and using a lot of tool.
but me now would rather installing tool than look at the code and dont know jackshit what anyline does.

For my job? I write simulations for an aerospace defense company. I use regex pretty much any time I use grep, awk, etc. It's also nice for parsing text arguments to a function/program.

Write the following algorithm:

There are 3 people and 3 rooms

Every day a single person is assigned to room 1
the person who was assigned to room 1 rests the following day

Every day a single person is assigned to room 2 or 3
rooms 2 and 3 alternate every day

The same person cannot be assigned to two rooms in a single day

The same person cannot be assigned to the same room every day

Each person must have a single rest day every third day

Write an algorithm to solve this pattern

but how would we deal with the abomination that is data type?
we dont want to end up like C++ do we?
i suppose "every thing is a struct" maybe the way to go.

what? no, for example

last 10 digits past n
Find "\d*(\d{10})(n)$"
Find ".{10}( c)"

The output of my data was sent to a textfile which was exactly 20 characters long. I needed the last 10 characters because they contained a special code.(example)

Match between 2 characters(parenthesis in this case)
\((.*?)\)

Same deal as before, except said sequence was encapsulated in parenthesis.

Find everything after a specified phrase.
Find "(artist)(.*)$" or "_(artist)(.*)"

Same deal, except the sequence contained a phrase, and I needed everything after that phrase.
"RANDOM_ARTIST324523"
324523 would be captured.

>Write the following algorithm:
nice try user. now go do your homework on your own

by doing "everything is a struct", we can ends up with "python with static datatype"

actually, before someone discuss about the memory management in a language, they should discuss about how the language will be written, as in OO / functional / pure procedural.

pseudo code

struct Person {
int rest;
int work;
int day;
};

int people[3] = {1,2,3};
int rooms[3] = {0,0,0};
int days = 50;

for (i = 1; i < days; i++) {
who = random_choice(people);
rooms[0] = who;
who.rest = true;
who.day = i;
}

// bLA BLA BLA

I have no idea how to do this shit and its due tomorrow. Please help
pastebin.com/9ZGvUhYb

Implement the derivative method at the bottom of the code.

Steps of programming homework:
1. Do it yourself
2. Re-read notes from lecture to help it
3. Search StackOverflow for generalized way to do it
4. Ask StackOverflow and risking your account being flagged.
5. Ask Sup Forums

It seems you are really desperate user

Multiply every coefficient by the corresponding exponent, subtract one from each exponent, pop the last element off the coefficient and exponent lists.

>professor gives you code that is basically the answer to the homework
>also says dont copy it exactly

what did my prof mean by this?

Actually be careful with the popping part. You'll need some extra logic to check if you have a constant term in your polynomial.

julia is like this; type declarations are optional, but if the JIT compiler knows the type due to declaration or deduction it will monomorphize functions to be type-specific

understand that piece of code and rewrite it yourself.
you will never write the same code as your prof's code except you look at it and type it in.

It means the professor giving you a fizzbuzz with their own rule.

but theres only so many ways to fork a process, make an object etc etc

just demonstrate that you understand the code.
how you do it, you must find it on you own.

>C++
stopped reading right there
Better yet, make a high level language that gets translated to assembly, and then use a program to run it. Something like GNU/Linux should work

>GNU/Linux should work
stopped reading right there

Umm, are you sure??

(i steal it from r/ProgrammerHumor)

>doesn't realized that C++ compiled into assembly before compiled to machine code

you dont translate to asm. you compile it.
and if we want to direct our high lvl language to asm. then it will likely not that high lvl anymore.

>(i steal it from r/ProgrammerHumor)
no one cares

>(you)
stopped reading right there

>so good

indeed

i'm doing noob assignments, been learning for two weeks

how do i know my solution is sufficient enough, it might work but it might also be unnecessarily complicated unprofessional poojeet code and i wouldn't know i'm getting into bad habits because nobody is telling me i'm doing stupid shit? like in cs grad memes

It is easier to optimize correct code than to correct optimized code.

left your code for 2 week.
comeback and see if you can still understand it

>condition && f();
Hey, that's actually somewhat elegant.

I'm having the same problem also. Need to come up with a thesis and a software project is mandatory.
Doing a MSc in Comp Sci after falling for a History degree. It has been a slow process for me.

can't run anything in visual studio 2017, the window shows up then it disappear in a sec any solution?

uninstall and reinstall it

that's a standard bash idiom

Ok /dpt/ this is going to sound really stupid bt follow with me

i mad a program to calculate the ratio of how many times i wipe my ass and the times i don't need to

take the numbers 3 for wiping and 1 for no wiping
import java.util.Scanner;
public class Test
{
public static void main (String[] args)
{
java.util.Scanner stdIn = new Scanner (System.in);
int wipers;
int nowipers;
System.out.print("Times wipe my ass: ");
wipers = stdIn.nextInt();
System.out.print("Times i dont wipe my ass: ");
nowipers = stdIn.nextInt();
double autism = nowipers / wipers;
System.out.print("Wipe Ratio:" + autism);
stdIn.close();
}
}

Now as you see the dumb fucking double precision will not do anything below a 1 and will give me a 0 instead of .33, does anyone here know how to fix this?

already did

>visual studio 2017
what for?

seriously

>muh c# 7.0

> double autism
So true

How do I know if I'm a slow programmer? Because I feel like I should be getting a lot more done in a day. Nobody to compare myself to, though.

>Something like GNU/Linux should work
Wtf

learning c++ and i wanna get comfortable with it since what i essentially wanna do "prefers?" visual studio in a way

You're doing integer arithmetic, pajeet.

>slow programmer is the one that writes program
>fast programmer is the one that automate writing a program

So you dont want to create a program with a gui?

>learning c++
nigga you only need a text editor and a terminal

kill yourself

You know, the program to run a piece of assembly

this. just look at the amount of cli utility. you can just pick 1 and write a gui frontend for it. better use qt

>only need
that's your objective viewpoint. not everyone is a masochistic autism.

>not everyone is a masochistic autism.

cute.

i know and i have used but you're missing the point

daily reminder that c++ has no standard abi

>text editor
nigga, you only need to write code directly in the terminal by piping the contents of an echo into a file
Anything more is bloatware

how do i make my own text editor

How do I print a new line after 3 pairs of numbers in java?

nigga, you only need to write hex directly in the terminal by piping the contents of an echo into a file.
Anything more is bloatware.

I use a rope data structure in mine

what for?

you don't even know what you are talking about