Read all files in a directory from a procedure.

For this aim you can use different ways.

The most used function UTL_FILE.FOPEN only accept a one file, it doesn´t accept * or a directory.

1 way:

Use DBMS_BACKUP_RESTORE. It,s from 10g version.

n VARCHAR2(1024);
SYS.DBMS_BACKUP_RESTORE.SEARCHFILES(DIRECTORY_NAME, n);

 FOR each_file IN (SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT) LOOP 
          dbms_output.put_line(each_file.name); 
END LOOP; 

With this solution you can filter the result to get only a type of files based in a extension or based in name,etc.

SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT
WHERE FNAME_KRBMSFT LIKE '%.txt%'

Maybe you need grants

  • grant execute on sys.dbms_backup_restore to hr;

If you have problems to read X$KRBMSFT table you can create a view and give grant to see that view to your user

  • create view vw_x$krbmsft as select * from sys.X$KRBMSFT;
  • grant select on sys.vw_x$krbmsft to hr;

And then change the select

SELECT FNAME_KRBMSFT AS name FROM sys.vw_x$krbmsft

2 way:

A java procedure  https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584

 

 

Calling a Stored Procedure without Arguments

If you need to call a procedure with no arguments , it´s ver simple as shows below.


// in AMImpl

public void callProcedure(){
getDBTransaction().executeCommand("begin PROCEDURE_NAME; end;");
getDBTransaction().commit();
}

If you need pass a IN or OUT arguments you have the doc oficial here http://docs.oracle.com/cd/E17904_01/web.1111/b31974/bcadvgen.htm#ADFFD1052

Docker and VirtualBox in Windows 10 Anniversary Update

Recently I installed the last version of Docker, with native support to Windows 10.
This version doesn’t need VBox to work but I have some vbox machines in my SO for other things/tasks/projects. The problem was those vboxs can’t run now.

I had this message: “VT-x is not available (VERR_VMX_NO_VMX)”

I try to disable Hyper-V in “Programs and Features” but it didn’t work

Finally the workaroud was to run bcdedit as admin and set hypervisorlaunchtype off

  • C:\WINDOWS\system32>bcdedit
  • bcdedit /set hypervisorlaunchtype off
    Reboot the SO and now run VirtualBox.  To turn Hyper-V on:
  • bcdedit /set hypervisorlaunchtype auto

Export excel with more 65K rows in ADF

When you work with a hugh number of rows with the af:exportCollectionActionListener you have a limitation about the number of rows.

This limitation is because file format.(xls). It is the maximum number of rows for the Excel 97-2003 . With xlsx format the maximum is 1M

As workaround you can build a custom export with POI or use ADF DI, a good option that I wrote about it time ago and the product has a good evolution

Deploy JET App in real Android device

To deploy our JET App in a real device we can use the next grunt sentence

  • serve –platform=android –device

To deploy the application in the phone connected yo PC through USB, is required

Finally you must enable USB Debug and development mode in yout phone.

You can check if your device is detected with

  • Path\to\adb\adb devices

Test your Hybrid App in an Android Emulator

  • Install Cordova
    • npm install -g cordova
  • Install Android Studio and add this environment variables
    • JAVA_HOME:JDK installation
    • ANDROID_HOME:Android SDK installation
    • PATH:add the Android SDK’s tools and platform-tools directories
  • Create your virtual device with Android Studio
    • Tools–>Android–>AVD Manager
  • Check out the API that use your virtual device, e.g if you use Nexus_5X_API_23 you must install API 23
    • Tools–>Android–>SDK Manager

Here is the official doc about JET Hybrid Development

  • To test your App with Netbeans you can use
    • grunt serve –platform=android –destination=Nexus_5X_API_23

nexusemulator

Integrate JET with jQuery UI

In Oracle JET we have a lot of components and we can create composite components.
But sometimes we need integrate components of the third-party libraries. In this post I explain how to integrate jQueryUI to use the components of this library.

  • Add jQueryUI library
    • ‘jqueryui’: ‘libs/jquery-ui-1.12.0/jquery-ui’
  • Add ‘jqueryui’ in require section of main.js
  • Add jQueryUI CSS in index.html
	<link rel="stylesheet" href=" //code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
  • Add jQueryUI component in your view section html
<div data-bind="jqueryUI: {component: 'datepicker', onSelect: dateSelector}">
</div>

Note: For this post I used jQueryUI 1.12 and JET 2.1.0

Oracle JET with font icons

with  Oracle JET is very easy use font icons in our applications.

We just have to do the following

  • download the library, in this case I use fontawesome
  • Copy the entire font-awesome directory into your project.
  • add css in your index.html
    • <link href=”font-awesome-4.6.3/css/font-awesome.min.css” rel=”stylesheet” type=”text/css”/>

And then you can use the styles in your buttons or somewhere

<i class="fa fa-camera-retro"></i> fa-camera-retro

<input type="checkbox" id="buttonIcon4"
data-bind="ojComponent: {
component:'ojButton',
icons: {start:'fa fa-camera-retro',
end: 'oj-fwk-icon-caret-end oj-fwk-icon'},
label: 'Toggle button with two icons'
}"/>

 

Pagination in JET table

if you have a hughe number of rows you can add pagination in your tables with ojPagingControl.

you add it above or below your table in your html viewModule

<div id="paging" data-bind="ojComponent: {component: 'ojPagingControl', data: datasource, pageSize: 2}"/>

 

and in your js file of the Viewmodule

  • add  ‘ojs/ojpagingtabledatasource‘ in the define
  • change the data value in PagingTableDataSource
self.datasource(new oj.PagingTableDataSource(new oj.CollectionTableDataSource(self.DeptCol())));

 

As result you will see as it show below

jetpagination