Google Reader's Feed Unique ID - google-reader

I'm building an app using Google Reader's API. The XML for a particularly feed (aka entry) returned by Google Reader looks as follow:
<entry gr:crawl-timestamp-msec="1294812847894">
<id gr:original-id="">tag:google.com,2005:reader/item/fc8597a0dcb83203</id>
<category term="..." scheme="http://www.google.com/reader/" label="read" />
<category term="..." scheme="http://www.google.com/reader/" label="reading-list" />
...
</entry>
Question: is the value of the id element (i.e. "tag:google.com,2005:reader/item/fc8597a0dcb83203") globally unique (i.e. across all subscriptions and all Google Reader users)? If not, what should constitute the globally unique id for a feed?

Yes, the ID is globally unique. This is why Reader generates its own IDs (and keeps the IDs from the original feed (if any) in the gr:original-id element), to ensure that uniqueness.

Related

How to select the right <category> in RSS? is there a list?

i am noting that in a RSS feed you can add the tag
Source: https://www.w3schools.com/xml/rss_tag_category_item.asp
But I don't undestand one thing: is there a list with all the categories? Or can I write anything? I need a category about videogames
Or can I write anything?
You can write anything.
Unless you're submitting your feed to a directory, with a documented set of categories, it's essentially free text.
However, in RSS:
It has one optional attribute, domain, a string that identifies a categorization taxonomy.
The value of the element is a forward-slash-separated string that identifies a hierarchic location in the indicated taxonomy.
and in Atom:
The "scheme" attribute is an IRI that identifies a categorization
scheme.
you can indicate that your term is from a specific scheme.
In practice, some schema extensions like iTunes introduce a separate element:
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
...
<itunes:category text="Sports">
<itunes:category text="Wilderness"/>
</itunes:category>
rather than suggesting use of the scheme attribute. The iTunes guide currently includes:
<itunes:category text="Leisure">
<itunes:category text="Video Games" />
</itunes:category>

Match XML elements/nodes that contain 'X' with XPath

I'm using the WP-Property and WP-Property: Importer plugins to manage properties on a WordPress powered website. The importer uses xpath rules to help map fields in an imported XML file to their corresponding field on the site.
e.g. 'Display Address' maps to 'address/full'
I have a set of elements that look like this:
<property>
<feature1>Feature</feature>
<feature2>Feature</feature>
<feature3>Feature</feature>
<feature4>Feature</feature>
<feature5>Feature</feature>
<address>
<full>abc</full>
<street>def</street>
<postcode>ghi</postcode>
</address>
</property>
I want to group these together into one entry rather than setting up separate fields for each one, so I'm looking for a means to match feature* but everything I've tried so far seems to have missed the mark. Goes without saying that I've never dabbled with xpath before today!

How can I prevent a client-side data rule workflow from being executed the first time the screen loads?

The problem I have is this: I have a data rule which validates a field against a regex. I've provided both server- and client-side versions of the data rule, and bound them to appropriate dataset events.
The problem is, when I load the screen which contains the record creation form, the field is marked as invalid before the user gets any opportunity to even enter a value. I assume it's something to do with the dataset field being initially bound to the text-edit widget. I only want the validity to be test after the user enters a value, or when the screen is submitted.
How can I prevent the data rule from running when the screen is first loaded?
Update
Here's is my data rule definition:
<data-rule name="{#name}"
factory-class="com.aviarc.framework.datarule.xml.DefaultXMLDataRuleProviderFactoryImpl"
datarule-class="com.aviarc.framework.datarule.workflow.WorkflowDataRule">
<attributes>
<attribute name="field" mandatory="y" type="field"/>
<attribute name="valid-membership-number-regex" default="\d{8}[a-zA-Z\d]" mandatory="n" type="string">
Valid membership number regex:
- \d{8} : match 8 digits
- [a-zA-Z\d] : match any alphanumeric character
</attribute>
</attributes>
<event name="onRowFieldChanged" workflow="workflows/set-membership-number-valid"/>
<event name="onCurrentRowFieldChanged" client-action="actions/set-membership-number-valid"/>
</data-rule>
For field-change events like the ones I'm using, you need explicitly pass through the field that the dataset is bound to, like so:
<event name="onRowFieldChanged" field="{#field}" .../>
<event name="onCurrentRowFieldChanged" field="{#field}" .../>
I think my data rule must have been executing on any field change event, rather than just the field it was bound to.

How do I filter with OData based on an inner array?

So I created a controller using the mvc4 web api where the url (Get) “/api/things” return the following data:
<ArrayOfThing>
<Thing>
<Id>1</Id>
<Description>The Thing Desc</Description>
<Categories>
<Category><Id>1</Id></Category>
<Category><Id>2</Id></Category>
</Categories>
</Thing>
<Thing>
<Id>2</Id>
<Description>The Other Thing Desc</Description>
<Categories>
<Category><Id>1</Id></Category>
<Category><Id>3</Id></Category>
</Categories>
</Thing>
</ArrayOfThing>
*note that thing and categories has a many to many relationship
I know that if a need one “Thing” resource I should use a controller that matches the following route url (Get) “/api/things/{id}”.
But what if I want to get a subset of the data returned by the url (Get) “/api/things”. I tested the OData protocol modifying the controller to return an IQueryable and it work fine if I wanted to $filter on the properties of “Thing” like the Id or the Description. Unfortunately, I didn’t work out when I wanted to filter base on the Category, I believe is because Categories is an inner array.
So, what should I do to filter based on categories?
OData V3 supports Any/All operations, which you can filter by a collection property. For example, to filter things which contains Category(1), using following syntax:
/api/things/?$filter=Categories/any(category: category/Id eq 1)
If you are using ASP.net Web Api RTM bits, you can use odata package to support any/all. For more examples, you can check the queryable sample code: http://aspnet.codeplex.com/SourceControl/changeset/view/61dfed023e50#Samples%2fNet4%2fCS%2fWebApi%2fODataQueryableSample%2fProgram.cs

Getting the base URL for a property via Google Analytics API?

I'm working with the Google Analytics API, and am pulling a lot of data from it successfully. The accounts feed (https://www.google.com/analytics/feeds/accounts/default) returns a list of web properties connected to the account you're authorized for, in the following format (most actual values replaced, not sure how sensitive any of it is):
<entry gd:etag="W/"<charsblahblahblah>."" gd:kind="analytics#account">
<id>http://www.google.com/analytics/feeds/accounts/ga:########</id>
<updated>2011-08-04T12:01:33.467-07:00</updated>
<title>www.afifthofnothing.com</title>
<link rel="alternate" type="text/html" href="http://www.google.com/analytics"/>
<dxp:property name="ga:accountId" value="#####"/>
<dxp:property name="ga:accountName" value="My Sites"/>
<dxp:property name="ga:profileId" value="######"/>
<dxp:property name="ga:webPropertyId" value="UA-#####-#"/>
<dxp:property name="ga:currency" value="USD"/>
<dxp:property name="ga:timezone" value="America/Los_Angeles"/>
<dxp:tableId>ga:#######</dxp:tableId>
</entry>
I've previously been using the <title> element as the base URL for the property, which usually works because that's the default title that Google Analytics assigns to the property. But if a user edits this (I'm querying my end-users' accounts, so I don't have control there) to something like "A Fifth Of Nothing", then the Analytics API will dutifully return that as the title, leaving me with no way to find the base URL.
I've scoured the Analytics API documentation and googled around, searched SO, but don't see any way to get the base URL of a web property from Google Analytics. I've tried querying the id field via the OAuth Playground for more info, and it just gives me more errors, saying the last part has to be /default.
Is there a way to get the base URL for a user's properties from the data API? It seems like this would be something pretty basic. If not, I'll have to resort to trying the title, and if it's not URL-like just have the user enter it themselves, which is not very user-friendly, but is the only thing I can come up with at this point.
The strategy to use is to do a query against the ga:hostname dimension for ga:visits and sort descending. You typically can use this to reveal the host/base url.
I don't think there is such a property for the "base url" because technically you can put the google tracking code on multiple websites. And in this instance you would have multiple base url.
View Full Page URL In Reports
By default, the data in your reports includes only the Request URI and not the domain name:
URL of page: http://www.example.com/foldername/page.html
Request URI: /foldername/page.html
Domain name: www.example.com
If you'd like to see the domain name as well as the Request URI in your reports, create an Advanced filter for your view with the following settings:
Filter Type: Custom filter > Advanced
Field A: Hostname
Extract A: (.*)
Field B: Request URI
Extract B: (.*)
Output To: Request URI
Constructor: $A1$B1
Note that creating URL rewrite filters like the one described above can affect Analytics' ability to match your goals properly.
If you're using Analytics filters to rewrite your URLs, you need to make sure that your goal settings reflect these changes. Like all filters, URL-rewrite filters are applied to the raw data coming into your account, before goals are processed. As a result, your goal and funnel URLs should reflect the final, rewritten format of the URL. For example:
If your site's URL:
/directory/download/file.html
is rewritten by a filter to look like:
/download/file
then your goal should match
/download/file and not /directory/download/file.html

Resources