Monday 16 December 2013

Linux - Disable Root SSH Access

Disable Root SSH Access

I needed to disable root ssh access without disabling root user or su - root.

in order to do this, it really is easy.

edit /etc/ssh/sshd_config

To do this you can use vi:
vi /etc/ssh/sshd_config

find the line that says:
#PermitRootLogin yes

change that line to
PermitRootLogin no

save and restart sshd
you can do that by:
/etc/init.d/sshd restart

now root cannot be logged in through ssh anymore.

#bearMan

Friday 13 December 2013

Auto login Wallet - Create from .key


Self Signed Wallet - Create from .key


There are a few steps to creating this:

  1. Convert certificates and key to correct format
  2. Create .p12 from certificate and key
  3. Create Auto login Wallet from .p12

What tools we are going to be using

To convert Keys and Certificate to PEM

  • X509
  • Rsa
To Convert to .p12

  • openssl
To Convert .p12 to .sso

  • orapki

Steps


Convert to PEM

We need to make sure your key and certificates are in PEM format.
To convert a certificate from DER to PEM:
  •  x509 –in in.crt –inform DER –out out.crt –outform PEM

To convert a key from DER to PEM:
  • rsa –in in.key –inform DER –out out.key –outform PEM


Create Wallet

Once we have out PEM formatted Keys and Certificates, we need to create the .p12
There are two commands we can use here, one if we only have one certificate and the other if we have a root certificate as well.

Option 1

openssl pkcs12 -export -in in.crt -inkey in.key -out bundle.p12

Option 2

openssl pkcs12 -export -in in.crt -inkey in.key -certfile root.crt -out bundleRoot.p12


You will be prompted to enter a password, let’s assume we used password.

Create Auto Login

Then we have to create the Auto login wallet, to do this you need JAVA_HOME other wise you may get an error similar to this:
$JAVA_HOME should point to valid Java runtime

My Java Home was at: /u01/app/oracle/product/jvm/
Thus
export JAVA_HOME=/u01/app/oracle/product/jvm

if you don’t know where “orapki” is, search for it, it is most probably in the oracle_common.

Mine was at: /u01/app/oracle/product/fmw/oracle_common/bin/orapki

Thus I ran
/u01/app/oracle/product/fmw/oracle_common/bin/orapki  wallet create -wallet bundleRoot.p12 -auto_login -pwd password

This creates a cwallet.sso file.

Edit:

When I tried this again on another server I got an error. 
Exception in thread "main" java.lang.NullPointerException
        at oracle.security.pki.C14.d(C14)
        at oracle.security.pki.OracleWallet.createSSO(OracleWallet)
        at oracle.security.pki.textui.OracleWalletTextUI.create(OracleWalletTextUI)
        at oracle.security.pki.textui.OracleWalletTextUI.command(OracleWalletTextUI)
        at oracle.security.pki.textui.OraclePKITextUI.main(OraclePKITextUI)


so I ran this:
/u01/app/oracle/product/fmw/oracle_common/bin/orapki  wallet create -wallet ./ -auto_login

Note: I was in the same Directory as my bundleRoot.p12.

My complete commands looked like this:

cd /u01/app/oracle/product/fmw/asinst_1/config/OHS/ohs1/keystores/
openssl pkcs12 -export -in domain.co.za.crt -inkey certKey.key -certfile gd_bundle.crt -out bundleRoot.p12
cd /
find -iname orapki
export JAVA_HOME=/u01/app/oracle/product/jvm
/u01/app/oracle/product/fmw/oracle_common/bin/orapki wallet create -wallet bundleRoot.p12 -auto_login -pwd password

Resources:

http://docs.oracle.com/cd/E11882_01/network.112/e10746/asoappf.htm#ASOAG9831

Notes:


  • If you are creating this for EBS, dont create the bundleRoot.p12 but rather a ewallet.p12.
  • To view the wallets details run this:
    • /u01/app/oracle/product/fmw/oracle_common/bin/orapki wallet display -wallet ewallet.p12


#bearMan saving you.

Wednesday 11 December 2013

OID - unable to locate message file: ldap.msb

unable to locate message file: ldap<language>.msb

The resolution to this error is to
export ORACLE_HOME=<Instance Path>

Example
export ORACLE_HOME=/u01/app/oracle/Oracle_IDM1/

#bearMan

Monday 9 December 2013

OHS: Virtual Host With Redirect

Apache: Virtual Host With Redirect

In your httpd.conf, under Virtual Hosts

In this example we will be redirecting example.website.com to example.website.com/prac/
This redirect only works when landing on / with no additional URI

<VirtualHost *:80>
 ServerName  example.website.com
 RewriteEngine on
 RewriteRule ^/$ /prac/ [R]
</VirtualHost>

#bearMan

Friday 6 December 2013

Windows: Run A Little More Advanced

Run A Little More Advanced

Do you ever need more than one piece of information, when you run?

Run Window

Do you ever want to run more than one command? Wither it be setting the title of the Terminal Window, or using the pause command?
Here is the trick!
Run the commands between &&

For example
cmd /k title ipconfig /all && ipconfig /all

This will set the title of the terminal window with the ipconfig \all and then run ipconfig \all

cmd /k @ECHO OFF && ipconfig && echo User Name: %username%

This will turn off echo, print ipconfig and then the username.



#bearMan

Thursday 5 December 2013

Windows: Grep Alternative

Grep - Things I think every Windows User should know

So I have just come from Linux to windows after running linux for a few months, and the one this I really missed was grep.

SO I found the alternative: findstr

findstr uses regex to search.

Here is an example I used:
tree | findstr /R /C:"Intel"

Regards
the #bearMan

Wednesday 4 December 2013

Windows: Run ipconfig

Run ipconfig

Have you ever needed or wanted to run a command from your run window?

win+r

run caption
Have you ever wanted to run a cmd command from there?

cmd /k <command> will allow you to run the command in terminal and keep terminal displaying.

For convenience I like to set this up to run my "ipconfig"

to do this all I do is:
cmd /k ipconfig /all

If you want to do more than this, and store your config somewhere, you can run this
cmd ipconfig /all > C:\Users\%username%\Desktop\ipconfig.txt

This will right the stats to the text file on your Desktop

#bearMan

Monday 2 December 2013

Windows: Cannot open folder Access Denied

Cannot open folder Access Denied

Have you ever given your flash disk to someone and when you get it back, you cannot access files or folders again?

If yes there is a simple solution:
You need a registry key called TakeOwnership, what this does it when you right click on the folder there is a menu item that allows you to take ownership of the file/folder.

The registry Key looks like this:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

#bearMan, Saving you time in windows.

Windows: Enabling CMD on all Right Clicks

Windows: Enabling CMD on all Right Clicks


This task is fairly simple, open regedit
Go to:
HKEY_CLASSES_ROOT\Directory\shell\cmd
HKEY_CLASSES_ROOT\Directory\Backgroud\shell\cmd
HKEY_CLASSES_ROOT\Drive\shell\cmd



Click on the Extended String Value and delete it, if you want it to go away again Put these String values back.

You can also rename them.

#bearMan

Friday 29 November 2013

ADF - Weblogic Timer Error

ADF - Weblogic Timer Error

My Error Stack trace looked something like this:

TimerManager requested: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
TimerManager  obtained: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
WorkManager  requested: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@b7b91c
WorkManager   obtained: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@1da10ec'
weblogic.application.ModuleException: Existing timer manager has different work manager.
TimerManager requested: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
TimerManager  obtained: InformationProvisioning@InformationProvisioning-IPModel-context-root@InformationProvisioning-IPModel-context-root@tm/AdsTimerManager
WorkManager  requested: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@b7b91c
WorkManager   obtained: weblogic.timers.internal.TimerManagerFactoryImpl$WorkManagerExecutor@1da10ec


In order to solve this I restarted my Integrated Weblogic Server.

it was caused by me trying to run an application before the previous run initialized.

#bearMan

Wednesday 27 November 2013

Java - Create JAR within Terminal

Java - Create JAR within Terminal

So Myself and Kevin created a class file today and we wanted to create a Jar file using Terminal.

What we did to do this, is we used Terminal.

The short: If you want to create a Jar File:
jar cfe Main.jar Main Main.class

c: create File
f: File
e: Entry Point: The main method

The Format is
jar cfe <Jar File to create> <Class with main method> <classes to include>
You can also use
jar cfe Main.jar Main *.class


So what we initially did was we created the jar file with the "Default Manifest File" which looked like :
Manifest-Version: 1.0
Created-By: 1.7.0_25 (Oracle Corporation)

As you can see this is missing the Main-Class pointer.

So then we did some more research and found we needed to include the Entry Point, our main method.

Manifest-Version: 1.0
Created-By: 1.7.0_25 (Oracle Corporation)
Main-Class: Main

Our Java code looked like:

public class Main{

 public Main(){
  System.out.println("Main");
 }
public static void main(String[] args){
  System.out.println("Main method");
  new Main();
 }


#bearMan and theStroud

Monday 25 November 2013

Java - Compile Through Command Line

Java - Compile Through Command Line

Initially set your path with the syntax

set path=%path%;<path to java>

Mine was:
set path=%path%;"C:\Program Files\Java\jdk1.7.0_25\bin\"

then to compile the .java to a .class, you need to use javac

run:

javac <Java File>

Mine was:
javac SSLSocketClient.java

To Run the Application using terminal, use java (Leave out the .class in the file name)
java SSLSocketClient

Thanks to Kevin for helping me.

#bearMan

Friday 22 November 2013

ADF - JSTL 1.1 Tags, JSTL 1.2 Tags.

Must choose only one of libraries: JSTL 1.1 Tags, JSTL 1.2 Tags.

To fix this error, right click on your Project View controller, Select Project Properties

Project Properties

Click on Libraries and Classpaths, and in this case I had three duplicates to I selected then all, as I needed none of them, as the library was already included at the top.


I clicked Remove, OK and then I was done.

make sure you don't remove all of these Libraries.

#bearMan, saving you money, putting you first.

Wednesday 20 November 2013

ADF - XML-24521

ADF Compiler "Element not completed: 'task-flow-reentry'"


Warning(5,54): <Line 5, Column 54>: XML-24521: (Error) Element not completed: 'task-flow-reentry'


My Task Flow xml File.

<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <task-flow-definition id="inforClientSearch">
    <default-activity id="__1">Search</default-activity>
    <task-flow-reentry id="__18"></task-flow-reentry>
    <view id="Search">
      <page>/Search.jsff</page>
    </view>
    <control-flow-rule id="__2">
      <from-activity-id id="__3">Search</from-activity-id>
      <control-flow-case id="__5">
        <from-outcome id="__6">create</from-outcome>
        <to-activity-id id="__4">AddNewClient</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <control-flow-rule id="__10">
      <from-activity-id id="__11">AddNewClient</from-activity-id>
      <control-flow-case id="__12">
        <from-outcome id="__14">cancel</from-outcome>
        <to-activity-id id="__13">Search</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <use-page-fragments/>
  </task-flow-definition>
</adfc-config>

to solve it I took out the

<task-flow-reentry id="__18"></task-flow-reentry>

To make My Task Flow xml file look like:
<?xml version="1.0" encoding="windows-1252" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
  <task-flow-definition id="inforClientSearch">
    <default-activity id="__1">Search</default-activity>
    <view id="Search">
      <page>/Search.jsff</page>
    </view>
    <control-flow-rule id="__2">
      <from-activity-id id="__3">Search</from-activity-id>
      <control-flow-case id="__5">
        <from-outcome id="__6">create</from-outcome>
        <to-activity-id id="__4">AddNewClient</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <control-flow-rule id="__10">
      <from-activity-id id="__11">AddNewClient</from-activity-id>
      <control-flow-case id="__12">
        <from-outcome id="__14">cancel</from-outcome>
        <to-activity-id id="__13">Search</to-activity-id>
      </control-flow-case>
    </control-flow-rule>
    <use-page-fragments/>
  </task-flow-definition>
</adfc-config>


It was caused by an error with when I was working on the "Task Flow Reentry" Behaviour for the task Flow. When I set it back to default, for some reason it did not set it back correctly

#bearMan

Monday 18 November 2013

OHS - Setting up OHS for Webcenter

Setting up OHS for Webcenter

So your task is simple, setting up OHS for Webcenter?

There is a bit of yes hopefully some more yes.

Firstly, we need to decide whether we are going to use EM or Edit the files directly and are we going to create a virtual host.

My answer to that Question is we can do either, with regards to EM and editing the Files.
With Virtual Hosts, not so much.

If you are going to use EM, I am going to show the Advanced way of adding Webcenter to the OHS install.

When logged into EM, navigate to the OHS install, under the Web Tire Menu on the Left.

Once clicked on there, go to the Menu, Administration, Advanced Configuration.

EM - OHS - Advanced Menu
Edit the mod_wl_ohs_conf file
Advanced Option
Or you can simply navigate to the file which should be stored "WT_ORACLE_HOME/instances/<your_instance>/config/OHS/ohs1/" or equivalent.

(LINUX) You can find the file in linux by typing in terminal -> find -iname mod_wl_ohs.conf

You're file should start with something like this:
# NOTE : This is a template to configure mod_weblogic.

LoadModule weblogic_module   "${ORACLE_HOME}/ohs/modules/mod_wl_ohs.so"

# This empty block is needed to save mod_wl related configuration from EM to this file when changes are made at the Base Virtual Host Level
<IfModule weblogic_module>
 #      WebLogicHost <WEBLOGIC_HOST>
 #      WebLogicPort <WEBLOGIC_PORT>
 #      Debug ON
 #      WLLogFile /tmp/weblogic.log
 #      MatchExpression *.jsp


Under the:
<IfModule weblogic_module>

You should add something to the effect of this:
<Location /webcenter>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8888
 </Location>
</IfModule>
<Location /webcenterhelp>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8888
 </Location>
 
 <Location /rss>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8888
 </Location>
 
 <Location /rest>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8888
 </Location>
 
 <Location /owc_discussions>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8890
 </Location>
 
 <Location /activitygraph-engines>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8891
 </Location>
 
 <Location /wcps>
  SetHandler weblogic-handler
  WebLogicHost 192.168.0.34
  WebLogicPort 8891
 </Location>

The format for this should look something like:
<Location /{path}>
  SetHandler weblogic-handler
  WebLogicHost {Hostname or IP}
  WebLogicPort {port}
 </Location>

#bearMan

Wednesday 13 November 2013

SQL Joins -- Visual Representation Part 1

SQL -- Joins My Visual Representation Part 1

My Favorite website I have with regards to this is Coding Horror Blog
and this is my Quick Representation of this.

Here are my two tables with the link being the Foreign key between the two tables.

Person
ID Name Link
1 Bjorn 1
2 Matthew 3
3 Monique
4 Kevin
5 Sean

Animal
ID Name
1 Bear
2 Fish
3 Dog
4 Bird
5 Spider

SQL Joins

Select Person.Name, Animal.name from Person Inner Join on Person.Link = Animal.ID

Inner Join

Bjorn Bear
Matthew Dog

Inner Join Venn Diagram

Select Person.Name, Animal.name from Person Full Outer Join on Person.Link = Animal.ID

Full Outer Join

Bjorn Bear
Matthew Dog
Monique
Kevin
Sean
Fish
Bird
Spider

Full Outer join Venn Diagram

Select Person.Name, Animal.name from Person left Outer Join on Person.Link = Animal.ID

Left Outer Join

Bjorn Bear
Matthew Dog
Monique
Kevin
Sean

Left Outer Join Venn Diagram

Select Person.Name, Animal.name from Person Right Outer Join on Person.Link = Animal.ID

Right Outer Join

Bjorn Bear
Fish
Matthew Dog
Bird
Spider




Add Some where clauses and you can go from the basic Joins, to some nice complex Results.

#bearMan

Monday 11 November 2013

Virtual Box: Error In suplibOsInit

Virtual Box: Specify KERN_DIR=<directory>

Today I was trying to run Oracle Virtual Box when an error occured.

This is a step by step guide for me to use, as it worked for me.

Virtual Box Error
I Ran: /etc/init.d/vboxdrv setup and got another error:

when I went to /var/log/vbox-install.log I got this error:
Makefile:183: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.

To fix this error I told my package Manager to install kernel-devel, make, gcc,  gcc-c++, kernel-source, kernel-syms

I used the command "zypper install make gcc  gcc-c++ kernel-source kernel-syms"
The install was about 400MB.

try running "/etc/init.d/vboxdrv setup"

I added my user to the vboxgroup (and it still was not working). <<== Need to check this name

Then I uninstalled everything with virtual box, "zypper rm virt*"

a Nice command was "zypper search virt*"
What I saw from running that was there were many different Virtual Box Applications, and I wanted the oracle one, which was not the basic VirtualBox.

I re-installed Oracle VirtualBox with "zypper install virtualboc-qt"

and then it worked. (Not to sure what the cause of the problem was.)

Remember also add yourself to the vbox user group

#bearMan

Wednesday 6 November 2013

JDeveloper: Making the most of your IDE, Database Connections

Adding Database Connections within seconds to a new ADF application

When creating new applications, you can simply add new Database connections to the application within a matter of seconds, all you need is the Database Connection already in your IDE.

Open Database Navigator and Click and Drag your Connection onto your Application.

Select the connection you want
Select Connection
Drop the connection onto the applicaiton
Drop Connection Onto Application
 The connection will then be inside the application
Connection in Application

#bearMan

Monday 4 November 2013

iFactory Consulting End of the Year Present!

iFactory Consulting's amazing end of the year present.

So over the weekend we had our end of the year Function, and it was amazing.

It was located at River Place


View Larger Map
iFactory Year End Invitation
The day started with the whole team socializing, with people catching up from the year and reflecting with each other how the year went.

Lunch was introduced with a couple of speeches; from the execs getting presents, to the iFactorian of the year. With third place being a tie between Arno and Charmaine, Second place to the well deserving, Kevin. First to one of the nicest people I have ever met ,Michelle, who when her name was mentioned was out of breath and speechless. It was really amazing to see some of the hardest working people I know, get what they deserve.

iFactory gave us 1TB hard drives, they were wrapped really nicely all in iFactory gear. It made me feel really special as they not only gave us something we need, being IT people, they gave us something I needed, as not 3 months ago, mine crashed so I really appreciate this.





So to all the people at iFactory Consulting may you all have a wonderful year ahead and thank you so much for the past year, I had a really enjoyable ride. Some tough times, but hey what year has gone by without one hard time. Thank you to the leadership team of iFactory you guys are amazing and an inspiration, and to everyone that works for them, my colleagues and friends you guys are amazing to see, and amazing to work with, some people I really look up towards, not only helping everyone where needed, but also helping me when needed.

#bearMan

Friday 1 November 2013

JDeveloper: Making the most of your IDE, Quick DB Check

Quick DB Check

Have you every wanted to quickly double check your database is connecting to the correct SID or IP?

All you need to do is, click on Application Resources and expand connections > Database and select the connection you want to check.


#bearMan, save some time :)

Wednesday 30 October 2013

Linux - Routing

Linux - Routing

So in the past week I have had a challenge with regards to Routing in IPTABLES, and one of the problems I faced was I had no GUI to implement it, only terminal.

I needed routing enabled on network card: eth0

I am assuming you are logged in as root.

IPTables


The first thing we need to do is check to see if iptables are enabled, or just enable them.
One way to see if your iptables are enabled it to run
iptables -L
iptables -L

to enable the iptables temporarily, run
iptables start

if you want to enable iptables on boot us this
chkconfig iptables on

Routing


Now that we have iptables enabled, we can start with the forwarding.

Firstly check to see if the network device has forwarding enabled
by running 
cat /proc/sys/net/ipv4/conf/eth0/forwarding

if this returns 0, run this
echo '1' > /proc/sys/net/ipv4/conf/eth0/forwarding


Now that this is enabled, we need to enable MASQUERADE.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Ok, so I needed to route two ports, SSH and HTTP, the IP i needed routing two was 192.168.1.18
To do that I used these commands:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 9022 -j DNAT --to 192.168.1.18:22
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 9001 -j DNAT --to 192.168.1.18:80

To make sure these have been enabled, you can use more than one command but the one I prefer is
iptables -t nat -L -n -v


Note: This is what I did to get routing working on OEL5, if this does not work for you, please leave a comment and I will try help you as much as I can.

#bearMan out.

Monday 28 October 2013

https://forums.oracle.com/thread/2596857

I tried to reply to you.

https://forums.oracle.com/thread/2596857




Sorry..

#bearMan

ADF - Region Error Multiple Root Components

The region component with id: x has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.

This error does not have anything to do with your Page holding your Region, it has to do with your Region (r1 - tfdAssignGraph).

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core">
  <af:decorativeBox id="db1">
    <f:facet name="center"/>
    <f:facet name="top"/>
  </af:decorativeBox>
  <af:decorativeBox id="db2">
    <f:facet name="center"/>
    <f:facet name="top"/>
  </af:decorativeBox>
</jsp:root>


You can solve the issue by having some other component as the "Root" component, like this:
Resolved is replacing what you have with one "Root" Component.

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core">
  <af:panelGroupLayout id="pgl1">
    <af:decorativeBox id="db1">
      <f:facet name="center"/>
      <f:facet name="top"/>
    </af:decorativeBox>
    <af:decorativeBox id="db2">
      <f:facet name="center"/>
      <f:facet name="top"/>
    </af:decorativeBox>
  </af:panelGroupLayout>
</jsp:root>

I hope this helps.

#bearMan

Friday 25 October 2013

ADF CheatSheet: Create Bindings Quickly

ADF CheatSheet: Create Bindings Quickly


Hello and welcome back to my evolutionary blog ;)

Have you ever needed to create many Page Bindings, quickly, but not needed a UI for them?

A quick way to create them is to find the attribute you needed in the Bindings area, and drag and drop that binding as though you were creating the UI for it. Once the UI part of it is done, you can cut that component off, there will be a dialog to ask if you want to remove the Bindings as well, and you must say no.

ctrl+X

Before
After

#bearMan out.

Wednesday 23 October 2013

ADF - Synchronizing form with recursive tree


ADF - Synchronizing form with recursive tree

We have a recursive tree, and we need a table to be edited. The form needs to update on tree selection.

Firstly, I am am going to be using the HR schema and the Employees Table.

My Data Controls
Data Controls, with employee Recursion

Firstly I created the Tree on the page (With the Employees1 Data Control) this resulted in the following bindings:

Page Bindings - Tree


Then I Created the Form on the Page (with EmployeesForm Data Control), this resulted in the following Bindings.
Page Bindings - Tree and Form
Once that was completed, I selected the Employees1 Binding, and changed the EL Expression, by clicking the "EL Picker" button, selecting the "EmployeesFormIterator".

EL EXpression Picker
Then on the Page, I changed the Forms Partial Trigger to being the Tree

Then you are ready to go.

Run the Application, and here are two screen shots of the results.

Screen Shot 1

Screen Shot 2

Hope this helps you.

#bearMan out.

ADF - Tree Table Display Field

ADF - Tree Table Display Specific Field

If you need to display a certain field in within a tree Component, but are not wanting to display that attribute, this will help you to display.
Unclean Display
Clean Display

if you only want to display one Attribute, you can follow these steps.

Firstly you need to click on the tree, and take note of what attributes you want to display.
Country Display Attribute
For this Tree level we want to display the Country Name -> "CountryName"
Location Display Attributes
For the second level of the tree, we want to display the Province -> "StateProvince"

Once you have gotten that, you must go to the page, and select the tree you want to display.
Change the Output text Value from #{node} to #{node.CountryName}
Output Text Value Selection and Change
Add a Output Text to the Node Stamp, this can either be done using the component Palette or By Coping and Pasting the Current Output Text.

Once that has been done, select and change that value to "#{node.StateProvince}"


The reason this works is because when there is no country there will be nothing in that Output Text.

If you get an error while doing this, you can change the rendered Value to 
#{node.StateProvince eq null?"false":"true"}

Enjoy ;)

#bearMan

Tuesday 22 October 2013

Linux - Port Scan Command

Linux - Port Scan Command

Yesterday I was tasked to get open and closed ports on a specific IP address.

I found a website that I started from http://www.catonmat.net/blog/tcp-port-scanner-in-bash/

Once I was there I modified his one procedure and came up with mine.


scan() {
  if [[ -z $1 || -z $2 ]]; then
    echo "Usage: $0 <host> <port, ports, or port-range>"
    return
  fi

  local host=$1
  local ports=()
  local endS=0
  local exS=''
  case $2 in
    *-*)
      IFS=- read start end <<< "$2"

      if ((end - start > 10)); then
        endS=$start
        while [ $endS -lt  $(($end-10)) ]; do
          endS=$(($endS+10));
          (scan $host $(($endS-10))-$endS) &
        done
        wait
        echo "done $(date -d "today" +"%Y%m%d%H%M")"
        return
      fi

      for ((port=start; port <= end; port++)); do
        ports+=($port)
      done
      ;;
    *,*)
      IFS=, read -ra ports <<< "$2"
      ;;
    *)
      ports+=($2)
      ;;
  esac

  for port in "${ports[@]}"; do
    timeout 1 bash -c  "echo >/dev/tcp/$host/$port" &&
      echo -e "<$(date -d "today" +"%Y%m%d%H%M")>\t<$host>\tport $port is open" >> ~/Documents/@hack/log-$host.log ||
        echo -e "<$(date -d "today" +"%Y%m%d%H%M")>\t<$host>\tport $port NOT open" >> ~/Documents/@hack/log-$host.log
  done
}

Example use:
scan www.bjorn.co.za 80


#bearMan

Monday 21 October 2013

JDeveloper: Making the most of your IDE, Java Block Coloring

Java Block Coloring

JDeveloper has an awesome feature of coloring some of your java Code Blocks.

This is a nice feature and can be useful when Coding.

Below is an image of the "default" look.

No Coloring
You can enable this through the icon pointed out below.
Icon to Color
An example of what the code looks like when its colored.
Code Colored

Enjoy!

#bearMan

Friday 18 October 2013

JDeveloper: Making the most of your IDE, External Applications

External Application

I had this issue of when I am working on my projects I either get lazy and don't want to navigate to where the application is, or I need to edit a file outside of JDeveloper.

JDeveloper has built in functionality to allow us to execute external application. This is how to do it.

Step 1: Click on tools and then External Tools
Step 2: Click on Find Tools
 If you are happy with just those Tools then proceed to step 9. If you want to include an external tool, then you can continue to step 4.

Adding a "External Tool Manually"

Step 4: Click on new after that, a popup screen will be displayed.
Step 4: Keep the Tool Type as External Program, and click next.
Step 5: Browse to the application you want, in "Program Executable", in the "arguments"choose insert, all the rest should be inserted automatically.
Step 4 and 5

Macro, Argument
Step 6: Choose for yourself, what you want to name the shortcut and add a ToolTip.
Viewing Names

Step 7: The next step, you will be selecting where the application will be displayed.
Shortcut Location
 Step 8: Once you have completed the location settings, you choose under what conditions your shortcut will be displayed / enabled. Once you have done this, click Finish.
Display Criteria
Step 9: Save Changes, and click Ok.

Results




#bearMan out.