cfoley's Profile User Rating: -----

Reputation: 2220 Grandmaster
Group:
Mentors
Active Posts:
4,686 (1.66 per day)
Joined:
11-December 07
Profile Views:
67,338
Last Active:
User is offline Aug 27 2015 03:35 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
225
Expert In:
Java

Latest Visitors

Icon   cfoley has not set their status

Posts I've Made

  1. In Topic: Is it worth learning TeX?

    Posted 25 Aug 2015

    I've had bad experiences with TeX IDEs in the past, although I have not tried MacTeX. Maybe it's awesome but I don't have a Mac.

    My current setup is Sublime Text 3 with LaTeXTools. The problem isn't with the defaults. Things like maths mode and anything else you would find on a cheat sheet are fine. TOC and references/citations are easy too. It's when you want to do something less straightforward that things get tricky.

    For example I had a table with a large number of rows. The correct incantation was to install the longtable package. I had another table with lots of rows and lots of columns. It was just a table of data included in the appendix for completeness so I wanted to squash it onto one page. I spent about 2 hours resizing text, rotating headings and changing column spacing before finding a command that scales whatever is inside it. 30 seconds and I was done once I knew the correct incantation.

    These are details that you either know or you don't know. It's impossible to discover them without google and the tutorials I've read cover only the most basic macro creation.

    Would MacTeX have helped me with these problems? If the answer is "Yes" then I'll be happy to give TeX IDEs another go!
  2. In Topic: Is it worth learning TeX?

    Posted 24 Aug 2015

    I guess that's why LaTeX exists then. :)
  3. In Topic: Best way to go through stages of a basic game.

    Posted 20 Aug 2015

    The state pattern is awesome and easy. First you define a state. For a game, it might do a game tick and let you know if that stage is complete:

    interface GameState {
    	void tick();
    	boolean isComplete();
    }
    


    Then you make some states. Here are three: a splash screen, a pretend game and a game over:

    class SplashScreen implements GameState {
    	public void tick() {
    		System.out.println("Pirate treasure hunt -- X marks the spot!");
    	}
    
    	public boolean isComplete() {
    		return true;
    	}
    }
    


    class PlayingGame implements GameState {
    	
    	int position = 0;
    
    	public void tick() {
    		char[] board = "         X".toCharArray();
    		board[position] = 'i';
    		position++;
    		System.out.println(new String(board));
    	}
    
    	public boolean isComplete() {
    		return position == 10;
    	}
    }
    


    class GameOver implements GameState {
    
    	public void tick() {
    		System.out.println("Game Over");
    	}
    
    	public boolean isComplete() {
    		return true;
    	}
    	
    }
    


    Then you can plug them into your game. Here is a quick and dirty demo of a game loop. You will need to make a better one:

    public class StateDemo {
    	
    	public static void main(String[] args) {
    		Queue<GameState> states = new LinkedList<>();
    		states.add(new SplashScreen());
    		states.add(new PlayingGame());
    		states.add(new GameOver());
    		
    		while(!states.isEmpty()) {
    			GameState currentState = states.remove();
    			do {
    				currentState.tick();
    			} while(!currentState.isComplete());
    		}
    	}
    
    }
    


    Run it and you get this:

    Pirate treasure hunt -- X marks the spot!
    i        X
     i       X
      i      X
       i     X
        i    X
         i   X
          i  X
           i X
            iX
             i
    GameOver
    
  4. In Topic: A Selfie-Stick for self-defence

    Posted 19 Aug 2015

    Funakoshi wrote that a person should have to use self defence skills maybe once in a lifetime. By that he meant physical or violent skills. The skills where you stay away from dangerous situations or remove yourself from them if they materialise around you are the ones that will keep you safe.

    A gun, a sword, a knife, a pen, a chair, a selfie stick are all things that could be employed for self defence but if you carry one around for the purpose of self defence, thinking that it will keep you safe then you have already lost.
  5. In Topic: Generate a consistent hash for an array list containing objects

    Posted 17 Aug 2015

    Heh, nice. :)

My Information

Member Title:
Cabbage
Age:
33 years old
Birthday:
April 7, 1982
Gender:
Location:
Glasgow
Forum Leader:
Java
Years Programming:
20

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://www.cfoley.co.uk
Twitter:
CFoleyUK

Comments

Page 1 of 1
  1. Photo

    burakaltr Icon

    06 Mar 2013 - 18:18
    Thanks for Your Precious Input. I Found the character counting thing very bedazzling. I have the code to it that I wrote Myself, but it took me Long to find a subtle Algorithm :)
  2. Photo

    cfoley Icon

    18 Oct 2011 - 03:29
    Cheers! The next one is in progress, but I'm having to learn and write some programs first. It's going to take a little time...
  3. Photo

    Dogstopper Icon

    18 Oct 2011 - 03:24
    Nice blog. Can't wait to see more
  4. Photo

    ayaz 786123 Icon

    25 Feb 2011 - 06:49
    have a nice day sir
  5. Photo

    cfoley Icon

    16 Feb 2011 - 17:26
    Oooh thanks! Your comment is the first I heard!
  6. Photo

    m-e-g-a-z Icon

    16 Feb 2011 - 15:34
    Congrats on becoming a Forum Leader! :)
  7. Photo

    Dogstopper Icon

    08 Jan 2011 - 23:49
    "Cabbage" is much better! :D
  8. Photo

    cfoley Icon

    06 Jan 2011 - 16:19
    Cheers dude!
  9. Photo

    Dogstopper Icon

    06 Jan 2011 - 14:36
    "Purple DIC-headed Warrior" doesn't quite apply now that you got the promotion. Well done!
  10. Photo

    DaneAU Icon

    08 Sep 2010 - 09:19
    "cfoley has no profile comments yet. Why not say hello?"
    I don't have many comments either, so i am only doing what the thingy below said to do, hello cfoley and thanks for the thanks :)
Page 1 of 1