December 23, 2015

Using Rating Gauge as Status meter in MAF

I got a scenario in one of my MAF apps where I need to show the percentage of user profile completed in a circular graphical view. So, I have used rating gauge component in MAF to show this. I felt this would be useful to you also, so I have made a video to explain the procedure.

Click here to watch how to use rating gauge as status/progress meter in MAF.

November 27, 2015

Connecting Git hub with JDeveloper 12c

I have created few screen shots which show how to connect Git hub from Oracle JDeveloper Studio. I have used JDeveloper 12.1.3.0 for this.

Click here for the screen shots.

November 21, 2015

How to import certificates to weblogic server

Below is the procedure to be done to import certificates to weblogic server.
  • Import or download the certificate to a local folder ex: D:\myprojects\Docs\certs\fap0424.cer ; where fap0424.cer is my certificate
  • Using below command, import the certificate to the weblogic server
keytool -import -alias fap0424  -file D:\myprojects\Docs\certs\fap0424.cer -keystore C:\Oracle\Middleware\JDev11.1.1.7.1\wlserver_10.3\server\lib\DemoTrust.jks
  • To verify the import, use below command which list out all the certificates in the weblogic server
keytool -list -alias fap0424 -keystore C:\Oracle\Middleware\JDev11.1.1.7.1\wlserver_10.3\server\lib\DemoTrust.jks

In the above example the file path C:\Oracle\Middleware\JDev11.1.1.7.1\wlserver_10.3\server\lib\DemoTrust.jks represents the weblogic file to which we should export our certificate.

November 18, 2015

java.sql.SQLException: stale connection

If you are getting the exception "java.sql.SQLException: stale connection" then you should check whether the Connection object is closed anywhere in the app and you are trying to access the same object. In this case, the object is closed and no longer available, so you can not do any execution on that object. 

Solution is to create a fresh connection object. 

If the error received in MAF apps, then remove the close statements as you don't need to close the connection in the mobile.

October 29, 2015

How to refresh a binding iterator through program

I have a data control created for a java class and using this I have created a table on a jspx page. On click of a button, I am doing some data changes in the bean and want to reflect them on the screen. Generally, we give partialTrigger to the table on the button which is alone not suffecient to update the content of the table on the page. The binding iterator has to be refreshed from the bean.

Below code snippet helps to refresh a binding iterator programmatically from ADF where "listRequestsIterator" is my binding iterator name on the page.          
   
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding)
bindings.get("listRequestsIterator");
iter.clearForRecreate();

September 11, 2015

ABC for kids - Android app for Kids

I have developed another android app for kids to learn basics like alphabets, numbers, colors and shapes etc.

Playing is the best way to learn and remember.

This app also provides simple play options which help kids to play around the basics they learnt.

Click here to know more about the app.

Click here to download the app from Google Playstore.

Have fun with “ABC for kids”!!!

To know others apps developed by me, visit Sonu Appz.



September 10, 2015

Search App

I have developed another android app, named it as "Search App". It is very simple app.

A single point to search any app on your device.

You may have many apps on your device. You may also maintain groups on your device for those apps. When you want to open an app, you have to travel till that app and click on it. If you have 5 screens on the home and if your app is on the 5th screen, you have to navigate to the 5th screen and open the app.

Search app will be single point to search and open any app on your device.


Just type few letters of your app name in the search field and your app will be filtered.
Just tap on it, your app will be opened.

 Search App

August 18, 2015

Connect Git hub with JDeveloper

This post is to learn how to connect Git hub server to JDeveloper. Github is providing a Github Desktop client to connect github repository. But if you are a JDeveloper user, then you can also connect the repository from the JDeveloper. I am using JDeveloper version: 12.1.3.0.0 in this example and below is the procedure to do it.

Open the JDeveloper. Under the Team menu select "Connect Git" option.

Below screen will be shown
Click Next. You will be prompted for Git details as shown below.
Enter Repository Name: This should match with any branch name in the repository you want to connect.
Enter repository URL: make sure you have ".git"  at the end of the URL.
Enter username and password of the repository.

Click Next. You will see a window fetching the branches from the given repository.

 It will list out all the branches in the given repository as shown below.
 Un-select the branches which are not required.

Click Next. Below window will be shown which prompts for destination folder to where the project will be downloaded from the selected branch, clone name and check out branch from which you want to download the project.
Click Next. It will show the final summary window as below.

Click Finish. It will create a local repository and download the project from the selected Git branch to the local folder and open the project in JDeveloper.




July 16, 2015

WriteFiles

WriteFiles is a java tool to integrate several textual files to a single file. In some scenarios like where we need to copy all source code  or text files into a document or a text file. It is difficult to copy the content of all the files manually. For example, if you take java application where there will be several source files under different packages, it starts from a root directory (package), includes sub directories and their sub directories and so on. Each directory or sub  directory may have their individual java classes. If you want to copy all these source files including the files in the sub folders, think how difficult it is to do so. WriteFiles tool can help you to do the same.

Below is the GUI screenshot of the tool.





Click here to download the tool and also the source code of the tool can be downloaded from here.

June 27, 2015

InAppBrowser in MAF using Cordova plug-in

This post is to show how to implement In-app browser in MAF using Cordova plugin.

If you have a url in the app, on click of the url, the URL will be open in a browser but if you want to come back to the app, you have to open your app tray and select the app. If you implement in-app browser, the url will be opened in a custom browser in the app itself, and you can see a button like "Done" on the browser. On click of that, you can return to the app.

Below is the procedure to develop the in-app browser using Cordova plugin.
  • Download the zip file of the project from Github and unzip it
  • Create a folder with the name plugins in ViewController project in the app
  • Copy file plugin.xml and folders www, src from the above Github project to the plugins folder
  • Open maf-application.xml file and select Plugins 
  • Under "Additional Plugins", add the plug in. See below screen for your reference

  • Write the below code in a java method and assign that method as an action or action listener to an action component in your page
          String urlToPen = "http://myfusionlearnings.blogspot.com";
          AdfmfContainerUtilities.invokeContainerJavaScriptFunction(        
         AdfmfJavaUtilities.getFeatureId(),
       "function(){cordova.InAppBrowser.open('"+urlToPen+"','_blank',              
        'location=no,toolbarposition=top,clearcache=yes');}", new Object[] {});

June 24, 2015

Word Type Count

"Word Type Count" is a tool developed in Java, useful to count number of occurrences of each word in the given String. It also counts the total number of words in the given string. The tool would look like as below. 
Download the java program from here.


For example, in the above screen, we could see the input string "This is to count number of occurrences of each word in a given String". When the button "Count Words" is pressed, it will display the result in the output text box as shown in the screen in which we could see each word of the given input string and count of their occurrences. And also we could see at the end of the result, the total count (shown with the word "Size") of words in the input string. 

June 19, 2015

Java program to create Zip files

In this post, I wanted to show how to create a zip file using a java program.
In this example, input to the program is test.html and out put would be outFile.zip which contains the given test.html.

The same program can be downloaded from here.

June 15, 2015

FAQ Creator

"FAQ Creator" is a tool developed in java helps to create FAQ (Frequently Asked Questions) html files. This tool provides an user interface as below  and the procedure to add this tool is:

  • Provide a file name including path to which the content will be written.
  • Enter a question and its answer in the corresponding text fields.
  • Click on "Save&Next" to save the question and answer to the buffer. And the same will be added to the list box in the left side of the GUI. 
  • If you want to edit the question or answer, select the question from the list box. The question and the answer will be displayed in the corresponding text boxes, so that they can be modified, or click on the "Delete" button to delete the same question from the list or buffer.  
  • Once all the questions and answers are entered in the tool, click on the button "Done". It will write the content from the tool to the file with the given name. 



Below is the sample output of the tool.


Click here to download the tool. And source code of this tool also can be downloaded from here.

June 5, 2015

Tool to import data from Excel To Database

Description:

                 ExcelToDB is a tool developed in java to import data from MS-Excel to different data bases like MS-Access or Oracle. Currently this tool supports only these two database, but you can extend it to other databases if you required.

Click here to download the tool. You can also get the source code of this tool here and you are free to edit the code as per your need.

Procedure:
  • Double click on the executable jar file ExcelToDB.jar or run the java command “jar –d ExcelToDB.jar” to open the tool

  • Choose the source excel file (.xls or .xlsx) from which the data to be copied
  • Enter the sheet name of the excel file where the data is existed (Default value is Sheet1)
  • Select the data base type either MS-Access or Oracle 
  • If Access is selected, the window will be as follows
  • Choose the target MS-Access database file
  • And also pass the table name, user name and password of the database
  • If the databse type is selected as Oracle then the window will be changed as below
  • Pass the host name of the oracle server, table name to which the data to be copied, user name and password of the database to the tool
  • Click on “Click the button to import” to start the process of importing data from excel to the database



June 4, 2015

Box Game

BoxGame is a  number game developed in java, which opens a window with 16 cells filled with numbers from 1 to 15 and a blank cell filled with green color. All these numbers including blank cell are arranged randomly across the window. Use the arrow keys to play the game. When you press any arrow key, the blank cell will move accordingly.

For example, if you press left arrow key, the blank cell will move left, if you press up arrow key, the blank cell will move up. When the blank cell is moved, it will swap its position with the corresponding cell. By this process, you have to arrange the numbers from 1 to 15 in an ascending order, ignoring the blank cell, which means blank cell can be in the first position or at the last position.

Click here to download the game.

June 3, 2015

Access To Excel

AccessToExcel is a tool developed using VBA script in MS-Excel. This tool is a macro enabled excel file. This tool helps to import data from MS-Access to MS-Excel. When the file is opened, it will open an input text box where we need to provide the path of the MS-Access file from which you want to import data and table details, then the tool will import entire data from the table to the MS-Excel file.  

Click here to download the file.

Note: This tool can not work for password protected MS-Access files.

April 8, 2015

Run Android Apps on your Mac or PC

Do you have Chrome on your Mac or PC? Then you can run android apps on your Mac or PC.
Google has come up with App Runtime for Chrome (ARC).

Pre-requisites:
  • You need Chrome browser for sure to start with it
  • apk file of the app  you wanted to install 

Procedure:

      Below is the procedure to setup and install the apk file.
  • Install the "ARC Welder" extension on the chrome. Click here to install it.
  • After installation is done, you can see an icon with the label ARC Welder on the chrome apps tray 

  • Click on the icon. A new window will be opened as shown below

  • Click on "Add your APK" and choose the path of your apk file
  • It will show the window like below

  • Choose the orientation, form factor and click on the button LaunchApp
  • Now the app will be launched in a new window
  • You can also download the chrome package for the app by clicking the button DownloadZip on the above screen

References:

April 4, 2015

javax.net.ssl.SSLKeyException: failed hostname verification

Problem:
When my adf web application executing a web service call, I got the below error which was failed to verify the hostname.

javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: [Security:090504]Certificate chain received from XXXXXXXXXXXX.demos.com - YY.YY.YY.YY failed hostname verification check. Certificate contained *.demos.com but check expected XXXXXXXXXXXX.demos.com


where XXXXXXXXXXXX.demos.com is my host name.

Solution:

To avoid this error, we have two solutions. One is to make weblogic ignore the host name verification and another one is to ignore verification through code. We can use either of these solutions to avoid the above error.

The first way is the weblogic should ignore the host name verification. To do this, follow the below procedure.

  • Login to weblogic console
  • Go to Servers, then click on the server name (in my case the name is DefaultServer)
  • Go to SSL tab
  • Under the Advanced section, you can see the property "Hostname Verification"
  • By default, it value is "BEA Hostname Verifier". Change this value to "None"
  • Click on Save and restart the server
  • Run again the application now

And the Second way is to write a code snippet to ignore verification of host name. Below is the java code to do so.
     
TrustManager[] trustAllCerts =
            new TrustManager[] { new X509TrustManager() {
                public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                    return null;
                }

                public void checkClientTrusted(java.security.cert.X509Certificate[] certs,
                                               String authType) {
                }

                public void checkServerTrusted(java.security.cert.X509Certificate[] certs,
                                               String authType) {
                }
            } };

        SSLContext sc = SSLContext.getInstance("SSL");
        sc.init(null, trustAllCerts, new java.security.SecureRandom());
        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

        // Create all-trusting host name verifier
        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                System.out.println("HostnameVerifier - "+hostname+" Session: "+session);
                return true;
            }
        };
        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);


Note: These two ways are only for testing purpose, may not suggestible to use in production environment.

April 3, 2015

oracle.security.jps.JpsRuntimeException: Cannot read from policy store

Problem:
While running my integrated weblogic, I got an error like below.

oracle.security.jps.JpsRuntimeException: Cannot read from policy store. Reason is PolicyStore Error, javax.xml.stream.XMLStreamException: Error at line:332 col:25  ' '

Solution:
To solve this error, the weblogic domain should be deleted and start the weblogic again. Then it will create a fresh domain.

March 25, 2015

Fun Facts

Do you want to improve your knowledge?
Do you want to impress friends with some facts?
Then Fun Facts app is for you.
"Fun Facts" is an android app shows some quotes which are funny but real facts.
Install the app @ https://play.google.com/store/apps/details?id=com.sonuappz.funfacts

February 2, 2015

AlarmManager

If you want to run a piece of code in the background at certain intervals, then AlarmManager is the class helps us to do this. It will wake up the device on the given intervals and invokes the Receiver class where we should write our code to run in the background. Below code snippet explains how to implement AlarmManager.

Intent notificationIntent = new Intent(context, LoadData.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent   pendingIntentSyncDB;= PendingIntent.getBroadcast(context, 0,
                                notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);

AlarmManager alarmManager = (AlarmManager)  getSystemService(Context.ALARM_SERVICE);
int intervalTime = 1000 * 60 * 5 ;// 5min
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),  intervalTime, pendingIntentSyncDB);

In the above snippet, LoadData is a broadcast receiver class which executes the background code. AlarmManager invokes the LoadData for every 5mins.

January 29, 2015

Board Puzzles

This is extension to my previous post BOARD PUZZLES.

An update to my app Board Puzzles is available in the Google Play store.

The same can be available at the below link.

https://play.google.com/store/apps/details?id=com.sonuappz.numbergame

Please install/update the app and have fun.


Visit my apps blog : http://sonuappz.blogspot.com

January 19, 2015

BOARD PUZZLES

I have developed an android app named “Board Puzzles” which is available in Play store now.

It is a board puzzle gaming app which has options to choose number or alphabets to display on the board. 
It is a puzzle gaming app where user has to arrange the numbers or alphabets on the board from least to greatest.

This app supports both android phones and tablets, and also supports 8038 types of devices.

Please visit the below link and install the app on your android devices.


Rate the app if you like it. Have fun !!

Click here to visit Sonu Appz (name for my apps account) blog.



January 16, 2015

android.os.NetworkOnMainThreadException

android.os.NetworkOnMainThreadException  is an android runtime exception which occurs when you are trying to run any network or IO related operations from main activity. Android doesn't support to run IO operations directly on the main activity. 

So to avoid this exception, use a thread to do these operations or you can also use AsyncTask class which helps you to run the code in the background.