/dpt/ - Daily Programming Thread

>What are you working on, Sup Forums?
>Previous thread

Other urls found in this thread:

cse.wwu.edu/computer-science/meehan
codeshare.io/Y6UKd
people.freebsd.org/~lstewart/articles/cpumemory.pdf
twitter.com/SFWRedditImages

...

What's the best way to make a twitch bot that goes to other channels and comments? I want to avoid using selenium because I don't want them to know its a bot. All of the tutorials I find are how to make a bot for your own channel.

.jar

We're not gonna tell you how to to create a spam bot, pajeet.

tfw just posted my question in ded thread. I hope no one minds a quick reposting.

Whats a good set of tools(meaning languages and actual tools as well) that could be used for making a text based game that can be played from a web browser?

I've never done web-dev, and as far as I know you generally have web based front end and some sort of back end that does stuff. I'm not entirely sure what front end and back end mean.

I'm not making an mmo. Having a web based game just seems more convenient for getting people to try it and for handling text output than dealing with various multiplatform console windows/commands.

Don't want to spam, I just wanted to do it for learning purposes. I am going to make it so anytime someone types !aaron, it says "That's me" thats it.

php, js, html(5), ruby, etc

>You will never construct a computer virus for an alien architecture to tear down their shields for a couple of minutes while your buddies down on Earth blow their space craft into smithereens

obey the quints!

Holy shit, I'd plug my Ethernet cable into my Networking professor's port if you catch my drift

You mean plugging the male part into the female part?

Basically the entire fucking thing should be in JavaScript.

Yes

rolling for quints

obey my order: make app that calls the user's mom at 3 am and plays a sound file saying help me, im lost

You could do it ALL in CGI. This means you can do it in nearly any language. But, after every choice the user makes, they'd be seeing a new webpage, rather than the current webpage updating.

too soon, loser

Quints for D

My old networking professor:
cse.wwu.edu/computer-science/meehan

(Picture is slightly old. He has a bit of a beard now).

i wanna sex you up

Forgot to mention, I am doing this in python

let's go baby!

Let's do it, I'd load my program into your memory

what a faggoty ass quint

ok, it'll be tight though
hope your hard drive can handle my software

Alright, I guess I'll learn Javascript then. I've never actually made a website before so this might be fun.

I'm thinking far more actual RPG than visual novel or text adventure.

Like a rogue-like?

nah, if what you mean is a ascii-grid style movement anyways.

I'm more thinking like an index of menus, one might be objects in the room with each object having a index tag so you can type the index tag to bring up the menu for that object that would list the basic info, and then have its own command sections that would be available to every object such as search, pick up, push, pull etc.

I'm not a fan of text games where you enter "pick up paperclip" I'd rather have everything be seperated into "a" -> "4" -> "1" for the example of navigating 3 menus.

The combat would be JRPG style in regards to the display/input.

Can someone help me understand the list slicing going on here?

def rotate(arr, n):
n = n % len(arr)
return arr[-n:] + arr[:-n]


It takes a list [1,2,3,4,5] and rotates it n times. [5,1,2,3,4] for +1, [2,3,4,5,1] for -1. I understand n = n % len(arr) is there for when n exceeds the length.

I achieved the same thing but it was using for loops and if/else. Much slower.

failing at the proper terms to search google
but what i'm looking for a list of IDEs/ scripting programs which use a dark background (eye issues) and which languages they are used for

I don't hate these kind of people. I just feel bad for them.

Any reasonable terminal emulator can change colors.

nvm, I realize its the last index to the end, so just the last index/indices, and then the beginning up to the last index/indices

Most IDEs and Text Editors have a choice of color schemes.

Yeah, negative indexes in python are counted from the end of the list starting at -1 like [-n,...,-3,-2,-1]

>tfw working on a project with a 2 hour build time
suffering

what are you working on?

Enterprise shit

If it's C++ your company might consider modulating the project into dynamic libraries, so instead of having everything in a single project you'd have separate modules for audio, physics, networking etc, then the engine would load what it needs, this way you only need to rebuild one module at a time.

or even just write a decent makefile

def dogman(arf):
for i in arf:
print(i.doggerino)

codeshare.io/Y6UKd

is this thread different?

>having a 1 million lines code in one file

Lucky you~
I've been contracted to work on a C++ codebase with about 100 smaller ~1k line files and two ~200k line files where almost all the real code is. Why "only" 200k? Because the proprietary compiler shits itself when even one more line is added, AND they don't appear to think it's serious enough to do the smart thing in refactoring it into properly composed smaller files.

>refactoring a 200k line file
I wouldn't do that under gunpoint.

Writing a metadata scraper for FLIF files in Racket. Of course, it's largely theoretical since the metadata scheme isn't locked in yet and nothing actually writes metadata to FLIF files...

most ides will automatically extract a function or class to a new file

Anyone using Open Frameworks?

Oh yeah, I also use Free Components and Public Domain Elements.

How do I make learning programming more fun, Sup Forums?

make things that are fun to make

But games are too advanced for me (for now).

>Free Components

What kind of stuff are you using it for? I have a small project in mind, and am thinking of using it over Unity. Recommended?

So apparently ElementTree in Python chokes on such line:

I think it tries to parse the string as another tag.

She looks like she would be really easy to creep out like i think just walking uo to her and sniffing the small of her back would get her all agitated

learn the basics of a language(hopefully C) and then transition quickly to visual things like windows. I found it to be a lot more fun once I could see my work being displayed outside of the terminal. that's just me though.

No they aren't

tic tac toe is too advanced?

Vim + solararized plugin... have fun! :)

do it with friends

A simple math tutor program

#include
#include
#include
using namespace std;

int main()
{
int rand1, rand2, total, answer, seed;
seed = time(0);
srand(seed);

rand1 = 1 + rand() % 1000;
rand2 = 1 + rand() % 1000;

total = rand1 + rand2;

cout

Cute!

Tay Tay uses Macs you autist.

I posted this function a few days ago.

//Assumes ASCII and C-style string
char* get_extension(char* &str, int &len_ret) {
char* ext_pos = nullptr;
int length = strlen(str);
auto read_pos = length;
while (read_pos > 0) {
--read_pos;
if (str[read_pos] == '.') {
++read_pos;
len_ret = length - read_pos;
ext_pos = &str[read_pos];
break;
}
if (str[read_pos] == '\\' || str[read_pos] == '/')
break;
}
return ext_pos;
}


>&len_ret
What do you tend to do when a function ideally returns multiple things? std::pair is ugly and I'm not sure about the comparative speed of a struct, even for only two elements.

>plugin
>for font colors

>(hopefully C)
Why so? I'm learning Java cause it seems like the easy language

Well I guess I could do those simple games as a start.

My friends are not that interested in programming at all.

Well, structs & pairs are your only choice here, really, you can make it slightly cleaner by doing this:

typedef std::pair ExtRet;

//Assumes ASCII and C-style string
ExtRet get_extension(char* &str) {
char* ext_pos = nullptr;
int length = strlen(str);
int len_ret = 0;
auto read_pos = length;
while (read_pos > 0) {
--read_pos;
if (str[read_pos] == '.') {
++read_pos;
len_ret = length - read_pos;
ext_pos = &str[read_pos];
break;
}
if (str[read_pos] == '\\' || str[read_pos] == '/')
break;
}
return {ext_pos, len_ret};
}

I want to get good at C++. Any resources or projects/exercises that are good for this? Thanks.

>Why so? I'm learning Java cause it seems like the easy language
Java doesn't push you, nor easily afford the means, to understand how the machine actually tends to work.

It also allocates variables on the heap, which is horrible for locality and tends to ensure consistent cache misses. Use interpreted languages for what they're actually good for, don't fall into a mode where you're trying to use them for everything (or think you should).

Really should start with C. And also read:
people.freebsd.org/~lstewart/articles/cpumemory.pdf

but she codes in Java, so deploys on everything

std::tuple and std::tie make it look alright.

>Tay Tay
she has no such thing

I'm doing babbys first hardware.

So I'm trying to control the speed of a motor by writing a number to a file/register/something. Via the command line, its done like this.


~/../..# echo [a number] > [the file]
~/../..# echo [another number] > [the file]
~/../..# echo [some other number] > [the file]


I want to write a program in C that will open this file, write a number to it (based on some sort of generating function or maybe user input), and close the file. I have basic implementation of this in pic related, but I don't know if this is the "proper" way to go about it. Any suggestions?

It's a really good paper. I wonder how out of date some of the benchmarks are. Especially, with the advent of avx, and I'm sure prefetching is more aggressive because of it.

setting up a CHEAP laptop for my nephew to use to learn/practice coding.

starting with scratch, app-inventor2, java
anything else i should pre-install for him?
IDE(s), practice programs, bookmarks to resources, documentation, videos

(uninstalling all games to keep him focused)

>inb4 gentoo

You have fun with what you learn.
If you just read a chapter on something, make a small project where you use that.
Like if you just learned about linked lists.
Then you could make a game that is a visual representation of a linked list (snake).
You can do that with almost anything although some subjects take more time to implement.
This is when you use libraries.

you do realize you're buying him a porn machine right

Hm. I guess I'll probably have to do something like this.

Are there any functional differences between the struct and pair approach?

his parents have some christian porn site blocker router

One is anonymous. Runtime representation will be identical.

arch with vim and linaro armv8 assembler and qemu emulator
that's all he needs

i'm not gonna force him to learn loonix before getting an idea of how to prgram

I spent 3 hours trying to track down a bug and the solution didn't hit me until i tried to work out the faulty code on paper

i was using memmove using strlen as the n bytes and trashing allocated memory

OK is there a way around this issue?
I don't really understand why it is throwing an error

variable=2
def func():
print(variable)#

Should've bought him an arduino kit.

Kids love the physical shit, programming takes motivation and real knowledge to persevere with because it's all abstract, having some physical stuff to go along with it would make it far more likely he'll stick with it.

Depends on how old he is though, when you're a little older you can understand and appreciate the whole thing as opposed to just the end product.

You'll have to now with numbers like that!

Nice blog, where can I subscribe?

Working on my pajeet game on ARM64 assembly
Adding a level where he fights evil westerns trying to force him to sit in loo

>/dpt/
>What are you working on, Sup Forums?

Could you please fuck off and find some other place to shitpost?

age 15, into vidya, marvel/dc
wants to make some games

Care to share your source?

Games is hard, Unity is probably the best option for a complete beginner but even that requires a decent amount of motivation to push through because of the vast workload involved.

If he's mature enough that he can accept it'll take a long while to be competent and even longer to produce anything then he should be aight. But vidya dev is a real serious pain in the ass, especially solo.

boy you probably were the kid sticking pins in sockets in primary

must kindly provide 30% upfront
will do great work Sir...
but seriously, gonna post github when finished

If he's destined to be a coder, he'll get around a silly site blocker.

told him to start simple
like pong or something
one video series shows how to make Breakout game, i think he'll dig that as a beginner project.

Hey guys python fag here. You guys keep shitting on python so I want to learn a better language. Do you guys have a language that you recommend

The second you hit that first "oh shit what if I did this" moment you're away.

I imagine most every programmer had that when first learning, no matter the language or the project.

eventually, yeah. but he's quite sheltered right now. very obedient. wants to do the right thing. literal boy scout.

Routers have default passwords. Don't deprive the kid. God knows they'll never let him get near a real girl.