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.