UseCases: Answers to the project questions

--Originally published at richardctc201

UseCases: Answers to the project questions

In the activity of the description of the Use Cases of our project, my team and I concluded in four use cases: Installation, Turn on Rasplapse (the fancy name of our app ? ), User let Rasplapse create a Timelapse, and Name and save the video with Rasplapse. In all the cases the actor is the user of the app.

The first is pretty obvious: the user would need to download the Pi4J library, and downlaod the Rasplapse software. The second one enables the user to connect his/her Raspberry Pi to a power source (to turn it on, of course) and then click on the Rasplapse symbol in the desktop to open the program.

The other couple of use cases are more complicated that the last two, since they describe the behavior of the app and its functionality. The third one is the use case where the user name and select the directory where the video is going to be saved.

Finally there’s the action of letting Rasplapse to create a Timelapse: the user is asked for a duration and a photo-rate for the app to take the pictures in that range. After that, the camera takes a few seconds, and then starts to take photos in the photo-rate and duration specified. After this time range is finished, the user can find the video in the directory selected previously.

Our project is in the right path since we’ve bought the engines that are going to move the camera, and we are in the process of testing the code.

 


UseCases: Answers to the project questions

The silliest project ever (and for silly I mean tremendously difficult!)

--Originally published at richardctc201

This week I finally finished #wsq09 “Movies”. I worked in this task for over two weeks; I spent nights in front of my laptop; I couldn’t slept because this task tormented me, but at last I beat one of the most difficult tasks of my life! Here is the description of my experience doing this incredibly, extremely, tremendously, awfully difficult wsq09.

The instructions for this task were: create a program that read a file, outside the program of course, with the names of some actors and movies where they have appeared. You should record this information wherever you want, and ask the user for an input: if the user write two movies separated by either “|”, “&” or “^”, the program should output the actors of the movies the user wrote with their respective restriction. “|” stands for all the actors that appeared in each movie (logic gate OR); “&” stands for all the actors that appeared in both movies (logic gate AND); and “^” stands for all the actors that appeared in one of the movies, but not both (logic gate XOR). Finally there was another option: the user could write the name of an actor and the program should find all the actors with whom he/she has acted in any movie.

The chosen tool or what I called it, the ‘designed hitter’ tool I used was a HashMap. This tool works as a Python’s dictorionary, where you have a key and a set of values of that key. There was only one important problem with the HashMap, the program couldn’t have access to the HashMap once running, in other words, I couldn’t read the HashMap line by line just like an ArrayList or any other similar tool. Once the HashMap was created by reading the file, an ArrayList of every key with their respective values was created too. Now with the movies and their respective actors arranged, an inputBox was shown so the user could wrote whichever option he/she wants and the output would be the actors with the selected restriction.

Another important aspect of my code is the use of an Iterator for displaying the actors in the option ‘b’ where the user simply write the name of an actor, and the program should return all the actors whom he/she has appeared with. The Iterator is an object that works when calling the method ‘iterator ()’. This object enables you to cycle through a collection of data, helping to obtain or remove elements. I used the Iterator to search for the name of the actor, and collect all other actors that appeared in the same list.

Here I leave the link to my Github repository where my classmates can see my code.

Hope that I help someone because this task is tremendously hard!

https://github.com/RichardCT/Movies/tree/master/Movies/src

The silliest project ever (and for silly I mean tremendously difficult!)


The silliest project ever (and for silly I mean tremendously difficult!)

Gunning down 195 numbers

--Originally published at richardctc201

Finally I got to the final task of the first partial: the 196 activity. This activity consisted in creating a program to find possible Lychrel numbers in a specific range of data. Lychrel numbers are natural numbers that do not form palindromes after adding their inverse several times.

As usual, I asked for help to my new best friend Alex, and here is what he did: obviously (like in every previous programs) I created two classes, the main class and an additional class called ‘Range’. In my main class, I used a new thing (well, new for me) called JOptionPane to collect inputs given by the user. I had two of this so that the user could enter the lower and the upper limits of the range of numbers. In Range, I defined 5 variables: low, high, natural=0, non=0, and yes=0. I also created two methods: the first one called ‘rango’ (I’m Mexican so don’t nag me) that has two parameters a and b where a is defined as the lower bound, and b as the upper bound; the second one was the method where all the math calculations were made, this one was called ‘types’.

In main, I created one new object, and called method rango for it, passing the two inputs provided by the user as parameters.  In types, I defines two variables (both strings): palin, and palinInverse, both variables were empty. I also defines 4 varibales as long: p1, p2, suma, and n. Finally I created a For loop with the condition that x=lower bound, and it iterate until x=upperbound. In the for loop, I made three conditions: one if that add one to my variable ‘natural’ if the number was a natural palindrome; another for loop to iterate thirty times to find Lychrel candidates, if there were palindromes in the way, it add one to ‘non’, and if not, it print an “Alert message” and add one to ‘yes’ meaning that it had found a Lychrel candidate.

I had a little problem with this code because first I defined my variables as float, but after just 10 iterations the numbers were incredibly huge, and the float variables couldn’t support it. So I had to change my variables to long, and then the program could successfully run.

Here I leave screens of my program in Github:

Gunning down 195 numbers

Gunning down 195 numbers


Gunning down 195 numbers

Babylonian Territory

--Originally published at richardctc201

Down in Babylonian Territory, I successfully implemented the Babylonian Method to find the square root of a number. Again, I received help from Alex ( the same guy I talked about in my most recent post).

The structure of this program is very similar from the GCD because this one also has two classes: the main class and a ‘Number’ class. In the number class, again, there are two methods: one called ‘setValue’, that assign a value to the objects created in the main class; and another called ‘squareRoot’, in this one there are performed the mathematical calculations. In the main class, there are created two objetcs: val1 and val2. Then it is called the method squareRoot for val1, passing as parameter val2. In this method, there are four variables declared: a, b, div, and ave. Variable a is assigned the value of val1, and b is the parameter. Then there is a for iteration to perform the process of the Babylonian method three times. The variable div gets the value of a/b, and ave gets the value of the average of b and div. Finally b gets the value of ave to perform the next iteration.

I tried the code assigning a the value 7, and b the value 4, and the output I get was 2.6457672, a very accurate square root of number 7.

The reasoning for doing this code was based in this link.

Here I also leave the link and screens of my GitHub account where you can see my code. Greetings from the Babylonian Territory!

Babylonian Territory

Babylonian Territory


Babylonian Territory

Eclipse

--Originally published at richardctc201

Today I downloaded Eclipse in my machine; it wasn’t difficult because in the past I had downloaded Netbeans IDE that required the installation of a JDK (Java Development Kit) so there was no problem installing and launching this new IDE. As our teacher told us, Eclipse is a monster, a real player in the coding area that’s why I’m really excited of testing this new toy…. I really have a lot of expectations due to my teammates and I are cooking the best project ever made by Tec Students!

Eclipse
Google image by divine chancellor http://img05.deviantart.net/a371/i/2009/020/a/d/eclipse_by_divinechancellor.png shared under Reuse License Terms.

 


Eclipse