can you limit the number of items in a recently-updated macro in confluence 2.9? - macros

i see in confluence 2.10, there is a max and maxresults parameter but i dont see these parameters in 2.9.1 or below. Is there anyway to limit the results in these versions ?

There's no such parameters in 2.9, you could use the {rss} macro and display a confluence feed of recently updated content, but you would have to transmit a username and password inside the url, plus the resulting page will either simply display the list of page title (no space, no author nor date) or the complete diff/content for the page (a bit noisy).
A more practical way of limiting the number of results shownwould be to use the GET parameter maxRecentlyUpdatedPageCount which control the {recently-updated} macro behaviour.
In order to do that, you could use the {redirect} macro (it's in a free plugin) on your page. Supposing your page is located at http://confluence.example.come/display/SPACE/Page, its source will look like (for 50 recently update items) :
{recently-updated}
{redirect:location=http://confluence.example.come/display/SPACE/Page?redirect=false&maxRecentlyUpdatedPageCount=50}
Note that it will display a slightly annoying information panel, warning you about the redirect. If you want to get rid of it, get your hands on the {span} macro (free plugin as well), and change the markup of the page to :
{recently-updated}
{span:style=display:none;}
{redirect:location=http://confluence.example.come/display/SPACE/Page?redirect=false&maxRecentlyUpdatedPageCount=50}
{span}

Related

How do I get the event tags for a Coverity issue?

If I am looking at an issue in the Coverity user interface, how do I get the event tag or tags? I need to know a tag in order to suppress the finding using code annotations, as described in the question "How can I disable coverity checking using code annotation?" but I'm not seeing it or maybe don't know where to look.
The event tag is the first identifier-like word in each line of commentary that makes up the issue report.
For example, on Github, RcppCore/Rcpp issue 760 contains a screenshot that I have reproduced at half-size resolution with some annotations:
Zooming in on the code panel:
There are three events here:
alloc_fn: Storage is returned from allocation function operator new.
noescape: Resource new Rcpp::Rostream<true>::Buffer is not freed or pointed-to in basic_ostream. ...
leaked_storage: Failing to save or free storage allocated by new Rcpp::Rostream<true>::Buffer leaks it.
The event tags are "alloc_fn", "noescape", and "leaked_storage".
In this instance, all of them are associated with the same line of code (line 49), but in general they may appear on different lines and spread across multiple files.
To navigate to all of the events, use the Occurrences panel:
The Occurrences panel shows all of the events, organized into a tree, where child nodes are events in callee functions. The entire list is generally ordered in program execution order, although some events may be chronologically disconnected, for example if the finding involves multiple execution paths.
Each entry in the Occurrences panel has an event number (again, nominally chronological), the event tag, and the file name and line number. Clicking on an entry navigates to that event in the code panel.
Here are a couple related Synopsys support articles:
how to add code annotation? I do not know which name should exist with //coverity[]
Is there a document that lists all defect 'events' with their name and descriptions?

Xpath starting retuning None on Scrapy

I'm trying to crawl a site and to do so, I'm using Scrapy. So, when doing requests to nested pages, the procedure usually gets the the information correctly on the first trials, but, on later requests the nodes starts to return None. I'm using xpath's functionality. Below I'm pasting some lines of the parse function:
(I tried this one with the approach of explicitly comparing the class value)
title = response.xpath('//span[#class="inlineFree"]/text()').extract_first()
(With this one I used the contains function)
view = response.xpath('//span[contains(#class,"count")]/text()').extract_first()
(I've also used this one when I found more suitable)
comments = response.css('div.commentMessage > span::text').extract()
Am I doing something wrong on paths?
Is there any reason for the crawler to stop reading the nodes correctly?
Cannot say what the problem is without the log messages or the spider code but..
What happens most of the time is that websites fo not follow a strict html structure .For some properties the 'title' may be inside the span
but for the next iteration it may be
span[#class="inlineFree"]/h1/text() or or any other tag
so you should check the html for those returning None

What does the parameter "cvid" in Bing search engine stands for?

As I searching something with Bing and I open the Chrome development tools. Here is the request url:
http://cn.bing.com/search?q=%e4%b9%a0%e8%bf%91%e5%b9%b3&go=%e6%8f%90%e4%ba%a4&qs=n&pq=%e4%b9%a0%e8%bf%91%e5%b9%b3&sc=6-6&sp=-1&sk=&cvid=AF49B4165317411D8AFEF30F13BCD108&first=10&FORM=PERE
So, what does the parameter "cvid" stands for? It seems if i don't set a cvid,i can't get the complete result html in my program.
By the way, the cvid is calculated by the browser automaticlly, so how to calculate?
In the Bing search context, cvid represents the JavaScript parameter ConversationId. Bing uses this key to identify your search result collection as its reply to your query, q. Similarly, pq is PartialQuery. These and other parameters may also apply to different kinds of searches, such as image or video searches.
Next, qs is your query's SuggestionType, sc shows your SuggestionCount, and from the suggestion list (dropped down, if enabled), sp shows the SuggestionPosition you chose. In your case, you did not select a suggestion, so &sp=-1. Toward the end of your string, sk is the SkipValue, because you might skip through your result pages, first tells the issuer how many results belong on the first page, and I'll let you figure out what FORM means. ;)
TRY:
Navigate to Bing, conduct a search, choose some options, change your displays, and change some search types. Next, open file explorer and navigate to your Windows OS equivalent of the following path.
C:\Users\{user}\AppData\Local\Microsoft\Windows
Next, you may need to adjust your View temporarily to "Show hidden files, folders, and drives." View tab > Options > Change... > View tab again, and click the bullet to "Show...".
In File Explorer's Search pane at the upper right, enter *.js to find all JavaScript files. It may point you several subfolders deeper, and the folder names may be hashed. Choose a JavaScript file you find interesting, right-click the file, and open it with Notepad, your favorite IDE, or some similar editor. You should see something akin to this (truncated; may not run independently):
var AutoSuggest,__extends,Bing,sa_inst;(function(n){var t;(function(n){var t,i,r,u,f,e;(function(n){n.User="SRCHHPGUSR"})(t=n.CookieNames||(n.CookieNames={})),function(n){n.AutoSuggest="AS"}(i=n.CrumbNames||(n.CrumbNames={})),function(n){n.CursorPosition="cp";n.ConversationId="cvid";n.SuggestionCount="sc";n.PartialQuery="pq";n.SuggestionPosition="sp";n.SuggestionType="qs";n.PreviewPaneSuggestionType="qsc";n.SkipValue="sk";n.PreviewPaneSkipValue="skc";n.Ghosting="ghc";n.Css="css";n.Count="count";n.DataSet="ds";n.SessionId="sid";n.TimeStamp="qt";n.Query="q";n.ImpressionGuid="ig";n.QFQuery="qry";n.BaseQuery="bq";n.FormCode="form";n.HashedMuid="nclid";n.RequestElToken="elvr";n.ElTokenValue="elv";n.AppId="appid";n.History="history";n.NoHistory="nohs";n.ApiTextDecoration="textdecorations";n.ClientId="clientid";n.Market="mkt";n.Scope="scope";n.CountryCode="cc";n.HomeGeographicRegion="hgr";n.SetLang="setlang";n.ZeroInputSerp="zis"}(r=n.QueryParams||(n.QueryParams={}))
I hope that helps someone! :D
I'm also trying to find out what this is :)
I'm pretty sure it's an encryption mechanism for bing a la public key cryptography, though I could be wildly wrong. There is another field called pq - and p's and q's are used a lot in crypto theory.
The field is 32 nibbles (e.g. 8D0E519A91024A08B075654D006C0A14) which equals 128 bits. This number results in some arithmetic operation with the binary value of your search and bing's private key - thus making url generation quite difficult.

Apache Wicket event on Page "page was mouted on ..."

I have mount Page in this form (with one predefined parameter):
mountPage("/lista/${variant}", StronaEntityV2.class);
when parameter "variant" is given all is OK. But when parameter is absent (is OK too from application point of view) URL is build in form
wicket/bookmarkable/all....package...StronaEntityV2?8
It is ok too, but I will know that situation. In simple situation (with one predefined parameter) checking parameter is good, but in more complicated isn't so simple (and must maintain code in distinct places).
My ideal imaged solution is event
page.OnPageIsMountedOn(URL to_me)
I will accept wide range of solutions.
FORMAL: please integrate synonyms on tags wicket-1.6 & wicket-6, and create new wicket-7
Your page is configured to listen to /lista/${variant}.
When you do: setResponsePage(StronaEntityV2.class, paramsWithVariant) then Wicket will use the mount point and produce: /lista/variantValue.
But if you do: setResponsePage(StronaEntityV2.class), i.e. no PageParameters provided, then Wicket will ignore /lista/${variant} (because it doesn't match) and will produce a "default" page url, i.e. /wicket/bookmarkable/com.example.StronaEntityV2.
So the application controls which url should be used.
You can use optional parameter placeholder: /lista/#{variant}. Note that I use # instead of $ now. This way Wicket will produce /lista/ when there is no variant parameter provided. In the page constructor you will know that the url is always "/lista" but the parameter may be null, so better use: pageParameters.get("variant").toXyz(defaultValue) or .toOptionalXyz().

Query with toLocalizedTime in Plone

I'm using toLocalizedTime to output a date, as below
<span tal:content="python:here.toLocalisedTime(date.get('start_date'))"/>
This outputs eg. 2007/08/02, I'm just curious as to how one would alter the output so that it reads 02/08/2007
I'm not having much luck finding much info on toLocalizedTime, would someone point me in the right direction?
This depends on whether you have English selected as the site language (Site Setup >> Language). If so, then the default settings are used. You can change the defaults by dropping down into the ZMI, then into 'portal_properties', then 'site_properties'. The fields to change are either 'localTimeFormat' or 'localLongTimeFormat' depending on whether you pass in 'long_format=1' to the toLocalisedTime function.
If on the other hand, you have translations set up, the format may instead be pulled from the translation file for the locale selected. I'm not sure what is the easy way to change the format in this case (other than switching the site back to English). I guess you can register your own translation file but I've never needed to do that so you're going to have to look up the details.
Date string formatting follows the Python rules (http://docs.python.org/library/time.html#time.strftime).
Perhaps even more detail than you need:
here.toLocalizedTime()
is defined in the plone browser view at...
CMFPlone/browser/ploneview.py
which looks up the 'translation_service' utility, to call its 'ulocalized_time' function, defined at...
CMFPlone/TranslationServiceTool.py
which itself calls the 'ulocalized_time' function defined at...
CMFPlone/i18nl10n.py
As always, you can learn interesting things by grepping the source code ;-)
For an up to date answer for Plone 4.3 (after going through the source code)
These fields are now in the registry found at:
http://localhost:8080/yoursite/portal_registry
Then filter on "i18nl10n", which should give you the 4 fields you need to change.