google plus one button statistics - google-plus-one

I would like to know how to get the value for the +1 value((if there are 10 clicks +1 button, store 10 as a variable). This would be helpful for analysis purposes.
I know the count parameter is only Boolean or plusone.state returns on/off but is there something like plusone.value? ( i tried it, it's undefined)
Thanks

Download the following url: https://plusone.google.com/u/0/_/+1/fastbutton?count=true&url=URLENCODED_URI via your favorite automatic method (curl, wget, file_get_contents, etc...)
URLENCODED_URI is the site you which to know the number of +1's for, e.g. http://www.google.com
For example, fetch the URI https://plusone.google.com/u/0/_/%2B1/fastbutton?count=true&url=http://www.google.com/ and locate the first occurance of window.__SSR = {'c': 32414.0 ,'si'. Preferably use regexp for this, but I'll leave the implementation to you and your chosen programming language.
The float number following 'c' is the number of +1's the site have. For google.com this is 32.414. Don't worry about it being a float, it is allways an integer in float format, so you can safely convert it to an integer.

There is an undocumented API for this described here - http://www.tomanthony.co.uk/blog/google_plus_one_button_seo_count_api/

Directions for +1 button tracking can be found at http://yoast.com/plus-one-google-analytics/
On the button creation screen, create a js callback then track the clicks using Google analytics with the following code:
<script type="text/javascript">
function plusone_vote( obj ) {
_gaq.push(['_trackEvent','plusone',obj.state]);
}
</script>
Alternately, use the javascript callback to track it any way you wish.

Related

FieldType.Number is capping the edit value to 100, any value more than 100 is automatically changed to 100

I have been struggling with this issue for a while now. In popup edit of Shield UI all the values that are entered FieldType.Number seems to have a upper limit of 100. Every value more than 100 gets automatically changed to 100.
There seem to be only 4 types String, boolean, data & number. The number seems to limit the max to 100 on edit and add.Even any decimal values are being rounded off automatically and their website is not providing much help on the issue because demo grid views on website are showing similar behaviour
Fields("empNumber", fb => fb.Path("empNumber").Type(ShieldUI.AspNetCore.Mvc.DataSource.FieldType.Number))
I'm looking for a way to add values more than 100 as well as decimal point for prices. Any help or suggestions in this regard are much appreciated
I ran into the same issue. However I found the following workaround. I have set the grid fieldtype to string instead of number. When editing or creating the grid a javascript is started that calls the controller method through ajax call. In my controller method I take the "string" value and convert it to an int like so:
propertyOfModel = Convert.ToInt32(stringParameterFromGrid);
That works for me, let me know if you need more help.

How to iterate over elements in selenium

Actually i want to read emails one by one in junk folder of "outlook:live" and mark emails "Not spam".
emails = WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH,"//div[#class = 'xoCOIP8PzdTVy0T6q_uG6']")))
This xpath matches 400 instances. I want to make a loop to select one email at a time like select first email, click on the div and perform action and then 2nd email and so on. I'm trying this
emails = WebDriverWait(driver,
5).until(EC.element_to_be_clickable((By.XPATH,"//div[#class =
'xoCOIP8PzdTVy0T6q_uG6']")))
for count in range(0,len(emails)):
(emails)[count+1].click()
Please help me know where im doing wrong. Thanks in advance
It appears that the function you're using to return the clickable elements is only returning a single element, so you'll have to use a different function, make a change in your logic, etc.
For instance, you could use Selenium's find_elements_by_xpath("//div[#class = 'xoCOIP8PzdTVy0T6q_uG6']") which will return a list of WebElement object(s) if the element(s) are found, or an empty list if the element(s) is not found. This will, of course, not take into consideration the possibility of the elements not being completely loaded on the page. In my experience, just slapping a time.sleep(10) after you open the page is "'good enough".
I recommend making sure your elements can be discovered and interacted with first to make sure this isn't all in vain, if you haven't already.
Another option is to add another function, something like a elements_to_be_clickable() function, to the Expected Conditions source code.
From the Expected Condition documentation, I've done some research and it looks like the element_to_be_clickable() function only returns a single element. Moreover, from the source code, said function mainly makes use of the visibility_of_element_located() function. I believe you could follow similar logic to the element_to_be_clickable() function, but instead use the visibility_of_all_elements_located() function, in order to return multiple WebElements (since visibiilty_of_all_elements_located() returns a list of WebElements).

Watson, types of condidions

I have one example.
I create some intent inside Watson Conversation, and I want to knows how I can do some condition for it?
Example:
Watson: Hi, tell me your number
Me: 99999-9999 (and have some regex inside advanced conversation flows, i check wih context variables in the case is number and works fine)
The conversation will only continue if he enters the 9 numbers correctly.
I try it:
check image
Use a regular expression to parse the input and extract the number using syntax similar to
then have a dialog node condition based on the number extracted.

angular ui.mask for variable length format

i am trying to use angular ui.mask module to display a full length url based on user entering a section name(suffix)
http://www.example.com/XYZ where 'XYZ' is the user input.
While a mask 'http://www.example.com/AAA' works fine, it does limit the user to entering only 3 character.
Any quick ways to extend the length accepted?
I tried altering the regex to accept variable length, but haven't got this working.
Any help would be appreciated.
Thanks.
This can be accomplished by using a question mark before any character in the mask that would be optional.
In your case, it would look like:
ui-mask='http://www.example.com/?A?A?A?A?A?A?A?A?A?A?A?A?A?A?A?A'
Better late than never...

Eclipse - How do I view java arrays / collections better in debugger

Viewing/Searching java arrays and collections in the Eclipse Java debugger is tedious and time-consuming.
I tried this promising plugin (in alpha as of Aug 2012)
http://www.cvast.tuwien.ac.at/projects/visualdebugging/ArrayExplorer
But it freezes Eclipse for simple arrays beyond a few hundred elements.
I do use Detail formatters, but that still needs clicking on each element to see the values.
Are there any better ways to view this array/collection data?
Use the 'Expressions' tab.
There you can type in any number of expressions and have them evaluated in the current scope.
ie: collection.size(), collection.getValueAt(i), ect...
Eclipse > Preferences > Java > Debug >Detail Formatter
This may be close to what you are looking for. It is another tedious work to setup but once done you can see the value of objects in Expressions window.
Here is link to start
override toString method of your class and you will be able to see what you want to see. i'm attaching example to show you exactly that.
Even though i could not find a way to see them in nice table/array, i found a halfway workaround.
The solution is to define a static method in a throwaway class that takes the array as input and returns a string of concatenated values that one wants to quickly glance at. it could include the array index and newlines to view results formatted nicely. It can be fine tuned to print out only certain array indices to reduce clutter.
This static method can then be used in the watch area.

Resources