How to hide zend framework2 Deprecated message - zend-framework

Deprecated: You are retrieving the service locator from within the class Admin\Controller\IndexController. Please be aware that ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceLocatorAwareInitializer. You will need to update your class to accept all dependencies at creation, either via constructor arguments or setters, and use a factory to perform the injections. in /var/www/airtel-emt-credit-limit/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php on line 258

Supress the warnings using error_reporting().
For example first thing in your application as in your index.php file:
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
All errors will be shown except for deprecated or user_deprecated.

Related

How to update a Set Filter to ag-grid v21?

I have custom BaseSetFilter that extends SetFilter. It works with ag-grid v20.2.0 and does not even build with ag-grid v21.0.1. There are notes about breaking changes (see AG-2946 in ag-grid v21.0.0 changelog) and to create custom floating filters after the Filter Refactor, but no guidance on how to change an existing filter to work with the new version.
What must change to upgrade a custom filter from ag-grid v20 to ag-grid v21?
So many breaking changes are not documented.
Here's what I did so far ... none of these were in the release notes or the documentation:
renamed BaseFilter to SimpleFilter to access the static operators.
redeclared GridCell, GridCellDef, and GridRow which were deleted from ag-grid.
renamed property filterParams to providedFilterParams, but that is private so it did not help.
renamed method customInit to init.
renamed method serialize to getModelFromUi.
removed generic types after IFloatingFilter and IFloatingFilterParams.
commented out code to satisfy ng serve.
Typescript (in VS Code and ng serve) reports errors that indicate the filter-related interfaces and classes have changed in breaking ways, e.g.:
Property 'valueModel' is private and only accessible within class 'SetFilter'.
Property 'providedFilterParams' is private and only accessible within class 'ProvidedFilter'.
Property 'translate' does not exist on type 'BaseSetFilter'.
Property 'onFloatingFilterChanged' does not exist on type 'IFilterComp'.
Property 'initialiseFilterBodyUi' is private in type 'SetFilter' but not in type 'BaseSetFilter'.

How can I log in Play Framework using Scala?

I have updated Play Framework up to 2.7 and I got following warning:
method info in object Logger is deprecated (since 2.7.0): Create an instance of via Logger(...) and use the same-named method. Or use SLF4J directly.
So my questions are:
Should I create an instance of Logger and pass it to each component
when I want to use it?
P.S.:
In project not based on Play Framework, I used to use scala-logging that is a wrapper for SLF4J. Can this be a solution?
Play 2.7 provides a trait for Scala similar to scala-logging. It creates a val which you can use it in you class/object:
import play.api.Logging
class MyClass extends Logging {
// `logger` is automaticaly defined by the `Logging` trait:
logger.info("hello!")
}
So there is another way to log in Play now.

Can't map property String to JAXBElement<String> using MapStruct

so I was playing a bit with Mapstruct, reading the reference Documentation for the Version 1.1.0.Final, and arrived at the point:
implicit type conversions
where is defined the following statement:
Between JAXBElement < T> and T
I tried that, but the error what I received was:
Can't map property "java.lang.String xmlElement" "javax.xml.bind.JAXBElement<java.lang.String> xmlElement".
Consider to declare/implement a mapping method:
javax.xml.bind.JAXBElement<java.lang.String> map(java.lang.String value)".
I know thisi is the same thread asCan't map property when using MapStruct but since then Mapstruct released a new version.
Am I doing something wrong or this feature really is missing?
Thank you.
Mapping from JAXBElement<T> to T works out of the box. For the reverse you need to make sure that the ObjectFactory(ies) are in the Mapper#uses, MapStruct uses those methods to create the types.
You can also have a look at this integration test.
In case this happens on Java 9 or higher and you use implementation of type JAXBElement from maven library (in my case'javax.xml.bind:jaxb-api') make sure it is on the classpath of the annotation processor - this resolved the issue for me.
If your JAXBElement was generated by a wsdl client generator (eg. xjc) you need to provide the corresponding ObjectFactory.class generated by the client generator:
#Mapper(uses = ObjectFactory.class)
public interface OrderMapper {
Order orderEntityToExternalOrder(OrderEntity orderEntity);
}
See:
MapStruct 1.0.0.Beta1 is out with JAXB support, custom factories, decorators and more

How to invoke a class in jsp if condition is true?

I wrote a class for sending sms through gmail in java now I want to invoke SMS class in user.jsp page using if condition.
For example
if(dat.equals(due_date)){
// SMS Mail = new SMS();
}
I included page of SMS class call constructor but I have no idea how SMS class send sms if
if(dat.equals(due_date)){}
then what syntax will come in if {} empty braces.
Try with JavaServer Pages Standard Tag Library instead of Scriplet.
Read official oracle document on JavaBeans Components in JSP Pages for better understanding.
JSP - JavaBeans
A JavaBean is a specially constructed Java class written in the Java and coded according to the JavaBeans API specifications.
Following are the unique characteristics that distinguish a JavaBean from other Java classes:
It provides a default, no-argument constructor.
It should be serializable and implement the Serializable interface.
It may have a number of properties which can be read or written.
It may have a number of "getter" and "setter" methods for the properties.
The useBean action declares a JavaBean for use in a JSP. Once declared, the bean becomes a scripting variable that can be accessed by both scripting elements and other custom tags used in the JSP. The full syntax for the useBean tag is as follows:
<jsp:useBean id="bean's name" scope="bean's scope" typeSpec/>
Here values for the scope attribute could be page, request, session or application based on your requirement. The value of the id attribute may be any value as a long as it is a unique name among other useBean declarations in the same JSP.
Find complete sample code here on JSP - JavaBeans
Read more about JSTL Core c:if Tag that evaluates an expression and displays its body content only if the expression evaluates to true.

GWT: Replace AbstractPlaceHistoryMapper with a custom mapper using deferred binding

Looks like the class that is generated for PlaceHistoryMapper is hard-coded to use AbstractPlaceHistoryMapper as the super class.
So, I am trying to work around this by trying to replace this AbstractPlaceHistoryMapper with a custom mapper of mine using deferred binding . I am using the following rule in my *.gwt.xml:
<replace-with class="com.google.gwt.place.impl.AbstractPlaceHistoryMapper">
<when-type-is class="com.test.sampleapp.CustomPlaceHistoryMapper" />
</replace-with>
But for some reason the replace does not seem to be happening. CustomPlaceHistoryMapper is not getting kicked in and the generated class still uses AbstractPlaceHistoryMapper.
Any thoughts/pointers as to what might be resulting this behavior are much appreciated.
Note: I have also posted this on the GWT group but haven't received an answer so far.
To make the deferred binding work a class must be created with GWT.create(). However, AbstractPlaceHistoryMapper is only used as an extended class. So it will never be created via GWT.create, but always by instantiation the subclass. And therefor deferred binding won't work in this case. If you want a complete different implementation you have to implement a custom PlaceHistoryMapper, and manage the known tokens yourself. This also means you can't use the History annotations either.
As a side note the classnames in your rule should be swapped. But for the end result this doesn't matter, since it won't work in the first place.
It is absolutely possible to have custom history tokens (eg. #mail or #mail/bla instead of only #mail:inbox) using the out-of-the-box Place-related classes that GWT (2.0) provides.
Instead of replacing AbstractPlaceHistoryMapper you could instantiate the default PlaceHistoryMapper passing in it's constructor your implementation of PlaceHistoryMapper<T> or PlaceHistoryMapperWithFactory<T>.
eg.:
final PlaceHistoryHandler placeHistoryHandler = new PlaceHistoryHandler(new CustomHistoryMapper());
You will be able then to map tokens as you wish.
I personally recommend you to use an unique PlaceTokenizer in you mapper custom implementation so that I dont have to have an inner PlaceTokenizer class in each of your Places.
Hope that helps. Feel free to ask any doubts.