Category Archives: MyWebApp

Hello World

The first program that is always created is a “hello world” program. So my first goal is to have a web page that says “hello world” That seems pretty basic doesn’t it. It turns out that web technology doesn’t stand still. There is this new version of HTML that is emerging called HTML5. Ok so I am going to go with that. I am also going to limit my programming to working with the Chrome browser although I will want to ensure that it works on a Mac and MS machine. I prefer Macs, but they are more expensive and I spend all my time at work on a MS machine. My thought was that I would have a blank document that would load everything from the server. This may not be the most efficient way to do things for many reasons, but from my point of  view the whole world is so bloated it is hard to compare. So how would a program know when or where to start? How would the program know that changes had been made on the backend and it should make changes to what is displayed. It all boils down to user input -> display results. I could hit the browser refresh button if I wanted start over. OK so my program should launch and immediately ask the server what it should display. This is a little redundant because the program (or really web page) just came from the server, but I want to start down the dynamic (AJAX) path.  So at a high level it should do something like this. Load page -> ask the server what to do -> display results (Hello World)

The first step is to tell the browser this is an HTML page and that it is based on HTML5. This is simply done with the

<!DOCTYPE html>

Browsers have been very good at letting people make mistakes and then browsers would fill in the undefined blanks and they started to diverge a little from each other. It is best to try and do things the way they were designed unless you have a really good reason not too.

Next I want to tell the browser that everything that follows is HTML and separate the head from the body and then unwind and close all the tags. So now I have

 

<!DOCTYPE html>
<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>

If I add Hello World in between the body tags like this:

<!DOCTYPE html>
<HTML>
<HEAD>
</HEAD>
<BODY>

Hello World

</BODY>
</HTML>

 

Then I have accomplished my first task, but like everything from this point forward I am going to do things the hard way because I want to learn. So in my mind I should call the server and ask it what it wants me to do. I could put it in the body tag, but I am going to create a simple button (and this will have HTML5 attributes) that will simply say launch.

<button type=”button” autofocus=”autofocus”>Launch</button>

I put that in the body and I am not done because I want it to talk to the server and take directions from there. So first I have to tell the button to do something when I click it. The function (or attribute or is it method, I don’t know) is onclick and looks like this:

<button type=”button” autofocus=”autofocus” onclick=’TalkToTheServer()’>Launch!</button>

Now I have the function name in quotes. I am not sure what difference it makes, but when I took them out and explored around the onclick attribute I couldn’t find a difference. The problem is that browsers tend to have good memories and remembers stuff that they shouldn’t. I am going to leave them in. Well I called the function when I clicked the button, but I have to write the function. This will be added to the document (and therefore the document object model or DOM) in the HEAD section. So now my code looks like this

<!DOCTYPE html>
<HTML>
<HEAD>
<SCRIPT type=”text/javascript”>
function TalkToTheServer(){

}
</SCRIPT>
</HEAD>
<BODY>
<button id=’mylaunch’ type=”button” autofocus=”autofocus” onclick=’TalkToTheServer()’ >Launch!</button>
</BODY>
</HTML>

Now I have to talk to the server. This is where I am going to go crazy because I know there are a lot of tools out there like jquery that would make this easy and would probably work better, but I am going to do it myself.

After all of this I scrapped what I was doing and started over. This won’t be the last time I do that.

The Editor my first tool.

Programming comes down to typing in code. I am old enough to remember when we had to punch blue cards to program. Not anymore. Since programming is just typing there are so many programs that could be used to do that. I could type in notepad or MS Word (blechh!). Years ago I had stumbled across a program called Crimson Editor. I looked it up and it was still available for a free download. It hadn’t been updated since 2004. That is long time in the technology world. Now there are environments where the editor is integrated with a lot of environmental tools like FTP and even project management programs. I thought about going that route, but I decided to keep in simple and just use this simple editor. So that was my first tool choice. I have a website (this one) that I can use for testing. I use Filezilla (a free FTP program) for transferring the files. And I am off and running. Now that I have picked my tools I needed to decide what to program. I use a program called GnuCash for managing my money. It is a desktop program. It has a lot of features that I never use. I decided to try and create a web version that will allow me to do what I do in GnuCash over the web. The advantage would be that I would not have to worry where my files were and I could access them from anywhere, even my phone if I needed to. So that is my goal. I am ready to program. I am really starting at the beginning and since I want to understand everything I am going to spend more time learning the programming than actually getting the program done. So let’s start

Programming the beginning

I have a degree in Computer Engineering and I love programming, but I have never been paid to do it so I have never had to really put in the hard work of grinding through finishing a project. The first step in deciding to get back in the saddle was to decide what m goals are and what technology to use. I decided to create a Web Application. When I graduated in engineering the web as we know it today did not exist. My favorite programming in college was bit level assembly language. Back then we had to worry about size and efficiency. That is where all the control was. There were no libraries to trust, it was all raw 1’s and 0’s. I had to let go of that and get a little more practical. So after exploring around I decided to go with Javascript -> PHP ->MySQL.  I could have made some other choices and I seriously considered others, but this is what I am going with. I am going to avoid tools, libraries, and frameworks for now in order to really learn the bits and bytes, the nuts and bolts of what is going on. So that is it. I have started and every time I think I have figured something out it doesn’t quite work the way I thought it would. I will document that here to keep track of what I am learning / doing.