Pages:
Author

Topic: The Coding Thread (Read 2753 times)

hero member
Activity: 686
Merit: 504
always the student, never the master.
December 08, 2013, 04:58:10 AM
#53
Fuck no lol Cheesy but if we keep bumping this thread maybe someone else will take a look, I'm learning C++ and SFML currently.

SFML? SAD FUCK MY LIFE LANGUAGE ? lol
legendary
Activity: 1540
Merit: 1000
November 27, 2013, 05:37:58 AM
#52
Fuck no lol Cheesy but if we keep bumping this thread maybe someone else will take a look, I'm learning C++ and SFML currently.
hero member
Activity: 686
Merit: 504
always the student, never the master.
November 27, 2013, 05:31:35 AM
#51
I'm bumping the coding thread Tongue I want to post up some more code here soon Cheesy

can you debug an sql query? i can't get my form to work for some odd strange reason.

Code:
Ban A user

echo $account?>" />




if (isset($_POST["to_ban"]))
{
$banby mysql_real_escape_string(strip_tags($_POST["banby"]));
$to_ban mysql_real_escape_string(strip_tags($_POST["to_ban"]));
$sqly mysql_query("UPDATE userCake_Users SET `Banned`='1' WHERE `Username`='$to_ban'");
$sqlz mysql_query("UPDATE userCake_Users SET `BannedBy`='$banby' WHERE `Username`='$to_ban'");
}


legendary
Activity: 1540
Merit: 1000
November 27, 2013, 03:53:40 AM
#50
I'm bumping the coding thread Tongue I want to post up some more code here soon Cheesy
legendary
Activity: 1540
Merit: 1000
June 12, 2013, 10:28:57 AM
#49
lolz well I'll be selling my games for Bitcoin but I don't really approve of arcades, it's basically like purchasing a game with a hard coded time limit and that sucks Sad

Quote


    while (window.isOpen())
    {

    sf::Event event;
    while (window.pollEvent(event))

if ( event.type == sf::Event::MouseMoved );

{
    spritebutton.delete ( MouseMoved.x, MouseMoved.y );
}


{
 if (event.type == sf::Event::Closed)
 window.close();
}


I WILL CODE A WORKING BUTTON OR DIE TRYING!
hero member
Activity: 686
Merit: 504
always the student, never the master.
June 12, 2013, 09:25:15 AM
#48
You guys who are into game programming may like this, did some digging around and found this website http://code.google.com/p/gqe/, a lot of the sites are completely outdated but it looks this one at least has some 2.0 code, I downloaded pong to get me going! Smiley

someone should make a bit arcade. instead of depositing 50 cents per play, you deposit .005 bitcoins or something
legendary
Activity: 1540
Merit: 1000
June 11, 2013, 08:07:20 AM
#47
You guys who are into game programming may like this, did some digging around and found this website http://code.google.com/p/gqe/, a lot of the sites are completely outdated but it looks this one at least has some 2.0 code, I downloaded pong to get me going! Smiley
legendary
Activity: 1078
Merit: 1003
June 04, 2013, 12:24:22 AM
#46
uAWR s0 l33t

People, please, hold your applause.

Code:
def myNewFunction(x):
    if x > 1:
        return x + 1
    else:
        return 0

print myNewFunction(int(raw_input()))

It took me three weeks to figure out how many parenthesis should go on the end of the last statement, but due to my unwavering perseverance, I've made a program that...probably cures computer cancer or something.  But anyway, I think I'm ready to make the next World of Warcraft clone.
hero member
Activity: 686
Merit: 504
always the student, never the master.
June 03, 2013, 06:50:43 AM
#45
Quote


#include
#include
#include

int main()
{

    sf::RenderWindow window(sf::VideoMode(800, 600), "test");

sf::CircleShape shape ( 50 );
shape.setFillColor( sf::Color::White );

    while (window.isOpen())
    {

    sf::Event event;
    while (window.pollEvent(event))

        {
           if (sf::Mouse::isButtonPressed ( sf::Mouse::Left ) )

           shape.setPosition ( sf::Mouse::getPosition( window ).x , sf::Mouse::getPosition( window ).y  );

        }



{
 if (event.type == sf::Event::Closed)
 window.close();
}

        window.clear();
        window.draw ( shape );
        window.display();

    }

    return 0;


I managed to partially fix my code yet again to make it almost functional, turns out, keeping mouse events outside of the brackets where you're having your objects interact with the mouse/keyboard royally fucks things up if you're not careful, now I just need to figure out why my shape is terrified of my mouse cursor and get this code working with the move command.

Oh and never forget, x and y always, never y and x Cheesy

Hell yeah bro! i fixed my php script to. turned out i did need to fclose the file like jackjack said. for some strange reason notepad++ doesn't highlight the syntax of fclose so i thought i was doing something wrong. showing zero errors on E_ALL i can sleep soundly now.
legendary
Activity: 1540
Merit: 1000
June 03, 2013, 06:37:19 AM
#44
Quote


#include
#include
#include

int main()
{

    sf::RenderWindow window(sf::VideoMode(800, 600), "test");

sf::CircleShape shape ( 50 );
shape.setFillColor( sf::Color::White );

    while (window.isOpen())
    {

    sf::Event event;
    while (window.pollEvent(event))

        {
           if (sf::Mouse::isButtonPressed ( sf::Mouse::Left ) )

           shape.setPosition ( sf::Mouse::getPosition( window ).x , sf::Mouse::getPosition( window ).y  );

        }



{
 if (event.type == sf::Event::Closed)
 window.close();
}

        window.clear();
        window.draw ( shape );
        window.display();

    }

    return 0;


I managed to partially fix my code yet again to make it almost functional, turns out, keeping mouse events outside of the brackets where you're having your objects interact with the mouse/keyboard royally fucks things up if you're not careful, now I just need to figure out why my shape is terrified of my mouse cursor and get this code working with the move command.

Oh and never forget, x and y always, never y and x Cheesy
hero member
Activity: 686
Merit: 504
always the student, never the master.
June 03, 2013, 05:19:21 AM
#43
Pussy! Tongue

Okay okay.  I'll keep trying.

Code:
def conjunctionJunction():
    print "What's your function?"

conjunctionJunction()

uAWR s0 l33t
legendary
Activity: 1078
Merit: 1003
June 03, 2013, 05:02:12 AM
#42
Pussy! Tongue

Okay okay.  I'll keep trying.

Code:
def conjunctionJunction():
    print "What's your function?"

conjunctionJunction()
legendary
Activity: 1540
Merit: 1000
June 03, 2013, 04:56:35 AM
#41
Code:
print "Hello, world!"

Phew, I need to take a break.

Pussy! Tongue
hero member
Activity: 686
Merit: 504
always the student, never the master.
June 03, 2013, 04:55:47 AM
#40
  • email+url: look at regex
regex? what is that exactly? i'm afraid i don't know much about it. i'm self taught so my knowledge is *extremely limited*

  • you don't fclose

the script works fine without it.. is it really necessary?

  • I don't see any echo so how can you display error or accept?

i call the echo down below in the form:

Code:

'.$error.'
'; ?>  
'.$accept.'
'; ?>



Regex are something specifically designed to validate patterns. Warning: that's pretty annoying.
Sure it works without fclose but you're using RAM for nothing and you're locking the file for every other process until the PHP script ends. Oh, and PHP gurus will kill you.
Looks ok, so I'd put many echo's in your big 'if' to see what happens: check all your variables at many times.
ahh, so thats why i couldn't get the form to save when i was accessing the file from the "admin console i built" to edit/read it. i know that flat databases are out of style but i find it useful for my manual review process. i don't wanna give people access to the database directly. trying to prevent spam sites and links.
so what would the fclose command be for this particular setup? i tried it several diffent was and keep getting the error message: php expects parameter 1 to be resource, boolean given in "...../submit.php" on line ...
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
June 03, 2013, 04:39:56 AM
#39
  • email+url: look at regex
regex? what is that exactly? i'm afraid i don't know much about it. i'm self taught so my knowledge is *extremely limited*

  • you don't fclose

the script works fine without it.. is it really necessary?

  • I don't see any echo so how can you display error or accept?

i call the echo down below in the form:

Code:

'.$error.'
'; ?> 
'.$accept.'
'; ?>



Regex are something specifically designed to validate patterns. Warning: that's pretty annoying.
Sure it works without fclose but you're using RAM for nothing and you're locking the file for every other process until the PHP script ends. Oh, and PHP gurus will kill you.
Looks ok, so I'd put many echo's in your big 'if' to see what happens: check all your variables at many times.
hero member
Activity: 686
Merit: 504
always the student, never the master.
June 03, 2013, 04:30:23 AM
#38
  • email+url: look at regex
regex? what is that exactly? i'm afraid i don't know much about it. i'm self taught so my knowledge is *extremely limited*

  • you don't fclose

the script works fine without it.. is it really necessary?

  • I don't see any echo so how can you display error or accept?

i call the echo down below in the form:

Code:

'.$error.'
'; ?>  
'.$accept.'
'; ?>


legendary
Activity: 1078
Merit: 1003
June 03, 2013, 04:29:50 AM
#37
Code:
print "Hello, world!"

Phew, I need to take a break.
legendary
Activity: 1540
Merit: 1000
June 03, 2013, 04:27:04 AM
#36
yey! more people posting their code other than me! Cheesy
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
June 03, 2013, 04:22:36 AM
#35
  • email+url: look at regex
  • you don't fclose
  • I don't see any echo so how can you display error or accept?
hero member
Activity: 686
Merit: 504
always the student, never the master.
June 03, 2013, 04:16:42 AM
#34
any php'ers in the house? i'm making a mess of this form

this form does everything i basically need it to do, but i'm having problems adding anymore logic to it. i need for it to check the
Code:
$email
and
Code:
$url
for common elements of emails and urls for example "@" and "http://" .also wierdly it displays the
Code:
$accept
div when i load the page, when it should display either the
Code:
$error
or nothing. i wrote this tonight but i've been having the rewrititis for the last couple of hours. decided it might be wise for me to ask an experience php programmer(s) for advice.


Code:
session_start();  

$name = $_POST['name'];
$email = $_POST['email'];
$url = $_POST['url'];
$title = $_POST['title'];
$message = $_POST['message'];
$code- $_POST['code'];

$data = "$name | $email
         $url | $title  
-
$message


";
  
 

if(strtolower($_POST['code']) == $_SESSION['rand_code']) {
          
        $accept = "Your Entry is being processed";

        $fh = fopen("redacted.txt", "a");
        //write and close
        fwrite($fh, $data);  

          
        } else {  
          
        $error = "All Fields Are Required.";  
  
      
    
      
    }  

The original version was more complex with multiple error messages. the one shown and one for the captcha. couldn't get it to work though.
Pages:
Jump to: