Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am working with delphi.How do i get the total number of elements in a stack and retain the stack after the process.I am aware that this can also be achived by creating a temporary stack and copying the original stack to the new one (temp),so as to then pop the elements from the temp while counting, but i am not allowed to use this formular. Can somebody help me with an algorthm that achieves my task please!
If you are using the generic TStack collection class in Delphi XE4 then the number of elements currently in the stack is already exposed directly via the Count property:
var
myStack: TStack<Integer>;
begin
myStack := TStack<Integer>.Create;
myStack.Push(42);
ShowMessageFmt('Stack contains %d elements', [myStack.Count]);
myStack.Free;
end;
However, since you presumably have not found this property then it is possible you are using some other stack implementation.
Determining how best to access the same information about the stack from the implementation you are using is impossible without further details about that particular implementation.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Basically, I have two points, A and B that are 10 miles apart if you drive. I draw a route using driving directions between them using MapKit.
I want to find point C's latitude and longitude, which is at the point on the route 2 miles from point A. This could also work based on a percentage(ex: 20% of the route is completed between point A and B).
Hopefully, this image can explain better then I can.
Does anyone have any idea on how to do this using Swift and MapKit?
Thanks!
You may want to check out the MKRoute response you receive from the MKDirections.
An MKRoute object defines the geometry for the route—that is, it contains line segments associated with specific map coordinates.
You will find the documentation for MKRoute here:
https://developer.apple.com/documentation/mapkit/mkroute
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
cat_poop = 12
> 12
if i rebind cat_poop to a new value forexample:
cat_poop = 20
> 20
So how do i get the first value of cat_poop after a rebind
You cannot get the previous value after an Elixir variable is rebound.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
ROM is implemented by case statement to store fixed values in it and read them whenever we need.
But how can I read two values at the same clock cycle ??
It is always useful to show at least part of your code. I assume you have something like this:
case (adrs)
8'h00 : dout <= 8h01;
8'h01 : dout <= 8h03;
8'h02 : dout <= 8h07;
The only solution is to make two identical case statements but it is easier to instance the same ROM twice.
Alternative is to make a memory and initialise it.
reg [7:0] mem [0:255];
... // initialise memory e.g
... // using initial with for loop and case statement
always #(posedge clk)
begin
dout1< = mem[adrs1];
dout2< = mem[adrs2];
end
I assume this is for an FPGA so look at the vendor manual how to make a pre-loaded RAM. (Which is on fact a ROM as long as you don't write to it)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is there a way in rails via some mapping API/gem where I can define map areas/map zones (with polygon bounds) and detect if an address falls within a particular zone/area.
This is easily done with geokit.
First construct a polygon from LatLng:
polygon = Geokit::Polygon.new([
Geokit::LatLng.new(0,0),
Geokit::LatLng.new(10,0),
Geokit::LatLng.new(10,10),
Geokit::LatLng.new(20,10),
Geokit::LatLng.new(20,0),
Geokit::LatLng.new(30,0),
Geokit::LatLng.new(30,20),
Geokit::LatLng.new(0,20)
])
Then you can test if the polygon contains a LatLng:
point = Geokit::LatLng.new(5,5)
polygon.contains?(point) # => true
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a problem:
My app allow user choose 2 options : Metric or Imperial.
If user select "Metric", height(cm), weight(kg).
If Select "Imperial: height(inch) and weight (lbs).
I need to change value of height from inch to centimeter and weight from lbs to kg.
Example :
user input : 70 (inch) and 120 (lbs) ==> convert to 177.8 (cm) and 54.5 (kg)
Thanks in advance.
The best example of unit convert is below link..