Monthly Archives: July 2017

Week 7 – FileUploader

I spent some time last week trying to create a program that would allow users to upload different types of files using Amazon’s DynamoDB, so that it could be used later to create quiz banks. However, there was another part that I had to complete, which was to do the same thing, but instead to upload the files to S3 so they would be accessible from the main program, and in the form that we want.

This week was shorter than the others, so we had only 3 days to finish our weekly targets. I spent all three days trying to figure out how S3 worked – you would think that Amazon makes their technologies similar to each other, and therefore easy to learn when you already know how to use a different one, but no, they’re all different. I learned this the hard way when I tried running the entire program we had up to that point along with what I thought the solution should be – it gave me enough red signals to send me running back to do a better job.

I proceeded to try all kinds of solutions – tried uploading the files directly, changing the client I was using to upload the files to S3 (you wouldn’t think this should have been done, but due to technologies that were later deprecated, this turned out to be surprisingly helpful) , and even changing how the files were being uploaded – I tried them all. The point where I hit rock bottom, I think, was when I spent 2 hours trying to figure out how to convert a temporarily uploaded file to a byte stream using Amazon’s input API (Amazon is very finicky about the types of data you can upload and then have be accessible later), then figuring out it’s location and giving it full file status while trying to upload it to the database – it took a turn for the worse, and I was not a happy camper. However, I seemed to be on the right track as far as converting the input to a bytestream went – from there, it just became a matter of changing the file type of the recently uploaded file from a single part to a multipart, and remove all encoding so that the doPost method of the program would be able to understand the file that was being sent its way. Finally, I was able to accomplish what should have been nothing more than a 2-3 hour task!

Nope. There was still the matter of the client, and the HTML form through which the file was to be uploaded. I powered through the rest of what was to be done, and finished it barely 15 minutes before the last bus was to leave work – then ran downstairs, and made it onto the bus with seconds to spare.

This week was good, as I learned that programs never really get done in the timeframe you think they will – some don’t take very long, and some, like the one I tackled this week, take you a seriously long time.

Week 6 – Finalizing the data

Having built a strong backend last week, we spent the majority of this week trying to integrate it with the front end and get a working demo ready. We finished most of the writing of the data to the databases, and so we tried to focus on more niche situations, ones in which the data would have to be inputted by the user in a very specific format. Situations such as creating pools of questions, setting up question types etc. would be examples of such situations.

For the first part of this week, I sat down with Michael from the front end team and we worked on creating the user interface for inputting questions. We decided to use Java servlets to implement the actual application, and we juggled with the idea of using a template engine called freemarker to create the actual UI. We tried working with this idea for a while, but the deeper we went into it, we found that although possible, using freemarker to pass entire objects in and out of the template that we would be showing the user would be highly inefficient and complicated, so we decided to use HTML and some javascript instead to finish this part of the app. As we progressed with building the app without using freemarker, we learned that contrary to what we had previously believed, we didn’t actually need to pass entire objects back and forth to the UI. This belief of ours blocked out a potential path, which we were only able to escape after consulting with Chip about how to progress. From that point onwards, both Michael and I proceeded to thoroughly inspect our possible options before deciding on a way to get what we needed to do done.

I spent the latter part of the week creating a button that was able to upload all sorts of files to the database, as we need to access multiple different file types while creating a quiz to show to our users. This was fairly straightforward, as I had built up a basic understanding of how DynamoDB works, and taking it from there wasn’t a particularly hard job, though I did have to explore a new feature of AWS, called S3.

This week was fun, though we did a lot more troubleshooting than anything else. Next week we will try and have a basic version of the program running, so stay tuned to find out if we are successful!