Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 350 351 [352] 353 354 ... 796

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

Aichuk

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5265 on: December 14, 2013, 06:37:19 am »

Hi guys. I'm 15 and I know some very basic python. However I always somehow end up losing interest and come back after not practicing for a few months. It happens to me with almost everything.
Now my friend and I are planning to learn python programming together. Any suggestions?
Logged

Maklak

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5266 on: December 14, 2013, 06:55:32 am »

> Any suggestions?
Find a non-trivial problem (but not a very big one) that you wish to solve with Python and try to solve it. This is like solving problems from a book, except if it is something you personally wish to see done, you'll be better motivated.
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5267 on: December 14, 2013, 11:02:58 am »

Hi guys. I'm 15 and I know some very basic python. However I always somehow end up losing interest and come back after not practicing for a few months. It happens to me with almost everything.
Now my friend and I are planning to learn python programming together. Any suggestions?
Start really small. I mean really really small. Whatever you just thought of is still not small enough. Think 30 lines of code small. Find a game or something that you believe is possible to write in about 30 lines of code, and give each other such small things to implement. When you're both good enough at this stuff that you can write these programs in less than half a minute per line, step up to 100 lines, and repeat the process. Then 300, then 1000. When you're done with that, you should be really damn familiar with the fundamentals of programming. Now grab yourself a game utility library (e.g. pygame) of your choice and start doing crazy shit with it (again, start with easy things).
Logged

Aptus

  • Bay Watcher
  • Indeed ôo
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5268 on: December 14, 2013, 03:49:50 pm »

After that wall of text earlier I just had to say, I solved all the problems, damn nothing feels as good as when everything clicks after hours upon hours of debugging.

Tomorrow will be spent going over some pen.tests to see how secure I am against sql-injections and other mean things. Now that I got the salt+hash of passwords to work properly as well I kind of want to go crazy with it and do some kind of insane scheme but until I have presented my work on monday I will stick with bcrypt to avoid fucking something up :p
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5269 on: December 14, 2013, 05:07:50 pm »

Hi guys. I'm 15 and I know some very basic python. However I always somehow end up losing interest and come back after not practicing for a few months. It happens to me with almost everything.
Now my friend and I are planning to learn python programming together. Any suggestions?
Start really small. I mean really really small. Whatever you just thought of is still not small enough. Think 30 lines of code small. Find a game or something that you believe is possible to write in about 30 lines of code, and give each other such small things to implement. When you're both good enough at this stuff that you can write these programs in less than half a minute per line, step up to 100 lines, and repeat the process. Then 300, then 1000. When you're done with that, you should be really damn familiar with the fundamentals of programming. Now grab yourself a game utility library (e.g. pygame) of your choice and start doing crazy shit with it (again, start with easy things).

Project Euler is also a good source of problems to solve. Most of the first 100 or so can be solved in ~30-50 lines of Python or less.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5270 on: December 18, 2013, 06:29:07 pm »

A coworker discovered this interesting little fact about PHP today:

Code: [Select]
if ("NULL" == 0) {
    // This is true
}

I understand now why this happens, but I think I'm being generous when I say that it is rather unintuitive that a string containing the word NULL (or null) is equal to the number 0.

Well, more reason to use the === operator, I suppose...
Logged
Through pain, I find wisdom.

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5271 on: December 19, 2013, 06:49:44 pm »

Code: (My code snip) [Select]
char test[] = "Test";
char * hash;
char randSalt[] = "$1$........$";
salt(randSalt);//Function that randomizes the salt into the given buffer
printf("Salt: %s\n", randSalt);
hash = crypt(test, randSalt);
printf("Hash: %s\nResult: %s\n", hash, crypt(test, hash));

Code: (Output) [Select]
Salt: $1$dJvOI5ee$
Hash:
Result: $1$$0VTwPYhPxYrELvcwegUuu0

Code: (Example code) [Select]
     #include <stdio.h>
     #include <string.h>
     #include <unistd.h>
     #include <crypt.h>
     
     int
     main(void)
     {
       /* Hashed form of "GNU libc manual". */
       const char *const pass = "$1$/iSaq7rB$EoUw5jJPPvAPECNaaWzMK/";
     
       char *result;
       int ok;
     
       /* Read in the user's password and encrypt it,
          passing the expected password in as the salt. */
       result = crypt(getpass("Password:"), pass);
     
       /* Test the result. */
       ok = strcmp (result, pass) == 0;
     
       puts(ok ? "Access granted." : "Access denied.");
       return ok ? 0 : 1;
     }

WHAT IS THIS INSANITY?!?!?
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.

Just Some Guy

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5272 on: December 19, 2013, 10:39:48 pm »

Anyone else use jGrasp?

I can open the thing to write and save code, but I can't compile. When I try, I get this:
Code: [Select]
jGRASP wedge2 error: command "javac" not found.
 ----   This command must be in the current working directory or
 ----   on the current system PATH or jGRASP PATH to use this function.
 ----   System + jGRASP PATH is ";C:\Program Files (x86)\Java\jre7\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Java\jre7\bin".

 ----   Use   Settings > PATH/CLASSPATH > Workspace   (PATHS tab)
 ----   to add directories to the jGRASP PATH.

 ----jGRASP: operation complete.

I thought I fixed this Path nonsense when I got it to come up.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5273 on: December 19, 2013, 10:46:51 pm »

Do you have a JDK installed?
Logged

Just Some Guy

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5274 on: December 19, 2013, 11:07:16 pm »

I have no idea.

Since I had to install java on the computer I'm currently using, I'm guessing I don't.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5275 on: December 19, 2013, 11:08:10 pm »

Yeah, make sure to get the JDK as well as the JRE if you're going to be developing.

My little rant:

I used the FLTK library (which I had experience with from a class) to build a nice, small chess program. It wasn't great, but I'm proud of what I accomplished. I wanted to show it off to a friend of mine. So, I figured I would just compile FLTK for Windows, and use that DLL with an MSVC build of my program, since I had developed the program on Linux. FLTK is cross-platform, and my code had no platform-dependent pieces, so it should be easy, right?

Wrong.

After fighting plenty with Visual Studio (both 2010 and 2013 versions), I finally got FLTK compiled. So, I open up the chess project in VS, add the FLTK DLLs as references, and go to compile. Clean compile. I try to run the program, and I get told that I'm missing a MSVC DLL needed to run it. But wait, how can that be? I check my system32 folder, and there it is. I try copying it to the same folder as the executable. Nope, still doesn't work. Ffs, screw Visual Studio.

Ok, my options are Cygwin and MinGW. Cygwin works, but would basically require everyone who wants to run it to install Cygwin, as well as an X11 server. Not a viable option. So I fire up MSYS, and try to compile FLTK.

Oops, I'm missing cmake. Better install it. Oh, it's not in the MinGW Installation Manager's package list. Ok, install from source. Nothing new. Compiled, installed, and... MSYS can't find it. What the actual fuck. Screw with path a bit, try again. Ok, it found it, but it's complaining about missing some DLL. IT'S RIGHT THERE FUCKTARD. Try a native Windows cmake - it won't generate MinGW Makefiles without erroring out because of MinGW's Unix pathnames vs Windows pathnames.

Fuck it, I give up. I'll just develop it with MSVC directly, without FLTK. Which means rebuilding the GUI and the glue between the GUI and my original code.
« Last Edit: December 19, 2013, 11:21:57 pm by Mego »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5276 on: December 20, 2013, 12:33:15 am »

I keep hearing about Vim. Sjould I learn how to use it? >_>
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

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5277 on: December 20, 2013, 02:27:40 am »

I keep hearing about Vim. Sjould I learn how to use it? >_>

Probably. You will probably run into a situation where you can't use a graphical text editor. Vim or emacs is your friend. Learn one of them, just in case.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5278 on: December 20, 2013, 02:34:43 am »

They both seem hard to learn to use. And I'm not sure of the benefits.
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

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5279 on: December 20, 2013, 02:48:26 am »



(Also check out the alt text by hovering over the image, hehe)

But yeah, Emacs was apparently influenced in design by these babies.

Just looking at that is giving me a... well, it's more a sense of awe than anything, hehe.
« Last Edit: December 20, 2013, 02:50:38 am by Putnam »
Logged
Pages: 1 ... 350 351 [352] 353 354 ... 796