Skip to content

Instantly share code, notes, and snippets.

View CedricL46's full-sized avatar

Cedric L CedricL46

View GitHub Profile
# Open a command terminal in the bin folded of your java installation (e.g: C:\Program File(x86)\Java\jreXXXX\bin)
# In the commands below :
# - selfsigned is the name of the certificate
# - storPass is the password of the keystore and truststore
# - keyPass is the password of the certificate
# You can change those values for yours
#Generate the keystore.jks
keytool -genkeypair -alias selfsigned -keyalg RSA -keysize 2048 -validity 365 -keypass keyPass -storepass storPass -keystore keystore.jks
#Enter your informations when prompt
#SSH to your instance
#example :
#chmod 600 YOURPEMKEY.pem
#ssh -i YOURPEMKEY.pem ec2-user@YOURELASTICIP
#update current packages
sudo yum update -y
#install prerequisites
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
<!-- This DataBinding.cpx is usually found at ViewController/adfmsrc/view/DataBinding.cpx -->
<?xml version="1.0" encoding="UTF-8" ?>
<Application xmlns="http://xmlns.oracle.com/adfm/application" version="11.1.2.61.83" id="DataBindings"
SeparateXMLFiles="false" Package="view" ClientType="Generic">
<definitionFactories>
<factory nameSpace="http://xmlns.oracle.com/adfm/dvt"
className="oracle.adfinternal.view.faces.dvt.model.binding.FacesBindingFactory"/>
</definitionFactories>
<pageMap>
<page path="YOUR_FRAGMENT_PATH/YOUR_FRAGMENT.jsff" usageId="view_YOUR_PAGEPageDef"/>
<!-- In Oracle ADF, To fix JBO-27200: JNDI failure. Unable to lookup Data Source
you need to ensure that your datasource name is the same in 3 places:
Note : This is case sensitive.
-->
<!-- In web.xml -->
<resource-ref>
<res-ref-name>jdbc/YOUR_DATASOURCE_NAME</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
## Once the certificate renew command is scheduled (or manually with sudo ./etc/letsencrypt/certbot-auto renew) a new certificate is generated
## To check if a new certificate was generated you can run :
[ec2-user@ip-MyIp ~]$ locate *certbot.pem
/etc/letsencrypt/csr/0000_csr-certbot.pem #old certificate
/etc/letsencrypt/csr/0001_csr-certbot.pem #new certificate
## You then need to change the ssl conf to specify the new certificate :
sudo vim /etc/httpd/conf.d/ssl.conf
## Search for SSLCertificateKeyFile(vim command : ?SSLCertificateKeyFile) and change the file for the new one :
# Server Private Key:
/*** In YOURJSF.jsf button, or other component that need to execute a javascript on action, add : ****/
<af:commandButton text="ClickMe" id="cb1" actionListener="#{YOURSCOPE.YOURJAVABEAN.clickToExecuteJavascriptAction}"/>
/*** In YOURJAVABEAN.java class add : ***/
public void clickToExecuteJavascriptAction(ActionEvent actionEvent) {
this.executeClientJavascript("console.log('You just clicked : " + actionEvent.getSource() + " ')");
//Note: if you use a java string value in this function you should escape it to avoid breaking the javascript.
//Like this : stringValue.replaceAll("[^\\p{L}\\p{Z}]", " ")
}
##################################################################################################################
### You need to update 4 files to remove the memory limit and strongly improve your jdeveloper performance : ###
##################################################################################################################
##################################################################################################################
### Update the jdev.conf file (e.g : XXXX\Middleware\jdeveloper\jdev\bin\jdev.conf) ############################
##################################################################################################################
##################################################################################################################
### Your JDK need to be at least 1.7 for jdev to use a huge number of memory ###################################
@CedricL46
CedricL46 / uploadedFileToFileConverter.java
Created January 11, 2019 11:18
Read full tutorial on how to convert org.apache.myfaces.trinidad.model to java.io.File here :
public static File uploadedFileToFileConverter(UploadedFile uf) {
InputStream inputStream = null;
OutputStream outputStream = null;
//Add you expected file encoding here:
System.setProperty("file.encoding", "UTF-8");
File newFile = new File(uf.getFilename());
try {
inputStream = uf.getInputStream();
outputStream = new FileOutputStream(newFile);
int read = 0;
@CedricL46
CedricL46 / showAPlaceholderOrATooltipInAnAdfColumnFilterHeader.jsf.xml
Last active February 13, 2019 16:23
See full tutorial on how to show a placeholder or a tooltip(shortdesc) in an ADF column filter header here : https://cedricleruth.com/how-to-show-a-tooltipshortdesc-or-watermarkplaceholder-in-an-adf-column-filter-header/
<!-- Below an example table on with a column header filter customized to display a place holder and tooltip -->
<af:table value="#{bindings.YourVO.collectionModel}" var="row" rows="#{bindings.YourVO.rangeSize}"
fetchSize="#{bindings.YourVO.rangeSize}" filterModel="#{bindings.YourVOCriteriaQuery.queryDescriptor}"
queryListener="#{bindings.YourVOCriteriaQuery.processQuery}" varStatus="vs"
selectionListener="#{bindings.YourVO.collectionModel.makeCurrent}" rowSelection="single" id="T1"
styleClass="AFStretchWidth"
rowBandingInterval="0" columnBandingInterval="0">
<af:column sortProperty="#{bindings.YourVO.hints.YourVoAttribute.name}" filterable="true" sortable="true" id="Tc1"
width="60">
<!-- Add the following filter facet to modify the header column filter inputText component -->
#Install git and upgrade all packages
sudo yum update -y
sudo yum install git
#Get last available version of let's encrypt
git clone https://github.com/letsencrypt/letsencrypt.git
#result :
Cloning into 'letsencrypt'...
remote: Counting objects: 55232, done.
remote: Compressing objects: 100% (55/55), done.