Tuesday, September 1, 2015

Raspberry Pi

For a long time I have been interested in coding. This started at Khan Academy when they introduced their coding unit. I made about 30 little projects there until I found out that I was using processing js, a language designed for beginners. Then I found codecademy and I took their html/css and js courses. Then I found out once again that they were using artificial js. I went to w3schools where they have pretty much the documentation for html, css, js, and many other languages.The biggest problem is that they didn’t have a place to test your code.

I talked to my dad and he said I should create website. At first I used a Folder on my dad’s computer which worked very well for a very long time. I was able to create easondev.kamander.com, which is basically a bunch of independent coding projects. The first one I made was the date program, this was a really long function that gathered every aspect of the date and time and put them together. Although I didn’t know this at the time, javascript already came equipped with a built in function you could call that did exactly what my 200 lines of code function did. I made many other projects, but the one thing I could never do was collect user data. This started with my math homework. In math we were given homework day after day on calculating tax, tip and discount. I had a function written down, that was basically just (Base Price)+(Base Price*tax)+(Base Price*tip)-(Base Price*Discount) and twenty times each night I would make sure I was allowed to use my calculator (I always was) and then I would plugin in the numbers. One day I had an idea. I knew I was allowed to use any kind of calculator, and I decided to create a tax, tip, and discount calculator with javascript. I could process the numbers, and I could have made my math homework so much easier, but I couldn’t collect user data. I created a form where you would type the values of the base value, the tax, the tip, and the discount, but when you hit submit, I couldn’t collect the data in the input field. To do that I needed a new language, php, but you have to download php, which I couldn’t do on my dad’s computer.

A few weeks later my uncle gave me a present, called the arduino. I never really figured out the arduino, and although it was capable of being a web server, I never got there. For me the most important thing it did was get me and dad thinking about something like an arduino.

Then on Centurial Pi Day, my dad got me a new present, the Raspberry Pi 2 b+. I was really excited to start. The first thing I had to do was install Raspbian, the Raspberry Pi’s version of Linux. When me and my dad couldn’t figure it out, I lost my excitement, but I kept trying, and eventually it worked. This has basically been what improving my webserver has been about, excitement, failure, lowering expectations, dedication and eventually success. Some things take longer than others. Apache was a breeze. After just a few google searches I was done. On the other hand I still haven’t figured out ssl. There has been a lot of failure, lowering expectations, and dedication, without any large advances.

After I booted up my raspberry pi, the first thing I wanted was Apache. Apache is the web server component. It is the thing that allows me to have a website. There isn’t much to tell about Apache, because installing Apache on Linux is a well traversed path, that was very easy to follow. The next thing I tried to get was ssl. Ssl allows my website to run over https, which is much more secure than http. In addition, it would make directing traffic to my website or to dad’s website much easier. Getting ssl is also a well beaten path, but getting free ssl is not. I spent so long trying to get CaCert ssl to work. Then I found out that in order for it to work, the computer trying to go to the website had to download something. Imagine you go to a site and it tells you you have to download something for the website to work. Why do you have to do that? Now I am trying to use StartSSL, but I still haven’t figured it out. My largest victory on my raspberry pi is php. I don’t know why downloading all the separate components of php individually worked, but after 3 months of trying different things, I wasn’t complaining. I was just really happy php worked.

After I got php, I uploaded all my coding files to my raspberry pi. I finally was able to use some php to create my tax, tip, and date calculator. I spent a month using my raspberry pi as the webserver I wanted it to be. I rarely worked on ssl and MySQL, the only two things I wanted for my web server. And then I lost everything.

A raspberry pi doesn’t have a battery. So if you want to shut down quickly you can pull the plug, instead of pressing shut down. What I didn’t realize is that anything your hard drive was doing when you pull the plug would be abruptly stopped and forgotten. And one time when I pulled the plug my hard drive was halfway through reading a file that was used in boot up. So when I turned on my raspberry pi, it couldn’t boot up. I copied all the recovery files off my raspberry pi, and did the only thing I could do, start from square 1. As of now I haven’t got around to installing raspbian, and I just hope I’ll be able to get php back.