Win a copy of Terraform in Action this week in the Cloud forum!

Derek Smiths

Ranch Hand
+ Follow
since Feb 19, 2014
Derek likes ...
Mac Eclipse IDE VI Editor
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
24
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Derek Smiths

Thank you guys for all of your help in fixing this problem. I did not mean to waste anybody's time and usually make complete posts -- finals week has gotten best of me.

Anyways, I've tested all the outputs (just as Tony mentioned) and the values are more or less correct (good enough for me), nevertheless, the instance values assigned to the variables inside the constructor should still be passed to the other class using a couple accessor methods (getElevation/getAzimuth). The getAzimuth data is working, but the elevation data is not.
6 years ago
Is there a reason that this is not working and is this just bad practice in general?
6 years ago
That is not the case. Yes, dcLat is a constant, but declination and hourAngle are continuously changing. All of the values are declared inside the constructor except for dcLat, elevation, and azimuth. This was all within a main method when I first wrote the program, but I was hoping to just be able to execute this sequence within the constructor.

public SolarTracker() throws IOException {
localTime = localTime.now();
int day = dayOfYear();
double equationOfTime = equationOfTime(day);
double lstm = localTimeMeridian();
double lst = localSolarTime(equationOfTime, dcLong, lstm);
double declination = declination(day);
double hourAngle = hourAngle(lst);
elevation = elevation(dcLat, declination, hourAngle);
double zenith = zenith(dcLat, declination, hourAngle);
azimuth = azimuth(dcLong, declination, zenith, hourAngle);

}
6 years ago
Yes, you are right. I don't understand why the constructor needs to impart any differences. The constructor includes both methods to execute and return their respective values. Then I use the instance variable to retrieve both those values. What am I missing? I don't understand why I can't assign the values within the constructor and then use the get methods...? Is the only way to create an two instances and then call each method (elevation and azimuth)?
6 years ago
My SolarTracker class is created to find the path of the Sun. It contains several methods some of which find the declination and hourangle. The two values that I need, the elevation and azimuth angles are both needed to display the path of the Sun on an XYChart. It was my impression that each time, even within a loop, an instantiation can be overwritten or assigned new values -- in this case elevation and azimuth. Each of the methods should produce new results since they involve a new instance in time. Inside the class constructor, the methods shown above will execute and produce new results assigning those return values to the variables you see above. After the new instance, I use two get methods to retrieve those values to be displayed as x and y values in my chart. Hopefully this is a little more clear -- me being lazy. :/
This code exist within a listener event:
6 years ago
I have several methods that all return the desired value. They all produce the correct results. It is just a matter of passing that information to my JavaFX program to use the data to graph it. My question is why doesn't the new instance of the value assign new values to the elevation and azimuth variables, so that each time I call the get methods I will have a new variable to display on my graph. Shouldn't each iteration of solarData = new SolarTracker() create a new instance of data?
6 years ago
Alright, I have a JavaFX gui that is creating a new instance of data calculation to graph in a chart; however, the data is not updating each time the Platform.runLater() feature executes. Each time an event occurs, a new instance with the same variable name occurs. I use to get methods to retrieve the data I want, so shouldn't the values update each time the new instance is created?
This is a very condensed version of what happens with the event, but this is what is not working correctly.

Event:

Class constructor :
6 years ago
Thank you Stephan, that source makes it much, much clearer the purpose of the stack for this operation. Great resource. Clearly I was way off, on how to use this. I'll update this code shortly.
6 years ago
A String variable references a mathematical equation. Within a method called convertToPostFix(String s), I am analyzing each character in the equation as follows:

Within this method, I loop through the entire string and push digits to the stack until an operator is found, if no operator is currently in the stack, push(operator). If a right parenth is found, pop all the elements in the stack to an output string. Alternatively, if an operator is found to exist in the stack already, I check the stack precedence with the following method:


I'm really not sure if I'm doing this correctly, or if I am way off. My output is incorrect and looks something like this : (1053
Is this the correct use of the stack?

6 years ago
So, in order to use RAF effectively, you must know what type of file information you are dealing with, in order to rw? This doesn't seem like a very sophisticated class to use since you must know exactly where and what you are looking for in order to locate any data.
What if the student ID's are not all of the same length? Thanks Campbell.
6 years ago
@Paul, to clarify my code, I am designing a program that will display a graph to continuously update the path of the sun throughout the day and will display it on an FX chart. I have a program that is attached to my arduino that has solar panel data passing (serial connection) to my FX program. The specific method above is to increase the accuracy of the solar position within the local time meridian for the specific region. This website might fill you in, IF you are interested: http://www.pveducation.org/pvcdrom/properties-of-sunlight/solar-time

The ltm value is derived from this method.I know getRawOffset() produces a value in microseconds so, I've converted to hours. I would imagine this is all overkill and I could just define this as a constant, but thought I would give it a go.

6 years ago
I am creating a read/write, RandomAccessFile that I will use to store several student ID and gpa score. What I don't understand is how I should go about retrieving a particular set of data.

6 years ago
Thank you guys for your replies -- that fixed the problem. Now, I'm trying to get the local solar time which is defined as the highest point of the sun locally. double lst = LT + tc/60 LT is the local time. Is there a good way to calculate this, or is there a way to get the local time in minutes?

6 years ago
I'm trying to calculate a certain value, but it is returning 0 and I'm not sure why. This is a measurement to define the angle from the equator and the center of the sun

6 years ago
I have a text file which contains to integer values I need to retrieve for each item (total of 56 items in the file). One is an item number, the other the weight ("Item: " + number + "Weight: " + weight). I am trying to build an array list that will add each set of data to it. I know that when I add the item array to the arraylist it is storing the array variable and not its contents, so is there a way to easily copy that data array to the array list?

6 years ago