FM radios (eg in the cars) show the name of songs actually played. So the car radio needs to get song's name from somewhere. Is there a way to get this data into database? Just asking generally cause I was thinking how to get this data (Radio Station's name, the name of song). What should I use to do it?
That's the Radio Data System (RDS). Yes, you can get that information, if you have a receiver that pushes the "raw" signal as it comes through the air into your PC. You would then be doing Software Defined Radio (SDR).
It's not costly to get such a receiver, and Bastian Blössl has continued work on a decoder and transmitter, gr-rds based on GNU Radio, an SDR processing framework. Great fun!
Related
This is my first take on a state machine and got a bit confused about the possible states that i can define while implementing the subject matter.
P.s. (this question is about how to infer states from a problem and not about how to actually implementing it in code. I know and have used xstate lib).
Scenario is simple, a password field with few validation rules.
The states i came up with are
default ( when the form loads or reset button is pressed)
filled ( should this even be a state ?)
valid ( date is present with all rules satisfied)
invalid (data is there but not meeting the rules )
Error message is displayed based on the current state.
For example, in default state, user didn't enter any data yet, so logical it is invalid state.
But we do not want to show errors to the user right away after opening the form (that will be horrible ux, right ?)
So I added a state specifically for that purpose.
Is this right?
Can it be further simplied or is there a state i am missing?
Secondly, there seems to be arbitrary states
Like
validating
submitting
Should these also be in the mix of states?
They look like states to me though.
Lastly, can we say
submitted is also a state ?
invalid after submitted due to error in API call ( maybe API team added a new rule we didn't know).
Million dollar questions are,
am i even thinking in the right direction to implement validation this way?
is there any state i am missing or overdoing?
You've probably already solved this, but just in case somebody else comes across this question and could use some pointers - I found the trick was to keep in mind that even simple elements have often multiple states in parallel, e.g. a button can be disabled and show a loading spinner at the same time, a menu can be open and fetching data, an avatar can be showing a placeholder and fetching an image at the same time etc.
for your example I'd look at it like this:
Field level
If you think in terms of a password field, it actually has multiple parallel states at the same time:
Interaction
Validity
Visibility
All three states exist at the same time and have multiple child states
Interaction
this should probably mirror the default input events and have matching state events (e.g. onChange -> set to changed):
blurred
focussed
changed
...
Validity
probably just two states, potentially three if you need asynchronous validation (e.g. if you need to check if an email already exists). For a password field you'd just use:
valid
invalid
validating (optional)
Visibility
straight forward:
visible
hidden
Form level
You probably end up with two main states with multiple child states:
form
error
Form
Idle
Editing
Validating
Submitting
Error
That could translate into an alert which you show when e.g. an account already exists or the login details can't be verified:
Inactive
Active
Your form state machine would basically handle the input, validation, submission, and form errors, and just communicate the state to individual field machines (field error messages etc). Alternatively, you could pass the validation rules to the field machines and they can execute the field-level validation on i.e. change events. Things like visibility have nothing to do with the form, so you'd manage the state in the field state machine.
I think you were on the right track, you were just thinking a bit too sequential and not considering parallel states. It's just a matter of taking a step back, looking at the form and thinking about everything that can change in it from a UI point of view.
I want to create a simple skill which uses alexa's voice to text translation and then passes the text to a different service.
This seems close to what i am looking for: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference,
but nowhere in the example request/response does it have the text form of the users request to alexa. Has someone managed to extract the text data of user voice commands, would be very helpful for me.
It is not easy, unfortunately and by design.
User responses are stored in word 'slots' in the interaction model. This is how Alexa parses speech and execute commands based on user utterances. Without knowing every variation of a possible word slot and writing this into your interaction model, you won't be able to store free form text in a variable and 'pass it on'.
It's not possible. The closest you can get there is by using the built-in slot type AMAZON.Literal (US only and deprecated) or AMAZON.SearchQuery (available in all locales). I say "closest" because SearchQuery for example requires a carrier phrase in the utterance besides the slot (it can't be there alone capturing everything).
Note that the free form capture provided by these types is less accurate than if you define a custom slot type (i.e. you know more or less what you want to capture)
In Django, I need to represent payment details for a client. These payment details depend on which country the client is in. For example, US has a Routing Number and Account Number while Canada has Institution, Transit, Account Numbers and anything European has IBAN and BIC.
I think data like this is exactly what JSON storage is made for so I used PostgreSQL's JSONField.
class Client(models.Model):
country = CountryField(blank=True)
payment_details = JSONField()
After some time, I figured the best place to populate the JSONField with a schema appropriate for the country is in the frontend, because in the backend, I would have to wait for the model to be saved first, which is silly from the user's perspective.
Here's the problem: I have to fill the JSONField with something like this:
{
"IFSC Number": "FDSAFDSA",
"Whatever Number": "12410202"
}
Right now I have the backend checking to see if the country changed, and then changing the schema in the JSONField accordingly. But this means that whenever someone changes the country, they have to first save the model before they can add their payment details!
So this has to be done in the frontend, but I don't know how. I'd have to do this in Django's admin pages, and also the actual end-user facing frontend! The end-user facing frontend might just be some jQuery, but I'm unfamiliar with overriding Django admin templates.
Not only that, if I add a new blank schema for some other country:
{
"Banking Number 1": "",
"Banking Code whatever"
}
I'll have to modify two things now, which is a sign that this isn't the right way to do things.
I was surfing gaana.com music website that has also released its developer version api.gaana.com. The documentation of api is here http://developer.gaana.com/resources/meta-data-api/tracks/
I wish to query the database but i am struggling with the syntax and I am unable to follow the documentation guidelines. try and retry got me a Json result but I dont know how to put conditions.
Example, I want to search the database for all tracks where the artist name is "kishor kumar" and the rating/popularity of the track is 10. I tried the below url but it does not satisfy the artist name. Can someone help me how to use this api?
http://api.gaana.com?type=song&subtype=most_popular&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON&order=alltime&language=hindi
In the Search API(Search Song) you can see,
APIURL/?type=search&subtype=search_song&key=disco deewane
Just replace disco deewane with kishore kumar.
For example, http://api.gaana.com/?type=search&subtype=search_song&key=kishore%20kumar&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON&order=alltime&language=hindi
There are 6486 tracks listed.
I am trying the post an invoice to SAP using the F-47 transaction and using SHDB to record the transaction and learn how it works. I see there that sometimes BU and ZK BDC OK codes are used. I would like to understand the difference between them, but could not find any official documentation. Please, explain the difference between the two?
I found the meaning of some of the status codes. I post it here, so I can remember:
/00. Enter
/AB Go to overview
=ZK Go to additional information
=ENTE Enter (don't know exactly what is difference between /00)
=PI select cursor location
=STER Go to taxes
=DELZ delete cursor
=GO continue
=BU post (save)
/EEND end processing
=Yes select "yes" from message box
=BP park (save)
=ENTR Enter (don't know exactly what is difference between =ENTE or /00)
=AE save when changing document
=BK change document header (parking or posting parked document)
=P+ next page
=BL delete parked document
A BDC_OKCODE indicates which action is (will) be executed on a screen (things like save, back, exit etc). The BU code is used for a SAVE function (like in MM01 transaction). Sorry but I cannot recall to which function ZK maps to. Obviously their difference lies in the fact that they map to different functions. You can still find out which function each button utilizes by using System->Status->GUI status.
By the way, BTCI transactions are not fully robust- minor changes in GUI flow let your program break. Error handling / analysis is tedious.... DId you have a look to posting methods more preferably? E.g. like BAPI_* function modules? With the help of LSMW you can browse for different input methods and use them later standalone. Or you can use transaction BAPI directly.