Author Topic: Programming Megathread  (Read 106300 times)

My problem is that my attention span is only a few days so I can never get big projects done. Does anyone have any advice to stay motivated?
make it something that you care about

i just coded a command into my discord bot, which i recoded all by myself in javascript

Code: [Select]
bot.on("message", function(message) {
if(message.content.search("!mcalc") > -1) {
var ans = math.eval(message.content.substring(7, 70));
bot.reply(message, ans);
}
}

it uses the mathjs library and it basically does all your math problems like !mcalc sqrt(2) or a lot more, and I'm so proud of it because it has a ton of uses and it's my first time using a library

I love seeing people using node
because I love node

I edited my Discord bot library to use VLC for media playback instead of ffmpeg so that it doesn't have to download the entire source before playing. Also plays more formats.
It was painful.
Also added an animu op trivia from openings.moe because it seemed like a fun idea.

-snip-
For emplace, you'll probably want to use push_back instead.
If you're adamant on using emplace, you should be able to get it to work by using files.emplace(files.begin() + static_cast<int>(SPRITE_RING1),"bkahajsds");
files.begin() returns an Iterator at the beginning of the files vector, then you add the numeric value of SPRITE_RING1 to it to get to your desired position.

Your last two errors are because you're switching based on a defined data structure instead of a variable. It's like trying to use switch(int).
You need a "sprite_file usedSprite;" variable in your class that actually holds a value. Then you could use switch(usedSprite)

make it something that you care about
It's usually something that I care about at the time but not after a few days.
Maybe it's just a perspective thing? I don't usually find the actual programming to be fun, but I like making things. Any tips for actually enjoying the grunt work?


-snip-
Thanks! Using this, I was able to use the enum without any issues, and everything compiles without errors, but now I have a new problem:

Breakpoint 1, App::OnInit (this=0x6afe28) at source/maininit.cpp:71
71              files.push_back("media/img/ring/ring1.png");
(gdb) print files[static_cast<int>(SPRITE_RING1)] (this is called later on when getting the filename)
$5 = (__gnu_cxx::__alloc_traits<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type &) @0x21e3938: <error reading variable>


It looks like the std::string's constructor won't accept the string for whatever reason.

I love seeing people using node
because I love node
too bad node blows ass and is only popular because of Indians and stuffty webdevs.

Thanks! Using this, I was able to use the enum without any issues, and everything compiles without errors, but now I have a new problem:

Breakpoint 1, App::OnInit (this=0x6afe28) at source/maininit.cpp:71
71              files.push_back("media/img/ring/ring1.png");
(gdb) print files[static_cast<int>(SPRITE_RING1)] (this is called later on when getting the filename)
$5 = (__gnu_cxx::__alloc_traits<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type &) @0x21e3938: <error reading variable>


It looks like the std::string's constructor won't accept the string for whatever reason.
Not sure why you're getting that error.
This test code runs fine.
Code: [Select]
#include <iostream>
#include <string>
#include <vector>

int main()
{
std::vector<std::string> files;
files.push_back("Meow butt");
std::cout << files[0] << std::endl;
return 0;
}

i got put into an online programming class. no idea what language. how much of a nightmare is this going to be

i got put into an online programming class. no idea what language. how much of a nightmare is this going to be
If youre going with web design, go with HTML, CSS, Javascript, and a few others like PHP
If your going for more practical things, theres Python, C (and its variants C++ and C#),  and some others
Theres also what are called "Esoteric Programming Languages". These arent really meant to be taken serious, theyre more of an novelty language for programmer enjoyment. Theres one EPL called "Brainforget" which is supposedly really hard to work with.
If you ever need help, the fourm has alot of computer gurus like ZSNO and Pecon
One more thing, if you get put into a AP Computer Science course, most of them as far as I know use Java
« Last Edit: August 12, 2016, 06:28:57 PM by Becquerel »

It's usually something that I care about at the time but not after a few days.
kinda worrying if the things you care about change weekly, isn't it
i got put into an online programming class. no idea what language. how much of a nightmare is this going to be
it depends on who is running it

it depends on who is running it
state mandated computer science course run through "virtual arkansas" but their webpage is stuffty and offers no course information. this is all i can really find:

A little late on this conversation, but TorqueScript was the first language I ever learned. In fact, it was the first language a lot of people learned. I think it's a particularly easy language to learn. Plus there's a very high level of instant gratification: your first script actually does something fun. I remember being ten and being stoked on writing a /forceKill script. I remember writing little scripts that slowly did more.. from rainbow chat to a command to spawn a bot (back then there was no way to do that without scripting, as events hadn't come about and bot holes definitely weren't a thing) then writing little scripts so that bot would follow you.. etc.

Really, the total prerequisite knowledge to write torque code follows:
- Know how to open console
- Know what a function is
- Know what a variable is
- Know how to define a function
- Know how to define a variable
- Know how to call a function
- Know how to set a variable
- Know the /getID chat command
- Know how to type thatID.dump(); in console.

Once you know those things, you can search the coding help forums to answer nearly any questions you have, or ask a question yourself. Looking at other peoples code will teach you really fast how to do certain things. Before you know it, you'll start to learn things on your own through exploring.

Logic loop and rendering loop in two different threads, calculate frame delta by storing the old system time in a variable and subtracting it from the new system time, perform data point interpolation according to the delta value, listen for messages or keystrokes and manipulate the data.
This is interesting stuff, I'm currently building the framework for a game that I want to make as a personal project.  Do you have any recommendations on material/resources in the way of books on general and Android/mobile game development?

My problem is that my attention span is only a few days so I can never get big projects done. Does anyone have any advice to stay motivated?
Your problem may be caused by a lack of discipline in making progress towards goals, I tend to have the same problem.  The key is to make short, achievable goals.  Think about what you want to get done with it in the next few days or for the week, and make as much progress as you're comfortable with to achieve the realistic goals.  Alternatively if you're an ADHD type like I am you can either completely cut out distractions or just burn yourself out on them so much that you get tired of them.  I wouldn't recommend this though.

state mandated computer science course run through "virtual arkansas" but their webpage is stuffty and offers no course information. this is all i can really find:

Sounds like probably one of the easy starter languages like Ruby or Python, considering it's aimed at students with no CS experience and if it's state mandated it's likely geared to be like a general education CS class, literally "CS for non-CS majors."  I wouldn't expect it to be too difficult if at all because it's probably state mandated to help encourage kids to at least dip a toe in programming and hook any potential future programmers and boost rankings.

Sounds like probably one of the easy starter languages like Ruby or Python, considering it's aimed at students with no CS experience
I'd be worried that they might be teaching HTML instead.