I'd like to construct an app which lets you search for players in various online databases and which will display the content in webviewer.
While its easy with some services (since the target-url basically is url/nickname), with some services i need the app to enter the nickname in the search field and search for it.
As I was searching for answers I found the following topic
XML-RPC HTTP request with App Inventor?
I'm not quite sure whether this is what I've been searching for, still I'd love to experiment with Web1.PostText and Web1.RequestHeaders, but I cannot find these blocks in App Inventor 2.
take a look at the App Inventor documentation of the web component
RequestHeaders
The request headers, as a list of two-element sublists. The first element of each sublist represents the request header field name. The second element of each sublist represents the request header field values, either a single value or a list containing multiple values.
PostText(text text)
Performs an HTTP POST request using the Url property and the specified text.
The characters of the text are encoded using UTF-8 encoding.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. The responseFileName property can be used to specify the name of the file.
If the SaveResponse property is false, the GotText event will be triggered.
Related
I am trying to build an android app that the user can enter a string, and a list emoji related to that string would show up. (Just like Venmo app) For example:
case 1: User enters "pizz", and in the list there would be "π", note that the users enter "pizz", not pizza!
case 2: User enters "rabb", and in the list there would be "π" and "π°", note that the users enter "rabb", not rabbit!
What would be a good data structure and algorithm for this problem?
A trie is what your looking for. From Wikipedia
A trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is a kind of search treeβan ordered tree data structure ...
A trie is similar to a HashMap<K,V>, you can perform a lookup with keys and get a value. The difference is that you can also search by prefix. Given a prefix, it will find all the key-value pairs in the structure that have that prefix. It's basically the data structure for generating search suggestions.
General Idea:
Trie<String, String> t = new Trie<String, String>();
t.insert("pizza", "π");
t.insert("rabbit1", "π");
t.insert("rabbit2", "π°");
// then later...
t.findByPrefix("rabb"); // [π,π°]
Unfortunately, tries are too generic and are not present in any popular data structure libraries (like Java Collections Framework or Google Guava, for example). You'd have to implement one yourself or find an existing implementation and modify it.
I'd recommend:
Learning the theory. Watch this video. There are many more on YouTube that will teach you the basics. You can also search google for "N-way trie" and read notes about it.
Taking this class TrieST and modifying it. It's very similar (or already perfect) for what you need: http://algs4.cs.princeton.edu/52trie/TrieST.java.html see specifically thekeysWithPrefix method.
I am trying to do a simple Youtube Subcriber app.
When i try to send the user id , the returned result doesn't match the order i sent .
This is the api i am using
https://www.googleapis.com/youtube/v3/channels?part=statistics,brandingSettings,snippet&key=XXXXXXXXXXXXXXX&id=UCqIqRzEge-Qvt4Iglx-uKdQ,UC6bA7BuUmGKPIS3wW2voNxg,UC9JgYaC76Q_eSgYM01S5J_w,UCgefQJC5UgbWJHDxBqB4qVg,UCddiUEpeqJcYeBxX1IVBKvQ,UCOmcA3f_RrH6b9NmcNa4tdg
For example , i sent the data in this order
The Verge
Cnet
BfvsGf
The data returns :
BfvsGf
TheVerge
Cnet
It's not in order at all. Please advice.
Use Search:list, it returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, [channel](https://developers.google.com/youtube/v3/docs/channels) and playlist resources but you ca also configure queries to only retrieve a specific type of resource.
HTTP request
GET https://www.googleapis.com/youtube/v3/search
include the order parameter, the parameter specifies the method that will be used to order resources in the API response.
You can sort list by descending order, sort from highest to lowest rating or sorted by alphabetically. The acceptable values are: date, rating, relevance, title, videoCount, viewCount. The 'order' parameter will sort results based on when the resources were created.
So I am currently making an app to work with and learn more about JSON (using GSON) and decided to go with a reddit browsing app. I am currently able to get the JSON data by using "http://www.reddit.com/.json" and this will get me the JSON for the first 25 posts. I am trying to get the information for the next posts by using
"http://www.reddit.com/.json?count=25&after=" + name_of_last_post
which name_of_last_post is the name field from my GSON for the last post. This however just brings up the first page's posts again with their numbering starting at 25, I get that the numbering starts at 25 because count is set to 25. What I am asking is what is the format of the string I can create to get that next set of JSON items. you can try this your self by going to reddit.com/.json and taking that into a json editor and formatting it nicely than going to the next page of reddit and adding .json before the ?count=25&after=, you will see that the text following after= does not seem to appear on the first JSON file anywhere. If there are any parts of this question that are still unclear please leave a comment and I will check in on it later. Thanks and have a great day.
There are a couple of fields that you can use in order to fetch the next page on JSON.
You could either retrieve the 'name' of the last post, or instead of parsing the whole block, you can retrieve the last couple of fields from the JSON that reddit gives you. There are a couple of fields that you can easily use to navigate pages forwards and backwards, they're conveniently called 'after' and 'before'
Having that value, you can mount your URL with it, which in this case is http://www.reddit.com/.json?count=25&after=t3_3gi42o
This will get you a new JSON, with different 'after' and 'before' fields, pictured below:
I am trying to make a performance testing process by using the Jmeter for the mobile chat application. The scenario i am trying is,need to analyze the output during the N number of new user registration process.I am feeding the N user data through "CSV Data Set Config".In that mentioned the variable names as "phone,ime".
For each new user registration process,the application will generate the one time password when calling the API1.The question is,I need to get that generated one time password from the API1 response message for each phone user and need to assign the value to the variable ${code} when calling the API2.
The below are the API & parameters details:
API1:/api/users/registration-sms.html?
1) Name:phone, Value: ${phone}
2) Name:ime, Value: ${ime}
Example :
Request - POST data: phone=917010370002 & ime=e78b56418b55b32c
Response:{"response":{"httpCode":200,"Message":"True","Code":"5858"}}
API2: /api/users/registration-sms-verfy.html?
1) Name:phone, Value:${phone}
2) Name:code, Value:${code}
Note : For this variable ${code},We need to get the data from the API1("Code":"5858") response message for the respective phone(917010370002).
Please provide me the feasible solution to sort out of my requirement.
Thanks in advance.
You can use Regular extractor post processor like,
Assuming your response is like
{"response":{"httpCode":200,"Message":"True","Code":"5858"}}
your regular expression will be like to extract code value but for specifiic phone no you need to modify it a little bit,
"Code"\:"(\d+)"
for occurance detail you can provide which match no. you want.
Refer Regular Expression Exctrator Post Processor
I have an application that read an online xml file, now i want to implement such functionality that when the user has clicked on item (read the item), it will marked as read. My problem is how to keep the old items' read status when I request again the new content from that xml file? and when I delete the item from xml file, it then will delete such item on the phone too when the user reload the content.
There's two ways to implement it:
Keep local database (with corresponding Content Provider) which would store read statuses. E.g. You could have table with two fields 'Record Id in online xml' - 'Read status'. Using this way, 'read' status will bee stored locally and on another client user would see items not marked as read;
Send server acknowledgement that the item has been read, so next request it won't be presented in the xml file (or xml file would provide it as 'read'). This way depends on the server implementation, but more convenient because 'read' status might be propagated along many clients;