Jersey doesnt show list null value - jersey

I migrated from apache 7 to apache 10 using JAX-RS now when i have a null list it doesnt show up on the json, the most I can get is [] , but I need the list value of null to show
enter image description here
list : null not list : []

Related

Incoherent values returned by Spring Boot Pagination

I'm trying to create a function which return a list of an Object with Page ( from spring data ).
The problem is that the returned values "totalElements" & "total pages" are incorrect
There is 10 elements, but totalElements = 110, and totalPages = 2 when the 10 elements enter easily in a page of 100 elements
PS : I am forced to use the object MongoTemplate in which there is no find function which takes a Pageable. So i'm forced to create it manually.
The code i'm using :
PageableExecutionUtils.getPage(orders,pageable,() -> orders.size());
the orders is a List of my results ( which are correct ), the page is defined like following :
Pageable pageable = new PageRequest(pageIndex,numberOfTransactionsPerPage);
Thank you for everything
Looks like you have 110 elements, and you have page size 100, so 2nd page is the last page with 10 elements because other 100 elements was on 1st page.

how to scrape popups on the website with scrapy

I want to scrape the name, age and gender of the reviews on boots.com. For age and gender you can only see this data once you hover the mouse on the name in each review. First of all my I made the code for scraping the name but its not working. Second of all I don't know how to scrape age and gender from the pop up. Could you help me please. Thanks in advance.
Link:https://www.boots.com/clearasil-ultra-rapid-action-treatment-cream-25ml-10084703
Screenshot of popup
import scrapy
from ..items import BootsItem
from scrapy.loader import ItemLoader
class bootsSpider(scrapy.Spider):
name = 'boots'
start_urls = ['https://www.boots.com/clearasil-ultra-rapid-action-treatment-cream-25ml-10084703']
allowed_domains = ["boots.com"]
def parse(self, response):
reviews = response.xpath("//div[#class='bv-content-item-avatar-offset bv-content-item-avatar-offset-off']")
for review in reviews:
loader = ItemLoader(item=BootsItem(), selector=review, response=response)
loader.add_xpath("name", ".//div[#class='bv-content-reference-data bv-content-author-name']/span/text()")
yield loader.load_item()
Javascript is used to display the data (78 reviews in your case). You should use Selenium to scrape this. To display all the comments, you'll have to click multiple times on the following button :
//button[contains(#class,"load-more")]
Then, to scrape the name of all consumers you can use the following XPath (then use .text method to extract the data) :
//li//div[#class="bv-content-header-meta"][./span[#class="bv-content-rating bv-rating-ratio"]]//span[#class="bv-author"]/*/span
Output : 78 nodes
If you want to scrape the text reviews you can use :
//li//div[#class="bv-content-header-meta"][./span[#class="bv-content-rating bv-rating-ratio"]]/following::p[1]
Output : 78 nodes
To get the age and the gender of each consumer, you'll have to mouse over their names (see the preceding XPath) then fetch the value with the following XPath :
//span[#class="bv-author-userinfo-value"][preceding-sibling::span[#class="bv-author-userinfo-data"][.="Age"]]
//span[#class="bv-author-userinfo-value"][preceding-sibling::span[#class="bv-author-userinfo-data"][.="Gender"]]
Alternatively, if you don't want to/can't use Selenium, you can download the JSON (see the XHR requests in your browser) which contains everything you need.
https://api.bazaarvoice.com/data/batch.json?passkey=324y3dv5t1xqv8kal1wzrvxig&apiversion=5.5&displaycode=2111-en_gb&resource.q0=reviews&filter.q0=isratingsonly:eq:false&filter.q0=productid:eq:868029&filter.q0=contentlocale:eq:en_EU,en_GB,en_IE,en_US,en_CA&sort.q0=submissiontime:desc&stats.q0=reviews&filteredstats.q0=reviews&include.q0=authors,products,comments&filter_reviews.q0=contentlocale:eq:en_EU,en_GB,en_IE,en_US,en_CA&filter_reviewcomments.q0=contentlocale:eq:en_EU,en_GB,en_IE,en_US,en_CA&filter_comments.q0=contentlocale:eq:en_EU,en_GB,en_IE,en_US,en_CA&limit.q0=100&offset.q0=0&limit_comments.q0=3&callback=bv_1111_50671
For this case, I set the &limit.q0= to 100 and offset.q0 to 0 to be sure to fetch all the data. Once you get the JSON, you'll find all the information in : Batched Results>q0>Results>0,1,2,3,...,78
Output :
To download the JSON userequest and extract the data with json module.

Oracle Apex - Create / Pass / Set Interactive Report (IR) Filters as parameters through URL

Scenario
Tried to add Oracle Apex Interactive Report Filters using URL.
Followed official doc syntax : Oracle installation doc - 8.4.3 Linking to Interactive Reports yet, could not find straightforward URL syntax for creating IN or CONTAINS operators filters ( in Oracle Apex interactive report ) through URL .
Oracle Apex - Create / Pass / Set Interactive Report (IR) Filters as parameters through URL
Credits : 1 2
STEP 1 - Define static id for interactive report region
STEP 2 - Change URL syntax to contain - Report ID | Filter | COLUMN NAME :
( Example 1 : will add interactive report filter with IN operator )
http://mywebsite.com/ords/f?p=103:2:::::IR[MOS]IN_SR_COMPANY:\Coca Coba,Gudai Exchange Holdings\
Where :
IR - Prefix is mandatory
[MOS] - Static Id of Interactive Report.
IN - interactive report filter IN operator ( see operator list below)
SR_COMPANY - interactive report column name.
\Coca Coba,Gudai Exchange Holdings\ - value of filter ( in this example : 2 companies names ).
Result:
( Example 2 : will add interactive report filter with contains operator and will clear previous filters )
http://mywebsite.com/ords/f?p=103:2::::CIR:IR[MOS]C_SR_COMPANY:\GMC Sport Company\
Where :
CIR - cleans previous filters
IR - Prefix is mandatory
[MOS] - Static Id of Interactive Report.
C - interactive report filter contains operator ( see operator list below)
SR_COMPANY - interactive report column name.
GMC Sport Company - value of filter ( in this example : 2 companies names ).
Result:
LIST OF VALID OPERATORS (oracle apex official documentation) :
Valid operators include:
C = Contains
EQ = Equals (this is the default)
GTE = Greater than or equal to
GT = Greater Than
LIKE = SQL Like operator
LT = Less than
LTE = Less than or equal to
N = Null
NC = Not Contains
NEQ = Not Equals
NLIKE = Not Like
NN = Not Null
NIN = Not In (escape the comma separated values with a leading and trailing backslash, )
IN = In (escape the comma separated values with a leading and trailing backslash, )
ROWFILTER = Row Text Contains (this searches all columns displayed in the report with type STRING or NUMBER)

AngularJs: After removing item from list, subsequent dirty form elements are set to pristine, how to handle this?

I have List of objects which I am iterating using ng-repeat.
List = [{
type = "CC",
cardNum : 125,
accNum : null,
amount =125,
isCard : true
},
{
type = "LN",
cardNum : null,
accNum : 125,
amount =125,
isCard = false
},
....
]
Now, based on selection from Radio of isCard (two radio, is Card and is Non Card), I need to show two respective field such as cardNum or accNum.
Now the problem is, when iterate and add both combination of isCard and isNonCard account and remove element in between, all the elements after that are set to pristine where it was dirty before.
scenario 1:
selected 1st as Card Acc - index 1
2nd as Non Card - index 2
3rd as card acc -index 3
touched the fields such that there is error for all 3 entries above
now, remove 2nd entry by using splice.
Issue: Now the 3rd element index is updated to 1(which is correct) but field is reset to pristine and error is hidden. How can I stop this so that error will still appear for 3rd element at updated index.
I managed to fix this issue. Even after using track by index, it did not work so I had to add trackIdentifier in object. Now when I tracked based on it, it started working and error messages appeared correctly.

APEX Office print

I am currently working with the Apex Office Print it would be nice if you could help me with two points.
I am creating a template with a lot of fields, and around 50% of
these fields are optional, so they are often only (null) in my
database. Can I do something so that the fields with no value are not
shown?
My second question would be the work with the print function and
checkboxes. How do I integrate the item APEX_APPLICATION.G_F01 so
that I only print the content of a selected checkbox ? It is not
really working in the PL/SQL section.
I am creating a template with a lot of fields, and around 50% of these fields are optional, so they are often only (null) in my database. Can I do something so that the fields with no value are not shown?
The {tag} will just be removed when it's empty. In case you want to make some blocks disappear you can wrap that in a condition,
for example:
{#tags=null} {product_name}: {product_description} {/tags=null} {#tags!=null} {product_name}: {tags} {/tags!=null}
or if you have a value:
{#checked=="Yes"}☒Yes ☐No{/checked=="Yes"}{#checked!="Yes"} ☐Yes ☒No {/checked!="Yes"}
My second question would be the work with the print function and checkboxes. How do I integrate the item APEX_APPLICATION.G_F01 so that I only print the content of a selected checkbox ? It is not really working in the PL/SQL section.
Are you running the AOP Process type plugin or the Dynamic Action plugin?
For example we use it for ourself when selecting invoices and printing them.
We have a checkbox in an IR:
apex_item.checkbox2(
p_idx => 1,
p_value => id,
p_attributes => 'class="invoice_id"',
p_checked_values => :P39_INVOICE_ID_LIST,
p_checked_values_delimiter => ',') as chk,
And then we have a Dynamic Action on change that sets an hidden item (P39_INVOICE_ID_LIST) on the page:
var
//Checkbox that was changed
$checkBox = $(this.triggeringElement),
//DOM object for APEX Item that holds list.
apexItemIDList = apex.item(this.affectedElements.get(0)),
//Convert comma list into an array or blank array
//Note: Not sure about the "?" syntax see: http://www.talkapex.com/2009/07/javascript-if-else.html
ids = apexItemIDList.getValue().length === 0 ? [] : apexItemIDList.getValue().split(','),
//Index of current ID. If it's not in array, value will be -1
idIndex = ids.indexOf($checkBox.val())
;
//If box is checked and it doesn't already exist in list
if ($checkBox.is(':checked') && idIndex < 0) {
ids.push($checkBox.val());
}
//If box is unchecked and it exists in list
else if (!$checkBox.is(':checked') && idIndex >= 0){
ids.splice(idIndex, 1);
}
//Convert array back to comma delimited list
apexItemIDList.setValue(ids.join(','));
In our query in the AOP DA we have:
where i.id in (select regexp_substr(:P39_INVOICE_ID_LIST,'[^,]+', 1, level) invoice_id
from dual
connect by regexp_substr(:P39_INVOICE_ID_LIST, '[^,]+', 1, level) is not null)
and we make sure the P39_INVOICE_ID_LIST is set in session state by specifying the Affected Elements of the AOP plugin call.
If you setup an example of what you want to do on apex.oracle.com I'm happy to build you the example there. In AOP 4.0 we will also include an example with checkboxes.
Hope that helps,
Dimitri

Resources