Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 405 406 [407] 408 409 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 908450 times)

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6090 on: July 15, 2014, 10:11:01 am »

Isn't Windows the most common? I just want to be able to get a job. :c

EDIT: But I need to pick one from each of those clusters as a requirement for my degree.

EDIT2: Bolded the choices according to Arx. What about the rest? I simply don't know what to think.. I just want to do whatever I have to to be able to get a job programming, with the possibility to maybe have a chance to possibly move on to vidja games once I actually learn what I'm doing! ;-;

Spoiler (click to show/hide)
Windows is a common user OS, but most servers run some flavor of Linux (Debian, Red Hat, etc).
I'd recommend learning how to use Linux, it's quite useful (and quite different from using Windows since you can (and often have to) do things using a command prompt.).

E:
Darklord: Wouldn't a string in C also have char[11] = NULL, though? :P
« Last Edit: July 15, 2014, 10:12:55 am by miauw62 »
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Puzzlemaker

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6091 on: July 15, 2014, 10:24:44 am »

Man I never have enough energy to do my projects at home after work.  It's so sad.   :'(
Logged
The mark of the immature man is that he wants to die nobly for a cause, while the mark of the mature man is that he wants to live humbly for one.

darklord92

  • Bay Watcher
  • [CREATURE:SERGALNORTH]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6092 on: July 15, 2014, 11:26:06 am »

Windows is a common user OS, but most servers run some flavor of Linux (Debian, Red Hat, etc).
I'd recommend learning how to use Linux, it's quite useful (and quite different from using Windows since you can (and often have to) do things using a command prompt.).

E:
Darklord: Wouldn't a string in C also have char[11] = NULL, though? :P

Durp, terminator added to example.
Logged
Form walking potato man out of corpse. Absorb anyone else in the house.
We have a successful derail.
The Vilous Mod - Jingle berries!

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6093 on: July 16, 2014, 06:24:12 am »

Python: what the heck is '%' used for in math equations? I think it had something to do with remainders?

EDIT: Also fuck I fucked up the Booleans. What a silly name I hope I never have to say that word out loud.
« Last Edit: July 16, 2014, 06:31:06 am by GUNINANRUNIN »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6094 on: July 16, 2014, 06:32:48 am »

n % d means you divide n by d and return the remainder.

8 % 2 == 0
9 % 7 == 2
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6095 on: July 16, 2014, 06:34:24 am »

Okay, awesome, then I remembered correctly! I guess the mistake is somewhere else then.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #6096 on: July 16, 2014, 08:53:13 am »

One of the things I like about teaching with C++ is if you start with Java, you may get some idea of how to program with objects and classes but good luck understanding why. With C++, you can start procedural and actually feel the pain that OOP is trying to solve, and actually understand why people use classes. And then with OOP you feel the pain state or deep inheritance trees create, and start trying to limit your state and focusing on composition over inheritance and suddenly the reasoning behind why a lot of programmers are being more drawn to functional programming or at least more functional code makes sense. It's a lot easier to understand why when you've seen what happens with the not.

So I set up a blog using Ghost, immediately like it over Wordpress. It's a very pretty scalpel, whilst wordpress is a sledgehammer that tries to do everything. Though Ghost does require more of a willingness to get your hands dirty with some HTML if you want to do things like add menus. On the bright side, I've actually written some blog posts for the first time in months upon months. Yay for changes of scenery :)
« Last Edit: July 16, 2014, 09:13:50 am by MorleyDev »
Logged

darklord92

  • Bay Watcher
  • [CREATURE:SERGALNORTH]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6097 on: July 16, 2014, 12:23:13 pm »

Does anyone still use UNIX?

https://www.youtube.com/watch?v=uL65zWrofvk

Should say a lot, UNIX is still used but it's called things like AS400, or Z/OS .
Logged
Form walking potato man out of corpse. Absorb anyone else in the house.
We have a successful derail.
The Vilous Mod - Jingle berries!

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6098 on: July 16, 2014, 01:29:08 pm »

or more properly the hexadecimal value for h

No, nothing's actually stored in "hexadecimal" format in memory, it's only a method of displaying the data that's no more correct than decimal.

Everything is binary bits, how you display it is arbitrary and knowing the decimal values for ASCII characters is way more practical in real c++ programming. Easy to remeber SPACE is ASCII code 32 in regular base-10, rather than 0x20 in hex. I've never needed to know that in decades. And if you store the values in a file it's way easier to just read in decimal that screw around with hexidecimal crap.

Hex is just convenient to know about but you almost never need it except for stuff like defining color strings. That's because there's no actual thing as a value "stored" in Hex in C++.
« Last Edit: July 16, 2014, 01:32:08 pm by Reelya »
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #6099 on: July 16, 2014, 02:32:41 pm »

Base 16 (hex) is mostly useful when writing values where the underlying binary representation is the important information you want to know, not the number itself. F in base 16 directly matches the value of 1111 in base 2, so it's a lot easier to recognise the underlying binary value (FF would be 11111111, or 255, aka. the largest value stored in your typical 8-bit byte).

So if you're parsing binary data, it's a lot easier to comprehend the underlying value of F0FF than 61695 and still has less cognitive overhead to write and read than 1111000011111111. It's the same number being represented each time, but with F0FF you can quickly learn to split it into the two bytes in your head (F0 and FF).

Such data manipulation isn't an uncommon task in a lot of jobs at some point, be it in talking between devices over hardware, reading or writing files in predefined formats, accepting or sending network messages in predefined formats or whatever. Colours are a common use case, since each byte in a 32-bit colour number maps directly to to strength of that colour (or the alpha channel).

Heck, my work placement job involved adding handlers for the SMPP protocol from a variety of mobile networks (who all implement the protocol in subtly different and equally annoying ways), so parsing or constructing the request PDUs, and then constructing or parsing the responses. Fun fun fun.
« Last Edit: July 16, 2014, 02:48:17 pm by MorleyDev »
Logged

Kirbypowered

  • Bay Watcher
  • Proficient Dabbler
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6100 on: July 16, 2014, 03:26:28 pm »

Well, that was a long break. My programming studies were put on hold during an eight day power outage. The break from everything was nice, but a little disorienting...

On the numerical base topic, a lot of them might not be all that important to know, but I've always found them fun to study. It can be pretty insightful to learn about, in terms of our own base-10 system and the nature of numbers in general. How about decimals and fractions in other bases? Fun!
Logged
THE WINTER MEN COME DOWN THE VALLEY AND KILL KILL KILL.
I'm voting for the Plaid Acre up next on COLORS AND MEASUREMENTS weekly.

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6101 on: July 16, 2014, 04:16:42 pm »

Well, that was a long break. My programming studies were put on hold during an eight day power outage. The break from everything was nice, but a little disorienting...

On the numerical base topic, a lot of them might not be all that important to know, but I've always found them fun to study. It can be pretty insightful to learn about, in terms of our own base-10 system and the nature of numbers in general. How about decimals and fractions in other bases? Fun!

Ugh binary fractions are a pain.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6102 on: July 16, 2014, 07:03:11 pm »

Speaking of hex, I work with web apps that vaguely interface with applicant tracking systems owned by various companies. A ticket came in today.

Quote
Stuff is broken!
What I should see: ?src=FOO,BAR
What I actually see: ?src=FOO%2CBAR

It's breaking everything!

Sadly, it's not an exaggeration. If you had any idea how crappily applicant tracking systems are universally programmed, you would never want to touch one again. If only "not my problem, fix your shit" was an acceptable resolution.
Logged

Kirbypowered

  • Bay Watcher
  • Proficient Dabbler
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6103 on: July 17, 2014, 09:11:20 pm »

I was having some weird trouble compiling a program using libtcod via console earlier (from a libtcod C++ roguelike tutorial) and I still can't get that code to work, however, after poking through some other tutorials and the like, I've been able to get another simple program to run both via console and codeblocks. I'm trying to figure out what my problem is with the original code.

This is what it looks like:
Code: [Select]
#include "libtcod.hpp"
int main() {
    TCODConsole::initRoot(80,50,"libtcod C++ tutorial",false);
    while ( !TCODConsole::isWindowClosed() ) {
        TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS,NULL,NULL);
        TCODConsole::root->clear();
        TCODConsole::root->putChar(40,25,'@');
        TCODConsole::flush();
    }
    return 0;
}

As per the tutorial, I'm compiling it with this input:
g++ src/*.cpp -o tuto -Iinclude -Llib -ltcod-mingw -static-libgcc -static-libstdc++ -Wall        [Someone mind explaining what these commands actually do?]

I've set up the folders include and lib within the program's directory, containing the things they should contain. The code itself is stored as main.cpp within the src folder. Following some advice from the tutorial, I ran the code with a command line debugger (gdp, I think), which gives this output:
Code: [Select]
(gdb) r
Starting program: C:\Users\Soulusk\gameplace\tuto.exe
[New Thread 8900.0x14c8]
[New Thread 8900.0x888]
24 bits font.
key color : 0 0 0
character for ascii code 255 is colored
Using SDL renderer...

Program received signal SIGSEGV, Segmentation fault.
0x65e70d9f in TCODConsole::clear (this=0x1) at src/console.cpp:196
196     src/console.cpp: No such file or directory.

It seems, to my untrained eyes, that it can't find the file console.cpp, which is in libtcod's src folder (I checked). Anyone here actually know what my problem is and perhaps how I might go about solving it?
Logged
THE WINTER MEN COME DOWN THE VALLEY AND KILL KILL KILL.
I'm voting for the Plaid Acre up next on COLORS AND MEASUREMENTS weekly.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6104 on: July 20, 2014, 03:48:03 pm »

PTW
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule
Pages: 1 ... 405 406 [407] 408 409 ... 796