Flanelman

Member
  • Content count

    382
  • Joined

  • Last visited

Reputation

  • check
    Agree 3
  • info_outline
    Informative 2
  • tag_faces
    Funny 0
  • thumb_up
    Thumbs Up 5
  • thumb_up
    Likes (Old) 31

Awards


This user doesn't have any awards

About Flanelman

  • Title
    Member

System

  • CPU
    i7 4720HQ
  • RAM
    16gb
  • GPU
    GTX 970M
  • Storage
    1tb 7200rpm
  • Display(s)
    1920x1080 matte 15'6
  • Keyboard
    Corsair K50
  • Mouse
    Corsair M95
  • Operating System
    WIN 7 X64

Profile Information

  • Gender
    Male

Contact Methods

  • Steam
    Flanelman

Recent Profile Visitors

554 profile views
  1. Tomb Raider, and Rise of the Tomb Raider.. Imo both brilliant games and really controller friendly.
  2. Hey guys so like the title says I've tried to put the text within the EditText into a var called "username" which I want to be able to use within my inner class but I don't know how to make it accessible from within. here's what I do with the EditText: (KeyListener is the name of my inner class) KeyListener KL_Instance = new KeyListener(); EditText input_text = (EditText) findViewById(R.id.inputText); input_text.setOnKeyListener(KL_Instance); String username = input_text.getText().toString(); and here's what I'm trying to do with that within the inner class: public class KeyListener implements View.OnKeyListener { @Override public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { //if the enter key is pressed, then check to see if username is 8 or more chars if (keyCode == keyEvent.KEYCODE_ENTER) { //if it is, display it if(username.length => 8) { Toast.makeText(MainActivity.this, "Hi, " + username, Toast.LENGTH_LONG).show(); }else //else, ask for a username of atleast 8 chars { Toast.makeText(MainActivity.this, "Please enter a username that is 8 or more chars", Toast.LENGTH_LONG).show(); } } return false; } } But it says "cannot resolve symbol 'username'" and I cant access "input_text" within that class either so If someone could help me out here it would be greatly appreciated Thanks in advance
  3. Nah not professionally, I'm still pretty new with them all recently started doing an I.T. course so been mainly picking it up there And yeah that might be a better Idea to actually read into ruby a little more, thank you for your help!
  4. Okay I'll go look into them now, Appreciate the help! edit: One more thing, when I try and run my new code I get the following error: undefined local variable or method 'hangmanWords' for main:Object (nameError) heres the code within the file: def Read_Into_Array(file) file_Name = file.to_s $word_Arr = File.readlines(file_Name) end Read_Into_Array(hangmanWords.txt) And I've checked that the file name is right, and they're in the same dir so I'm a little confused, does it think it's a variable? and if so, how do I solve this? Thanks again
  5. Oh I'm not actually sure I might have to look into that. edit: if that was needed, surley it wouldnt run at all? rather than running through part and then crashing? I'm pretty sure that Ruby is like Javascript in that regard, where you don't have to declare variables. I've only ever coded in c#, java and c++ So in terms of syntax etc It's probably not like how most people would write ruby
  6. Hey guys, So I'm new to coding in Ruby and i'm getting the following error: in 'main': undefined method 'wordArr' for main:Object (NoMethodError) here's my code: def main wordArr = Array.new lettersArray = Array.new def readInText(file) fileName = file.to_s $wordArr = File.readlines(fileName) end readInText("hangmanWords.txt") puts " _ | | | |__ __ _ _ __ __ _ _ __ ___ __ _ _ __ | '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \ | | | | (_| | | | | (_| | | | | | | (_| | | | | |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_| __/ | |___/ " puts "Welcome to hangman! type quit at any point to exit, good luck!" random = rand(wordArr.length) #choose a rand num between 0-array length (number of words) word = wordArr(random) #gets a random word from the array of words puts "The word has been chosen! please enter the letter you wish to guess!" puts "Please enter a letter!" guess = gets.chomp if(guess == "quit") puts "Thank you for playing!" sleep(2.5) exit end end main From researching online as far as I could tell people get this error when calling something before it's declared, but I create the array first, then use it within the method, then call it to get the length(which is where the error is because it's printing the welcome message before then getting the error)? Only thing I can think is there's something going on with maybe having different instances of the same array? Any help would be greatly appreciated
  7. Hey thanks for the response, I don't quite understand how that gets the selected sport from the drop down? As in how does that $_GET know that the passed in sport is from the drop down? (sorry I'm not all that good with PHP)
  8. Hey guys, I'm having a lot of trouble trying to load data after I select something from a dropdown box. I've tried googling in lots of different worded ways but it just keeps coming up with how to fill the drop down box from things from the database, which I've already done: <?php include('CreateTable.php'); $all='SELECT sport FROM eventsTable'; $result = $pdo->query($all); foreach($result as $Sport){ ?> <option value ="<?php echo $Sport['sport']; ?>"><?php echo $Sport['sport']; ?></option> <br> <?php } ?> So this loads all the sports in my database into the drop down box, but now I want to when they select one of the options, load the related data from the database and display it in a table on another page. for example (my data is about the 2016 Olympics): If they select running from the drop down box, I want it to the load a page with all the runners on it it, in a table. my tables and fields: $createQuery ="CREATE TABLE eventsTable ( eventID INT(6) NOT NULL AUTO_INCREMENT, sport VARCHAR(20) NOT NULL, event VARCHAR(30) NOT NULL, PRIMARY KEY (eventID) )"; $pdo->exec($createQuery); $createQuery ="CREATE TABLE AthleteTable ( athleteID INT(6) NOT NULL AUTO_INCREMENT, firstName VARCHAR(20) NOT NULL, lastName VARCHAR(20) NOT NULL, gender VARCHAR(20) NOT NULL, image VARCHAR(20) NOT NULL, eventID INT(20) NOT NULL, medal VARCHAR(6) NOT NULL, CONSTRAINT SportEvents FOREIGN KEY (eventID) REFERENCES eventsTable(eventID), PRIMARY KEY(athleteID) )"; $pdo->exec($createQuery); here was my attempt: <?php $all='SELECT AthleteTable.athleteId,lastName,firstName,gender,image,sport,eventID,medal FROM ((AthleteTable INNER JOIN eventTable ON eventTable.eventID=AthleteTable.eventID) WHERE AthleteTable.sport = //the sport selected through the drop down box? //then foreach thorugh and print them in a table ?> Any help here would be greatly appreciated been stuck on this for ages, thanks.
  9. I use PDO, I'm not really that great with php so the POST thing is all kinda blurry to me. What would I have to do solve this error?
  10. I got it sorted! thanks for the offer tho, appreciate it! just having some trouble actually displaying the data now: here's the fields in the tables: eventTable: eventID INT(6) NOT NULL AUTO_INCREMENT, sport VARCHAR(20) NOT NULL, event VARCHAR(20) NOT NULL, PRIMARY KEY(eventID) AthleteTable athleteID INT(6) NOT NULL AUTO_INCREMENT, lastName VARCHAR(20) NOT NULL, firstName VARCHAR(30) NOT NULL, gender CHAR(1) NOT NULL, image VARCHAR(20) NOT NULL, eventID INT(6) NOT NULL, medal VARCHAR(6) NOT NULL, PRIMARY KEY(athleteID) here's the code for the loop that's meant to write out the data: <tr><th>LastName</th><th>FirstName</th><th>Gender</th><th>Sport</th><th>Event</th><th>Medal</th><th>Photo</th></tr> <?php include('CreateTableOly.php'); $all='SELECT AthleteTable.athleteId,lastName,firstName,gender,image,sport,eventID,medal FROM ((AthleteTable INNER JOIN eventTable ON eventTable.athleteId=AthleteTable.athleteId) WHERE AthleteTable.eventID='.$_POST['eventID']; foreach($result as $Sport) {?> <!-- fill the table in here --> <td><?php $Sport['lastName'] ?></td> <td><?php $Sport['firstName']?></td> <td><?php $Sport['gender']?></td> <td><?php $Sport['image']?></td> <!-- add image tag to this --> <td><?php $Sport['sport']?></td> <td><?php $Sport['eventID']?></td> <td><?php $Sport['medal']?></td> <?php } ?> and the error i'm getting is in the image below. If you could help me with this I'd be very grateful, Also unsure on how to get the table to show only when the sport is selected, because they're there at that point when nothing has been selected. Thanks
  11. pretty much all i'm looking to accomplish is have my queries related to the drop down items, so one will be gold medalist another silver etc and when i press gold I want it to display all the gold medalists in the database. edit: so heres a query i want to list all the sports in the database: $selectSports = "Select sport FROM AthleteTable"; $sports = $pdo->query($selectSports); and then i tried to foreach through and print them into the drop down box: <select name=Sports> <?php foreach($sports as $row) { ?> <option value="<?php echo $row['sport'];?>"><?php $row[sport]; ?></option> </select> <?php } ?> but the drop down box is still empty, any idea what i've done wrong here?
  12. oh yeah I was, thanks!
  13. Hey guys so I'm trying to put my php function onto a drop down box on the page which will run the query within the function when the option is chosen from the drop down box. here is the function: function goldQuery(){ $selectGold = "Select * FROM AthleteTable Where (medal Like 'G%')"; $golds = $pdo->query($selectGold); return $selectGold; } and here is the drop down box: <select> <option value="All athletes">All athletes</option> <option value="Gold medalists">Gold medalists</option> <!-- want to call the function here --> <option value="Silver medalists">Silver medalists</option> <option value="Bronze medalists">Bronze medalists</option> </select> and then when this option is selected from the drop down list it should display a table with gold medalists within. I was thinking this could be done similarly to having an onclick call on a button but couldn't find anything similar that worked, any help would be appreciated!
  14. oh sorry I forgot to copy and paste it, it is in the file. I moved it to the head like yopu said but it just wont work, pretty confused. Nah I just thought it would be easier, but how do you do it in html/css?