Limiting and handling errors in YQL RSS feednormalizer - rss

I'm using YQL to retrieve several RSS feeds (channels) at once, using the following query:
SELECT * FROM feednormalizer
WHERE output="rss_2.0"
AND url in ("http://rss.cnn.com/rss/edition.rss",
"http://bad.url.com/nothing",
"http://rss.cnn.com/rss/edition_space.rss")
so i actually have 2 questions:
How can i limit each feed to a certain amount of items? (for example, I want to get top 3 items from each channel)
Notice that the 2nd URL is invalid (not a URL of a real RSS). in that case, the YQL result returns 2 valid channels plus an error, but there is no indication of which URLs are valid and which one failed.
in other words - for each result feed, there is no indication from which URL it arrived.
any ideas as to how identify each channel?
thanks

1st question:
the first thought that comes to mind is using query.multi:
SELECT rss.channel.item FROM query.multi WHERE queries="
SELECT channel.item FROM feednormalizer WHERE output='rss_2.0' AND url = 'http://rss.cnn.com/rss/edition.rss' LIMIT 3;
SELECT channel.item FROM feednormalizer WHERE output='rss_2.0' AND url = 'http://rss.cnn.com/rss/edition_space.rss' LIMIT 3;"
Not the most elegant way but it works.
2nd question:
I don't think it is possible. As YQL's WHERE x IN ()... syntax is not really an SQL join, it is not possible to select parts of the inner subquery in the projection, what you would need for your case.
Would be happy if anybody would proove me wrong on this one, as I needed that a couple of times myself and always had to work around it programatically :)

Related

How to autocomplete only city(city-town-village)

Request 'https://places.cit.api.here.com/places/v1/autosuggest?app_code=[app_code]&app_id=[app_id]&at=0,0&q=budapesht' return the list of different places, but I need only places with category city-town-village. How to filter only cities?
If you use this query
https://places.cit.api.here.com/places/v1/autosuggest?at=47.4799441%2C18.9826451&q=town&result_types=category&app_id=[app_id]&app_code=[app_code]
you will only get back results of type "category" that start with "town". That's not what is being asked for.
You can set "result_types=address" so that you don't get back chain, category, or place results, but currently there's no way of filtering such that you only get city-town-village. You will also get administrative areas, streets, etc.
Please try use parameter result_types=category and q="townhalls" or "government-community-facility" in autocomplete suggestions API.
And the category "city-town-village" seems no longer valid.
https://places.cit.api.here.com/places/v1/autosuggest?at=47.4799441%2C18.9826451&q=town&result_types=category&app_id=[app_id]&app_code=[app_code]

Google Analytics API - filter dimension sourceMedium

I would like to filter certain sources and mediums (specifically email clients). I need to keep the dimension as one column (I use the maximum number of dimensions - 7).
The filter works fine when I have only one sourceMedium such as:
ga:sourceMedium!=amail.centrum.cz / referral
Filter doesn’t work at all when I use two sourceMedium:
ga:sourceMedium!=amail.centrum.cz / referral,ga:sourceMedium!=mail.google.com / referral
It doesn’t matter If I use AND / OR, the query doesn’t output the desired data.
I assume that there supposed to be some delimiter which could identify that amail.centrum.cz is one string which is delimited by another one. I already tried to use ' at the beginning and at the end of the string, but it seems that it doesn’t work.
Is there anything that I missed in docs or anything else? Looking for your help :)
BTW: I'm aware of the solution: Pull out data from GA, filter data manually (compare output data vs my list of email clients what I would like to exclude)

Asp.Net PageLoading takes toomuch times

In my application search option is there it took time to search almost 60 seconds i just want to do search function just like a make my trip searching feature
At this point only thing i can do is recommend few technologies to achieve this
Sql Server -> Full Text Specification, Search with Contains, 'case when then' in query, stored procedure, limit the results for paging using 'Offset 10 Fetch next 10' method, Grouping to generate the total result count with in the query, ##Rowcount to get he total number of results .. i dont know if this help

How to use cursors for navigating to previous pages using GQL and the new gcloud-java API?

I'm using the new gcloud-java API (https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-datastore/src/main/java/com/google/cloud/datastore) for working with the Cloud Datastore. My specific question is on using GQL for pagination with cursors. I was able to page through the results one page at a time in the forward direction using cursors, but not having any luck with paging backwards.
Example Scenario:
Let's say I've 20 entities in a Kind with IDs 1 through 20. I have a page size of 5. Once I'm on the 3rd page (IDs 11 through 15), if I need to go one page back; i.e. retrieve IDs 6 through 10, what would be the correct GQL/sample code? Again, I prefer not to use offset with a number, but would like to use Cursors.
From what I can tell (actually tested), it looks like one needs to keep track of Start/End cursors for each page as they navigate in the forward direction, then use the saved cursors when there is a need to go back. I just want to make sure if this is the correct/only way or there is a simpler way to accomplish this.
Thanks in advance for your help.
If you add to your original query a sort by key (appended to the end of your "order by" clause), you should be able to reverse each property's sort order and use the latest cursor from your original query to get results in reverse.
Suppose you've iterated through some of the values from your forward query's QueryResults. You can call QueryResults's cursorAfter() method, which will return a cursor pointing right after the last result you saw from your original query. Now you can issue a new query (with the opposite sort order on each property, including the key property) using that cursor as the start cursor. You'll probably want to skip the first result, since it will be the last result you saw from the original query.

Using filters to track hits for multiple URLs

We have a large website that is split up into groups of organisations with a number of micro-sites. We would like to provide one organisation within a group with their own set of data and I am having troubling getting the filtering working.
I think my main problem is I have 2 include filters. According to the documentation:
"If you apply multiple Include Filters, the hit must match every applied Include Filter in order to save the hit."
Our website urls would go something like this: https://[host]/[group]/[site]/[params]. I would like to track the following, given that this client (id 9) is in group "foo":
https://mysite.com/foo/live/default.aspx?id=9
https://mysite.com/foo/live/?id=9
https://mysite.com/foo/reporting/9/*
so that any hits on those urls would be captured for this particular client.
Our 2 current filters (type="Include") are as follows:
/foo/Reporting/9/
/foo/[^\?]*\?id=9
but these do not seem to track everything we think they should. Any help would be much appreciated.
By the time the first filter is done there is nothing left for the second filter to match - the first filter throws everything away that does not match (that's what Google means by "the hit must match every applied Include Filter").
I would suggest you first use an advanced filter to transform your urls so they follow all the same pattern (i.e. grab the value from the query parameter and append it to the url path) and then apply the include filter. I'm pretty certain that would be easier than trying to include different url structures (if you need help with the filters holler away in the comments, but the example given in the advanced filters interface should give you a clue how this works).

Resources