This website, http://www.ukgoldrefiners.co.uk/ under the top right window "HOW MUCH IS GOLD WORTH?" there are three sliders that estimate what the current gold price is. Its obvious it uses a formula that multiplies the weight of gold by the current gold price (taken from and external source) of the various carats.
If I manipulate this for my own project :-
I have three or more sliders and I can select a value between 1 to 100 and the live number is an average of all the numbers on the slider. e.g
Rating 1: 1-------|--100 (70)
Rating 2: 1-------|--100 (70)
Rating 3: 1-------|--100 (70)
So the average would be 70 and if I manipulate the slider it would change the average number.
My question would be what would this be called? What would I use to make this, JQuery, Java, HTML? Is there any resources?
Click here for an excellent jQuery slider. I've used it before and it includes lots of functionality for event functions such as change which you can use to do your calculation.
Your html would look something like:
<div id="slider1"></div>
<div id="slider2"></div>
<div id="slider3"></div>
<div id="average"></div>
And you would initialize each of the slider div's with something like this:
$("#slider?").slider({
change: function(event, ui) {
//average out the values of all 3 and set the value of 'average' to the averages.
}
});
Related
I am new to Google Earth Engine and have started playing with mathematically combining different bands to define new index. The problem I am having is the visualisation of the new index - I need to define the max and min parameter when adding it to the map, and I am having troubles understanding what these two end points should be. So here come my two questions:
Is it possible to get the matrix of my image in terms of pixel values? Then I could easily see from what values they range and hence could define min and max!
What values are taken in different bands? Is it from 0 to 1 and measures intensity at given wavelength, or is it something else?
Any help would be much appreciated, many thanks in advance!
Is it possible to get the matrix of my image in terms of pixel values? Then I could easily see from what values they range and hence could define min and max!
If this is what you want to do, there's a built in way to do it. Go to the layer list, click on the gear for the layer, and in the “Range” section, pick one of the “Stretch:” options from the menu, then click “Apply”. You can choose a range in standard deviations, or 100% (min and max).
You can then use the “Import” button to save these parameters as a value you can use in your script.
(All of this applies to the region of the image that's currently visible on screen — not the entire image.)
What values are taken in different bands? Is it from 0 to 1 and measures intensity at given wavelength, or is it something else?
This is entirely up to the individual dataset you are using; Earth Engine only knows about numbers stored in bands and not units of measure or spectra. There may be sufficient information in the dataset's description in the data catalog, or you may need to consult the original provider's documentation.
To simplify data entry in the field, i.e. using tablets, I would like to create buttons in a spread sheet that will add or subtract values to or from the selected cell. Using spin buttons is not an option, as I would have to add hundreds of these buttons. This answer shows exactly what I'm looking for, i.e. a single set of floating buttons that will move relative to the selected cell.
Unfortunately, VBA-macros will not run in an android environment, so I need to find a solution in a StarBasic based software, e.g. LibreOffice. I'm aware that questions related to porting VBA to SB are not very popular, but my programming experience is solely limited to R and I'm at a loss on how to solve this. I've boiled down the VBA-code to the bare essentials:
Sub Worksheet_SelectionChange(ByVal Target As Range)
With ActiveSheet.CommandButton
.Left = Target.Offset(, 2).Left
.Top = Target.Offset(0).Top
End With
End Sub
Sub CommandButton_Click()
ActiveCell.Value = ActiveCell.Value + 1
End Sub
Any help in porting, or creating a new SB-macro from scratch will be much (!) appreciated.
I still ask you to try the scrollbar again. Just please change your attitude to it - take it not as a control, in which you need to move the slider to the right and left, but as a set of four buttons. Don't move, just tap
In my example, the properties of the control "Large change" set to 10, this is the default. You can change this to 5.
My macro has Const MAX_STEP = 20. You can change this to 10.
And you get buttons to only having +/- 1, +/- 5 and +/- 10
If the size of the control is not large enough to get into the necessary parts with your finger, then change the oSBar.setSize() in the code to your liking. Or just increase the zoom of the leaf, as I did when I was recording the GIF.
Right now I'm generating geometric figures in processing for a sort of art narrative comic, but for the intro sequence I'd like to have the word, "scan." Repeat on screen until the whole screen is covered, each word touching end to end. If it could be initiated on click that'd be awesome.
I can get text to appear of course, but this kind of repetition isn't something I'm familiar with at all.
Let me know if you need me to post what I'm currently working with.
Thanks!
Step 1: Store the current state (where the next word should be drawn) in variables at the top of your sketch.
Step 2: Inside the draw() function, use those variables to draw one frame of your animation.
Step 3: Then just update the variables holding your state to point to the next place. Processing will call the draw() function 60 times per second, so this will create an animation.
Shameless self-promotion: I wrote a tutorial on animation in Processing available here.
The question is, is there a straightforward mechanistic way to know which stars (gold, 1/2 gold, grey) to draw without using conditional logic, for example using a pointer to the correct star based on the result of a simple math function to generate star ratings in a five star display.
The point of this question is not Ratings Systems, but graphic display
I have a rating value of 0-100, floating point.
For example, in pseudocode:
bitmap1="http://myserver.com/goldstar.png"
bitmap2="http://myserver.com/halfstar.png"
bitmap3="http://myserver.com/greystar.png"
rating=89.003
possible=100
quantized=int(rating/possible)
imagearray=[bitmap1,bitmap2,bitmap3]
for i=0 to 4
selector=<compute which star to draw based on available data>
drawstars(25*i,100,imagearray[selector])
end for
Hopefully that will give you an idea of what i'm trying to do.
Think of the display as a scale, but in integers, so work in half stars. For example, if we have 5 stars, and can display half stars, our real scale is from 0 to 10. So, what we need to do is divide the original scale (0 to 100) down to give us 0 to 10. Then we do integer division by 2. The quotient of that will give us the number of complete stars to draw, and the remainder the number (0 or 1) of half stars to draw.
You may want to do some rounding first though -- otherwise, a rating of 5 stars will be essentially impossible to get (e.g., even an input score of 99 will still only give 4.5 stars).
Hm, if I were to take a stab at it...
In the for loop, go from i=1 to 5.
if (rating > i*20){ draw a gold star }
else{
if (rating > (i-1)*20 +10) {draw a half star }
else {draw a grey star}
}
This of course would give you the floor rating
Input:
I have created and filled an array/table in velocity. This array currently contains 3 things:
(note that this example is pure fiction)
Top level community name (e.g. Stack Overflow USA, Stack Overflow BEL)
Subcommunity (e.g. stackOverflow.com/r/USA/CSS and stackOverflow.com/r/BEL/JSON)
Owner(s) of the subcommunity (e.g. Frank)
Depending on the situation and the point in time, the amount of top level communities, that have a variable number of subcommunities are each owned by a variable number of owners. And, each top level community can also have one or more owners.
(input) table example:
SO USA, , Phil
SO USA, CSS, Frank
SO USA, JSON, Marc
SO BEL, CSS, Marieke
SO BEL, CSS, Francis
SO BEL, JSON, Patrick
SO FRA, , Francois
output:
I now want to position these communities and sub communities graphically on a webpage like this
Depending on the amount of subcommunities, the top level community will have a different size, and should therefore be parsed where it fits best on the page (e.g on a 600pxx800px canvas).
Here are my questions:
does somebody know code that has already been written to solve this kind of problem?
if not, how would I best tackle this?