[][1]
Hello world,
I'm pretty new with programming and i am making a sort of sports odds program with API in Python i want to specify the 'price' value of every 'home team', away team and 'draw' price and store it in a variable. Since 'home team' is already specified for every game i'd want it to give me the corresponding 'price' value for every game so that i can use the price for further calculations.
Does it make sense?
How can i do this?
Picture[1]: https://i.stack.imgur.com/vmCfN.jpg
Related
I'm working on a watch face for Wear OS based on this example: https://github.com/android/wear-os-samples/tree/main/WatchFaceKotlin.
Samsung Heart Rate complication has a MONOCHROMATIC_IMAGE type and it doesn't provide heart rate value.
I already know how to get this value form SHealth. I'd like to change this complication type to SHORT_TEXT and set HR value programmatically.
Is it possible?
Also I know how to make my own complication data provider, but it's a separate service that appears in the list of all available complication providers.
Yes. Modify the type of complications in ComplicationUtils.kt.
Note:The top type which you declare is the top preference. You want SHORT_TEXT, put the SHORT_TEXT on the top of the list
https://github.com/android/wear-os-samples/blob/a49c45cecd01d169f7e863b3f99f2f74aea02fec/WatchFaceKotlin/app/src/main/java/com/example/android/wearable/alpha/utils/ComplicationUtils.kt#L56-L64
object Left : ComplicationConfig(
LEFT_COMPLICATION_ID,
listOf(
ComplicationType.RANGED_VALUE,
ComplicationType.MONOCHROMATIC_IMAGE,
ComplicationType.SHORT_TEXT,
ComplicationType.SMALL_IMAGE
)
)
I wanted to know how to make a scoreboard That Knows What Cordinates You are at,
and one that I can actually make text in, because I can put text, but only numbers for the answer.
Is is something like...
''
/scoreboard players add {text} {name} {score}
''?
P.S., I tried /scoreboard players add {text} {name} {score}, but when I do it, it does not allow me to put text in for the score.
If I was able to do that, I would create that, but, Another thing...
Am i able to create one with animated text in vanilla Minecraft?
Scoreboards can only hold short integer values. The name of the value (key, property, entry, objective or whatever you want to call it) however is a String, with not too many limitaitons. For display purposes generally this is used - you might have seen scoreboards on some servers where the left side had the information as text and the right side consisted of numbers 1-10.
Unfortunately, it is not possible to dynamically create scoreboard entries via commands or command blocks. You have to use plugins or datapacks for that. (I'm unsure whether this is doable with datapacks, but you should be able to research that on your own). While plugins are not considered vanilla, datapacks are a part of the minecraft environment.
For more information about scoreboards you can read https://minecraft.gamepedia.com/Scoreboard.
if you want to create a scoreboard, use scoreboard objectives add <name> <type> <display JSON (optional)>
your current command, scoreboard players add is used for adding values to one's score.
there is a score json component, which you can use in the display name creating an objective, but that is about as dynamic scoreboard names get.
this might not be what you want, but you can get a players coordinates in a scoreboard. here are some commands to do so:
run the following command once:
scoreboard objectives add pos dummy // creates scoreboard only modifiable with commands (dummy)
run the commands after this repeating, in a repeating command block or your tick function, if you are using datapacks.
execute as <player> store result score x pos run data get entity #s Pos[0]
execute as <player> store result score y pos run data get entity #s Pos[1]
execute as <player> store result score z pos run data get entity #s Pos[2]
these command store the player's various position data into a score, which you will then be able to see on the scoreboard, which can be displayed with scoreboard objectives setdisplay sidebar pos
let me know if you have more questions. note the solution i provided only works for one player, for others it is a little more complicated.
Following is a Node we having in DB
P:Person { name:"xxx", skill:"Java" }
and after awhile, we would like to change the Skill to skill array, is it possible?
P:Person { name:"xxx", skill:["Java", "Javascript"] }
Which Cypher query should I use?
If you have a single skill value in skill, then just do
MATCH (p:Person)
WHERE HAS (p.skill)
SET p.skill=[p.skill]
If there are multiple values you need to convert to an array such as P:Person { name:"xxx", skill:"Java","JavaScript" } then this should work:
MATCH (p:P)
SET p.skill= split(p.skill,",")
In fact, I think your real problem here is not how to get an array property in a node, but how to store it. Your data model is wrong in my opinion, storign data as array in neo4j is not common, since you have relations to store multiple skills (in your example).
How to create your data model
With your question, I can already see that you have one User, and one User can have 1..n skills.
I guess that one day (maybe tomorrow) you will need to know which users are able to use Java, C++, PHP, and every othre skills.
So, Here you can already see that every skill should have its own node.
What is the correct model in this case?
I think that, still with only what you said in question, you should have something like this:
(:Person{name:"Foo"})-[:KNOWS]->(:Skill{name:"Bar"})
using such a data model, you can get every Skill known by a Person using this query:
MATCH (:Person{name:"Foo"})-[:KNOWS]->(skill:Skill)
RETURN skill //or skill.name if you just want the name
and you can also get every Person who knows a Skill using this:
MATCH (:Skill{name:"Bar"})<-[:KNOWS]-(person)
RETURN person //Or person.name if you just want the name
Keep in mind
Storing array values in properties should be the last option when you are using neo4j.
If a property can be found in multiple nodes, having the same value, you can create a node to store it, then you will be able to link it the other nodes using relations, and finding every node having the property X = Y will be easier.
I'm new to objective-C, having a programming background mainly in C++, and believe this to be an easy question although I can't find the answer to what I'm looking for. I'm using Xcode 6 as of now.
I have an entity "Song" in which I have various attributes, "Description", "Tempo", etc. My tempo attribute, for example, is limited to integers, and I want to be able to manipulate any/all of those tempo values for each Song at a given time. Upon a dedicated button click, I want to either edit the values or put all of the values in an array (array[0] = Song 1 Tempo, array[1] = Song 2 Tempo, etc), so mainly I need to get those individual values into variables, or so I think.
I feel as though my limited knowledge of attributes and entities is preventing me from being able to connect the bridge between them and variables, the latter of which I'm used to working with in C++, of course. Any suggestions or tips would be much appreciated, thanks in advance!
Pat
Your attribute will return collection type object like dictionary or array. So you can iterate your attributes values and just add in NSMutableArray.
The new Google Drive Android API has 2 types of string IDs available, the 'resource' ID and the 'encoded' ID.
'encoded' id from DriveId.encodeToString()
"DriveId:CAESHDBCMW1RVVcyYUZKZmRhakIzMDBVbXMYjAUgssy8yYFRTTNKRU55"
'resource' id from DriveId.getResourceId()
"UW2aFJfdajB3M3JENy00Ums0B1mQ"
In the process I end-up with a string that can contain any one of them (result of some timing issues). My question is:
If I need to 'parse' the string in order to identify the type, is there a characteristic I can rely on? For instance:
'encoded' id will always start with 'DriveId:' substring
'resource' id will have some length limit
can I abuse error return from 'decodeFromString()'?
or should I form (pre-pend) the string container with my own tag? What could be the minimal 'safe' tag (i.e. what will never appear in the beginning of these ids) ?
Please point me in the right direction so I don't have to re-do it with the next release.
I have run into yet another issue that should be mentioned here so others don't waste time falling into the same pit. The 'resourceID' can be ported and will remain unique for the object it identifies, where 'encodedID' has only 'device' scope. Means that you CAN'T transfer 'encodedID' to another device (with the same account) and try to retrieve file/folder with it. So I assume it is unique to a Google Play Services instance.
Please do not rely on any formatting of either ID type. This are subject to change without notice.
If you need to use both, and track the differences between them you should have your own method of doing so within your app.
Really, you should probably always just store the encoded ID since this one is always guaranteed to present, and if it contains a resourceId, its easy to get back out.