Sunday, June 15, 2014

java.io.FileNotFoundException: content://media/external/video/media/


The content://media/external/video/media/ is URI type and you need to query MediaStore to get full path name to the file.
Something like below:

public static String getFilePathFromContentUri(Uri selectedVideoUri,
        ContentResolver contentResolver) {
    String filePath;
    String[] filePathColumn = {MediaColumns.DATA};

    Cursor cursor = contentResolver.query(selectedVideoUri, filePathColumn, null, null, null);
    cursor.moveToFirst();

    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
    try {
    filePath = cursor.getString(columnIndex);
    } catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
                //Need this in case the file not exist
    return null;
}
    cursor.close();
    return filePath;
}

Saturday, June 7, 2014

***ERROR*** No Facet of type [interface org.jboss.forge.addon.javaee.jpa.JPAFacet] is installed.



If you are running Forge 2 and get the message below
***ERROR*** No Facet of type [interface org.jboss.forge.addon.javaee.jpa.JPAFacet] is installed.

This can be inconsistency in the pom.xml. Try to remove or move pom.xml to another safe place
from the current directory and try again.

Wednesday, June 4, 2014

Convert from mp4 to mpeg in Ubuntu





Use ffmpeg utility, it's awesome.

1. Install:
sudo apt-get install ffmpeg

2. Convert:
ffmpeg -i input.mp4 output.mpeg

PS: For available formats supported by ffmpeg:
ffmpeg -formats

Monday, June 2, 2014

1099 is already in use on MAC, how to kill


I had an issue with the following error:
localhost:1099 is already in use

To kill the process blocing 1099 run the following:
$lsof -i :1099
COMMAND   PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    19327          user  451u  IPv6 0x305bcf3e90cfdfc7      0t0  TCP localhost:rmiregistry (LISTEN)
$ kill 19327
$ lsof -i :1099