Punters Lounge JAVA programming course. Course introduction and preparation
Welcome to the Punters Lounge programming course.
This course was set up specifically to teach computer programming in a context of sports betting. In the world of sports betting many punters nowadays use the Internet to collect information and place their bets. This can in some cases take a lot of time. Imagine you want to find the best price available on an event, like a football match. You will need to look at various bookmakers, make notes and compare. And you need to do this every time you want to bet. It is exactly this kind of re-occurring action that takes a lot of time. What takes you hours and hours can be done in a matter of minutes, with a bit of programming. That is the goal of this course. To provide you with the basic skills to extract information from the Internet and use that for your betting purposes.
So who am I ? My name is Erik, known on the Punters Lounge as Datapunter. I've been involved in sports betting for about 5 years now. I used to be in the IT industry as a support engineer where I did a lot of programming and also user support and training. That was years ago, now I’m in real estate. Being involved in sports betting has made me pick-up on programming again, I got totally fed up with copying and pasting all the time. Knowing how much time people spend on processing information, and knowing how that can be done much faster with a computer program, I decided to create this course.
To participate you don't need any experience. Basic computer skills will do. Simply follow my lessons and you will end up with a usable result. This puts you in the
ROOKIE class. If you do have some programming experience you can follow the course with an on-line tutorial. It covers more ground but the language is more technical. This puts you in the
SCHOLAR class. We will be using JAVA as language. I provide the course for free and you do not need to buy any software. Just so there is no misunderstanding: this is not a list of hints and tips or a guide to how to do things the quick way. It is an actual course in computer programming.
And one thing I would like to mention is this. If you start this course make sure you have some sort of application in mind. Having a goal or purpose is essential. If you do not have a goal then learning programming is like learning Chinese, without the intention of ever having a conversation in Chinese.
I rest my case.
What are we going do then ?
We are going to write a computer program that looks at a couple of bookmaker sites, downloads odds information, and presents that info exactly the way we want it. In the process we will be doing some calculating like overround and comparison to find the best odds. That’s the application everybody makes besides that you can start work on your own application as we go along.
Note: you may be reading this after the course has actually taken place. Well it should still be valid. You'll just have to do it on your own, which is quite possible. Have fun.
So lets get cracking...
Introduction to JAVA
So first a little bit about JAVA. What is it ?
It's a computer programming language. You use it to tell a computer what to do. That's it.
JAVA was developed in the 90's and is a modern language. It was designed not only to be a language for computers but a language for devices in general. Look around you, mobile phones, DVD players, fax, washing machine, all could be programmed using JAVA. The main feature of JAVA is that it's portable. In out context it means it does not matter if you have a Windows PC or a Mac or Linux, JAVA works on all. More so, if you write a JAVA program on a Mac it should run on any other computer and vice versa. The second advantage JAVA has is that is was developed in the middle of the internet boom. It therefore has many features directly related to a world where everything is connected using the internet.
ROOKIE class: that’s all you need to know for now.
SCHOLAR class: SUN has a developers site with many tutorials and white papers. We will be following those tutorials as we go along. The start page is:
java.sun.com/learning/new2java/index.html
at this point you may wish to read more about Java so see Step 1 : Java Platform Overview.
java.sun.com/developer/onlineTraining/new2java/overview.html
Getting started Download Java
To get started you need a computer and an Internet connection. First we need to download the JAVA development kit. (that’s about 50 Mbytes) You can download it from the SUN developer site:
java.sun.com/j2se/1.4.2/download.html
What you need is called
J2SE v 1.4.2_04. And then you need the
SDK part. First you will be asked to accept the terms and conditions and then you need to select the version fit for your personal computer. That depends on what operating system you are running. Download the kit into the default directory
C:\j2sdk1.4.2_04\. You can put it in a different directory if you wish but make a note; we will need that later. For the rest of the course I will assume you have Windows. (I’m on Windows 98 myself)
Full name:
J2SE v 1.4.2_04 SDK
Java 2 platform Standard Edition version 1.4.2_04 Software Development Kit
Note: by the time you read this the version may have gone up to 1.4.2_
13 or higher, if so that’s fine and should not be a problem.
If you have a 24hour internet connection then that's it for now. If you are paying by the minute you may also want to download the documentation from the same page called:
J2SE v 1.4.2 Documentation. That should allow you to work off-line.
ROOKIE class: if you are having trouble finding it or downloading I suggest you don't spend hours figuring it out, simply get someone to help you out.
Configure your computer
Now we need to tell the computer the location of Java so we can write programs in various directories and the computer can still find Java. This is done by setting an environment variable.
On older windows machines you need to edit the file
autoexec.bat in the root directory
C:\ and change a line and add a line.
There should be a line in your autoexec.bat that looks like below, possibly with more directories. You need to add the directory where you downloaded J2SE. This will allow your computer to find Java (compiler part) from whatever directory you are working in.
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;
C:\J2SDK1.4.2_04\BIN\;
Then add this line. This will tell Java where to find necessary parts to run your program. Later you may wish to add directories of your own as you are building your own library of programs.
SET CLASSPATH=C:\JAVA\;
Now you need to restart you computer for the changes to take effect.
On PC's running recent windows versions like XP it is actually XP that takes care of editing autoexec.bat and you need to follow the appropriate menus inside XP. Check the original documentation, on the download page "Installation notes", on how exactly to proceed for your specific operating system.
ROOKIE class: again, this is a bit technical so if you are having trouble with any of this simply get someone to help you out.
SCHOLAR class: you may want to follow this tutorial to cover setting up and writing your first program.
java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html (for Windows)
java.sun.com/docs/books/tutorial/getStarted/cupojava/unix.html (for Unix/Linux)
java.sun.com/docs/books/tutorial/getStarted/cupojava/mac.html (for Mac)
Your first program
Next step is to write your first program and get that to work. For this you need a text editor like Notepad or Wordpad. Create a new directory called
C:\JAVA and in that directory create a new file called
HelloWorldApp.java using your editor. Inside the file type this text:
class HelloWorldApp { public static void main(String[ ] args) { System.out.println("Hello World!" ); } }
Make sure you type it exactly like it's displayed here. Including the upper/lower case characters and every bracket and dot must be exactly the same. Note there are 3 different kind of brackets used! If need be you can copy and past from here. Don't worry about what it all means we'll get to that soon enough.
Now save the file and go to MS-DOS. On Windows use Start, then Run then type Command. You should get a MS-DOS window with a command prompt. Go to the directory where you saved the file like
C:\JAVA Check if your file is there with the DIR command.
WARNING : some editors automatically add a file extention. So you get HelloWorldApp.java
.txt or HelloWorldApp.java
.doc , we don't want that. If you get that somehow find a way to get a file with just .java at the end. Usually you can save and put the filename with extention in between double quotes. Save as, then type "HelloWorldApp.java" including the "" characters.
Now type this line to compile your program:
c:\java>JAVAC HelloWorldApp.java
( so C:\JAVA> is the directory you are in and
JAVAC HelloWorldApp.java is the command you type )
Now you want to run your program so type:
c:\java>JAVA HelloWorldApp
Note that to compile the command is java
C and to run the program the command is simply java.
That should result in the text
Hello World being displayed on the screen.
ROOKIE and
SCHOLAR class: the tutorial mentioned before covers all this in great detail. I know it's a bit technical but I just don't see how it can be explained more easily. If you are having trouble getting here have someone to help you out. And ROOKIE's don't worry; this is something you only need to set up once.
SCHOLAR class: you can find the whole introduction and much more here:
java.sun.com/docs/books/tutorial/getStarted/index.html
Once you have the HelloWorldApp program running you are ready to start programming.
On to lesson 1.
EDIT : in the part on configure your computer it originally said
C:\J2JE1.4.2_04\BIN\; and that should have been
C:\J2SDK1.4.2_04\BIN\;
EDIT : i originally used a space between C: and \ to avoid displaying an emoticon. That does not work if you copy and paste that into autoexec.bat. Re-edited in HTML to correct.
Also added the part about editors automatically adding a file extension.
EDIT: the PATH and CLASSPATH variables need to be set with the SET command, at least on windows 98.