I just found out this week that I can save myself time by making a program that will do my homework for me! So what is my project? I am making a tide calendar, and my role in this is to make the graphs from day to day what the tides will be in Point Loma. Sooo, I have made two projects so far, one over the weekend (at least ver 2.3 of it) and one Tuesday to help me with graphing this crazy line.
The first program:
This was intentionally supposed to be just another standard grapher with an object placing dots following the graphing object as it would draw rough jagged lines (so as it would make corners, the “follower” would make a nice easy curve as it follows it). I tried to make an equation to figure out tides, but it just turned out to be too many variables involved than just the moon [the sun, distance, direction, location of the sight, phase of the earths tilt, earths rotation/time, formation of the coast line and more]. So I ended up taking information off a website into a “.ini” file in which the grapher reads this file and spits out the graph.
The second program:
This program was made out of my laziness of manually making 365 “.ini” for tides (making mistakes that can take time to figure out). I calculated that it would take approximately 18 hours with 1 “.ini” file in 3 minutes on average [this is not including coffee breaks of source, and all the morphine breaks that will be needed to go though all this]. So I made this program that makes the “.ini” file in steps
1)downloads every single web page onto the hard drive (because it does take a while, and redoing them would be a pain to re-download)
This possess takes the most time, running for about 15 min
2)makes the main chunk
-opens the web file in html format
-read every line until it finds the keywords “PST” or “PDT” (which happens to only occur on the tide information
-decode the html jargon
-set place markers
-collects text relative to the place makers
-writes them down
-writes the date!
This happens in less than 1/30th of a second
3)makes the beginning and ending of the graph (this is so it runs smoothly together from one to the next)
-opens yesterdays document
-copies the last tide information
-makes it the before spot and changes the PM(1) to (-1)PM for yesterday
-opens tomorrows document
-copies the first tide information
-makes it into the after spot and changes AM(0) to (2)AM for tomorrow
still happens in less than 1/30th of a second
4)runs a final check to make sure no “.ini” files are missing anything and reports suspicious results
Did you have enough of technical stuff? You better be glad you don't know what magical code is going on right now in your computer! This is just a cakewalk to my intense programming skills. But yet it really helps me a lot so I can work on other stuff for the project. So I plan on making the template in InDesign so we can get this project rolling. Well at least the main basic template since the tides are here!!!!
Oh yea, I also improved the TIDE PROGRAM! It had to be improved to go at max of 9999 frames per second computing the tides. At the end of every tide, it would take a screen shot of itself as a “.bmp” file and restart itself computing the next tide until it reached its goal. Computers are great.
No comments:
Post a Comment