# Sending my competition times almost as they happen



## JustinTimeCuber (Jul 4, 2016)

Okay, terribly un-descriptive title, but anyway...

This afternoon I started working on this project, and it is finished enough that it works. (For other mediocre programmers, you know what I'm talking about ) There are still some things to work out, but what does it do, and why did I spend (more like waste) a whole afternoon on it?
First, the why. I am going to Nationals soon, and I wanted an efficient way for my mom (my dad is taking me) to see my times. To make this idea become a reality, I didn't start with the code; instead, I started with creating an XML file, so I had an idea how my data would be organized. So, how does it work? In the XML file, you set it up with opening and closing <display> tags, and within that, 3 more: <rounds>, <messages>, and <countdown>. In the <rounds> tag, you add one or more <round> tag(s), each with certain attributes. The <messages> tag contains messages, and the <countdown> tag contains data about the countdown display, that shows how long until whatever it is I want to count down to. Here is an example of what my file looks like:


Spoiler: Code on the cob



<display>
<rounds>
<round name="6x6x6 Round 1" date="29" hour="9" minute="00" heat="1" advance="n" times="4:27.09" average=" " place="109"></round>
<round name="Megaminx Round 1" date="29" hour="9" minute="00" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="Square-1 Round 1" date="29" hour="10" minute="30" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="7x7x7 Round 1" date="29" hour="10" minute="30" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="Clock Round 1" date="29" hour="13" minute="00" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="5x5x5 Round 1" date="29" hour="13" minute="00" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="3x3 OH Round 1" date="29" hour="15" minute="00" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="Skewb Round 1" date="29" hour="15" minute="00" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="FMC Atmpt. 1" date="29" hour="19" minute="00" heat="1" times="#" average="N/A" place="N/A"></round>
<round name="FMC Atmpt. 2" date="30" hour="9" minute="00" heat="1" times="#" average="N/A" place="N/A"></round>
<round name="4x4x4 Round 1" date="30" hour="9" minute="30" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="Pyraminx Round 1" date="30" hour="9" minute="30" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="2x2x2 Round 1" date="30" hour="13" minute="30" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="3x3x3 Round 1" date="30" hour="13" minute="30" heat="1" advance="#" times="#" average="#" place="#"></round>
<round name="FMC Atmpt. 3" date="30" hour="19" minute="00" heat="1" times="#" average="#" place="#"></round>
</rounds>
<countdown year="2016" month="7" date="29" hour="8" minute="0">Beginning of Nationals</countdown>
<messages>
<message time="17:00 CDT; Dec 31, 1969">This is Justin's online Nationals stats program. Messages sent from Justin will appear here </message>
</messages>
</display>



This file is uploaded on Google Drive, and I can access it in my program using a direct link. My program has a simplistic GUI. Here are some images:














Tomorrow evening, I plan to release my program and give details on how to use it. You probably will need some knowledge of computer stuff in order for it to make much sense.


----------



## JimCube (Jul 4, 2016)

That seems really cool! My last comp my whole family came, and they were all bored. We waited 4 hours for my round. This is a great way for them to see without coming! Nice job! I have a little bit of programming knowledge, ill probably get this to work. Thanks!


----------



## JustinTimeCuber (Jul 4, 2016)

A little bit earlier than I was planning, but here is how to make it work:


Please note that in order to run this program one must have 64-bit Windows (so R.I.P. Mac users). However, if you personally have a Mac or any other non-Windows computer, you can still send data, just not use the program, which displays it.

*SETUP*
1. Download this XML file, and upload it to your Google Drive. (If you don't have a Google account, make one.)
2. Share the file so that anyone on the web can view it. (Right click on the file in your drive, click on "Share" and then hit "Advanced".)
3. Copy the file's sharing link to your clipboard. (Ctrl + C)
4. Get the file's direct link using this website.
5. Download the program from this link. You will need to download the entire folder. Do this by clicking on the drop-down menu for "Competition data" at the top. You will need to do this and steps 6 thru 8 on the computer(s) of those you would like to send results.
6. Unzip the compressed folder. Once you have a normal folder, you can delete the compressed one.
7. Create a shortcut to nationals.exe on the desktop. (I made it for Nationals, so that's what it's called. Deal with it.)
8. Open xml_path.txt. Remove the URL that is in there and replace it with the direct link from step 4. Save and close the file.
Double click on the desktop shortcut. If it miraculously opens and shows something that looks like the first image that I posted, Congratulations! Now you have to figure out how to use it!


*USE*
- Viewer
If it is properly set up on their computer, all a viewer must do is open the program and be connected to the Internet. It automatically refreshes every few seconds, and if something changed, it will play a sound to notify of the update.
- Competitor
If you want to send your competition data to your viewers, you will need to be able to modify that XML file you uploaded. Go to your drive, right click on data.xml (the file) and then click on Open with -> Drive Notepad. Edits to this file must be saved using Ctrl + S. Here is how this file is organized:

There is one attribute of the <display> tag at the very beginning, timezone. I made this program timezone-friendly, so no matter in what what timezone the competition is, you can still get accurate displays. For a list of valid timezones, go to this webpage. For instance, west-coast US competitions would use the America/Los_Angeles timezone, while midwestern ones would use the America/Chicago timezone.

Inside the <rounds> section, there are several <round> tags. The first one looks like this:
<round name="6x6x6 Round 1" year="2016" month="7" date="29" hour="9" minute="00" heat="1" advance="#" times="#" average="#" place="#"></round>

For one, you can add and/or remove these and they will update on your viewers' display. You might remove one if an event or round were canceled, or add one if a round or event were added in which you were competing, or if you qualified for another round. (Notice how all of my rounds are round 1, because I haven't qualified for R2 in anything yet.)

You can also edit the attributes of <round> tags. Here are what they all mean.

_name_: Name of round.
_year_: Year of round.
_month_: Month of round, from 1 to 12.
_date_: Date of round, from 1 to 31.
_hour_: Hour of round. Although it is not required, it is a good idea to use 24-hour time to avoid confusion (although it is rare for competitions to go over 12 hours in one day).
_minute_: Minute of round, from 00 to 59. For single-digit times, preface this attribute with a 0, or else it will look something like 10:0 or 10:5, instead of 10:00 or 10:05. For some bigger competitions, organizers post heats with estimated times, so you may want to use the time for your heat rather than the start time of the event.
_heat_: The heat in which you are competing. Since most competitions don't announce heats until the day-of, you can leave them as "1" until you know otherwise. In order to leave it blank, you must use a space (" ") because "" is interpreted as null for some reason and it will crash.
_advance_: This is the one attribute of <round> that is not required. If an event only has one round, you can remove this attribute. It has four options:
"#": Waiting to compete
"$": Already competed, but waiting for official ranking
"y": Advancing to next round
"n": Not advancing to next round
_times_: List of times from a round. Use "#" to signify that you have not yet competed. You may format your times however you like, so "10.00 10.01 10.02 10.03 10.04" is fine, as is "(10.00),10.01,10.02,10.03,(10.04)".
_average_: Your average from a round. Use "#" to signify that you have not yet competed. If you missed a soft cutoff, use a space (" ") or put "No Average", but *DO NOT* put "", for the reason mentioned previously.
_place_: Your place in a round. Use "#" to signify that you have not yet competed, and use "$" to signify that you are waiting for all results to be entered.

Countdown: The countdown can be used to count down to whatever you like. Simply specify a time using the timezone given previously (the attributes of this one should be self-explanatory) and inside the tag, give your countdown a label. If you wanted (for some reason) to countdown to New Year's Day, the tag should look like this:
<countdown year="2017" month="1" date="1" hour="0" minute="0">New Year's Day</countdown>

Messages: To add a message, add a new <message> tag *BEFORE* the already existing ones, if they exist. Specify the time you sent your message however you want in the _time_ attribute. Inside the tag, write your message that will appear on all of your viewers' display. For instance, if you wanted to send the message, "Hello", the tag you would add might look like this:
<message time="14:02 CDT; Jul 4, 2016">Hello</message>
Make sure that you put this before all previous <message> tags but still inside the <messages> tag.

Good luck!


----------



## DGCubes (Jul 4, 2016)

Dang, that's awesome! I had no idea you were a programmer too! I might have to use that.


----------



## JustinTimeCuber (Jul 4, 2016)

DGCubes said:


> Dang, that's awesome! I had no idea you were a programmer too! I might have to use that.


Thanks! I hope you are able to figure out that mess!

btw your location thing links to a place in downtown Kansas City, or at least it does for me
https://www.google.com/maps/place/N...3c30d20f28af61!8m2!3d39.0811274!4d-94.5859969


----------



## DGCubes (Jul 4, 2016)

JustinTimeCuber said:


> Thanks! I hope you are able to figure out that mess!
> 
> btw your location thing links to a place in downtown Kansas City, or at least it does for me
> https://www.google.com/maps/place/N...3c30d20f28af61!8m2!3d39.0811274!4d-94.5859969



Hahaha, that's pretty funny.
Jk, I actually live there. /s


----------

