Instantly share code, notes, and snippets.

View HowToIncreaseJdeveloperPerformance.sh
##################################################################################################################
### 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 ###################################
View executeClientJavascriptInADFJavaBeanOnAction.java
/*** 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}]", " ")
}
View OracleADFDuplicateRowLine.java
//Oracle ADF ActionEvent to duplicate a row
public void duplicateRowLine(ActionEvent e) {
ViewObject vo = this.getViewObjectFromIterator("YOUR_ITERATOR_NAME");
Row currentRow = vo.getCurrentRow();
Row duplicatedRow = vo.createRow();
AttributeDef[] voKeyAttributes = vo.getKeyAttributeDefs(); //List of the primary keys that need to be unique
String[] currentRowAttributes = currentRow.getAttributeNames();
for (String attributeName : currentRowAttributes) {
int attributeIndex = duplicatedRow.getAttributeIndexOf(attributeName);
//Check if the attribute is updatable
View OracleADFfixJbo27200.xml
<!-- 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>
View DataBindings.cpx.xml
<!-- 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"/>
View installOwnCloudOnLinuxEC2.sh
#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
View AddCertificateToWeblogicDomainFolder.sh
#Connect to the Weblogic Host through FTP and upload your keystore.jks and truststore.jks to your user home
#Connect to the Weblogic Host through SSH with your user
#Copy the trustStore and keyStore to a tmp folder available from your {YourWeblogicUser}
[{YourSSHUser}@{YourWeblogicHost} ~]$ cp truststore.jks /tmp/
[{YourSSHUser}@{YourWeblogicHost} ~]$ cp keystore.jks /tmp/
#Sudo to {YourWeblogicUser}
[{YourSSHUser}@{YourWeblogicHost} ~]$ sudo su - {YourWeblogicUser}
#Copy files to {YourWeblogicDomainPath}/{YourWeblogicDomainName}/certificates
[{YourWeblogicUser}@{YourWeblogicHost} ~]$ mkdir {YourWeblogicDomainPath}/{YourWeblogicDomainName}/certificates
[{YourWeblogicUser}@{YourWeblogicHost} ~]$ cp /tmp/truststore.jks {YourWeblogicDomainPath}/{YourWeblogicDomainName}/certificates
View GenerateSelfSignedSSLCertificateWithKeytool.bash
# 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
View getOracleAwrReportSQL.sql
/**** Run this query to get the boundary time or your AWR report ****/
select snap_id,
snap_level,
to_char(begin_interval_time, 'dd/mm/yy hh24:mi:ss') begin
from
dba_hist_snapshot
order by 1
desc;
/***
View getRichTableSelectedRowAttributeValue.java
//Function to call as follow :
//Object myValue = MyBean.getRichTableSelectedRowAttributeValue("tableID", "VoAttributeName");
public Object getRichTableSelectedRowAttributeValue(String tableID, String attributeName) {
Object value = null;
RichTable richTable = (RichTable)JSFUtils.findComponentInRoot(tableID);
if (richTable != null) {
RowKeySet rks = richTable.getSelectedRowKeys();
Iterator it = rks.iterator();
while (it.hasNext()) {