Tuesday, September 20, 2016

ERROR TypeError: UIApplication.sharedApplication is not a function.

ERROR TypeError: UIApplication.sharedApplication is not a function. (In 'UIApplication.sharedApplication()', 'UIApplication.sharedApplication' is an instance of UIApplication)


In your Javascript remove () , change from :

QRCodeReaderDelegateImpl.prototype.readerDidCancel = function (reader) {
  UIApplication.sharedApplication().keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null);  this._callback(reader);};QRCodeReaderDelegateImpl.prototype.readerDidScanResultForType = function (reader, text, type) {
  UIApplication.sharedApplication().keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null);  this._callback(reader, text, type);};


To:

QRCodeReaderDelegateImpl.prototype.readerDidCancel = function (reader) {
  UIApplication.sharedApplication.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null);  this._callback(reader);};QRCodeReaderDelegateImpl.prototype.readerDidScanResultForType = function (reader, text, type) {
  UIApplication.sharedApplication.keyWindow.rootViewController.dismissViewControllerAnimatedCompletion(true, null);  this._callback(reader, text, type);};




Sunday, June 19, 2016

Your binary is not optimized for iPhone 5



If you get the folowing:

Do as per pictures:



to solve the following issue.




ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a launch image referenced in the Info.plist under UILaunchImages with a UILaunchImageSize value set to {320, 568}. Launch images must be PNG files and located at the top-level of your bundle, or provided within each .lproj folder if you localize your launch images. Learn more about iPhone 5 support and app launch images by reviewing the 'iOS Human Interface Guidelines' at 'https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW5' and the 'iOS App Programming Guide' at 'https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/App-RelatedResources/App-RelatedResources.html#//apple_ref/doc/uid/TP40007072-CH6-SW12'."
ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a launch image referenced in the Info.plist under UILaunchImages with a UILaunchImageSize value set to {320, 568}. Launch images must be PNG files and located at the top-level of your bundle, or provided within each .lproj folder if you localize your launch images. Learn more about iPhone 5 support and app launch images by reviewing the 'iOS Human Interface Guidelines' at 'https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW5' and the 'iOS App Programming Guide' at 'https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/App-RelatedResources/App-RelatedResources.html#//apple_ref/doc/uid/TP40007072-CH6-SW12'."

Saturday, June 18, 2016

Nativescript {N} - build-tools/22.0.1/aapt failed with Nativescript android


If you get the following:

Error:Execution failed for task ':processNativescript-barcodescannerNativescript-telerik-uiDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/.../Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 2


Go to your build.gradle for your app and change from:

def computeBuildToolsVersion() {
   if(project.hasProperty("buildToolsVersion")) {
      return buildToolsVersion
   }
   else {
      return "22.0.1"   }
}

to

def computeBuildToolsVersion() {
   if(project.hasProperty("buildToolsVersion")) {
      return buildToolsVersion
   }
   else {
      return "23.0.1"   }
}

 You must install SDK buikd tool for 23.0.1 to get it work. NativeScrupt has a bug that does not work with SDK 22.0.1.

Saturday, April 30, 2016

Androids useful debugging information



Android: Refusing to read from unsafe file location
--------------------------------------------------------------
If you have files in other paths than  /mnt/sdcard
this is considered to be unsafe and Android will refuse to read it no matter if this is a video file in mp4, images in jpeg, jpg.

Have your files in /mnt/sdcard to read from .




Tuesday, February 2, 2016

Running Docker-machin in another location than C:/Users



In order to run docker-machine to other location than default, use the -s option or --stiorage-path as follows:

$docker-machine -s /f/.docker/machine/machines/ create --driver=virtualbox dev

However later docker runs will still point to default path, so in order to get the env to the new docker-machine you ahve to run the followinG:

$docker-machine -s /f/.docker/machine/machines/  env dev

To change default pathway to docker use :
MACHINE_STORAGE_PATH=/f/.docker/machine/machines/

You can add this in your start.sh or ~/.bashrc or in windows env variable to use the other location.




Tuesday, August 25, 2015

Ignore changes in tracked files using GIT





Use:
git update-index --assume-unchanged <file>

To ignore changes in tracked files.


Use:
git update-index --no-assume-unchanged <file>

If you want to check in changes in those tracked files.



Wednesday, May 6, 2015

Rename VM to another name



In the command line run the followinG:

$vboxmanage modifyvm ORIGNAL_NAME --name NEW_NAME

Tuesday, April 28, 2015

Setting up boot2docker and working with live-reload directory the easy way



Checkout https://github.com/boot2docker/boot2docker/pull/534

Download latest boot2docker from:
https://github.com/boot2docker/windows-installer/releases

If you access the boot2docker VM via the following:
$boot2docker ssh

You will not be able to have access to your host developement files. To make your
developement files accessible do the following in Windows:

$boot2docker stop
$VBoxManage.exe sharedfolder add boot2docker-vm --name Users --hostpath C:/Users --automount.



Note 1: if you are using cygwin you have to use the syntax C:/Users, not C:\Users
Note 2:
hostpath Users` share at `/Users` in the boot2docker VM
hostpath /Users` share at `/Users`  in the boot2docker VM
hostpath c/Users` share at `/c/Users`  in the boot2docker VM
hostpath /c/Users` share at `/c/Users`  in the boot2docker VM
hostpath c:/Users` share at `/c/Users`  in the boot2docker VM


$boot2docker up
$boot2docker ssh "ls /Users"

Voila!  You will see your files inside boot2docker !

But how about using another path than Users above ?
Do as follows:


$VBoxManage.exe sharedfolder add boot2docker-vm --name Afrepo --hostpath F:/gitrepositories2 --automount

$ boot2docker ssh "ls /"
You will not find your Afrepo in the list, right? Try the following:
$ boot2docker ssh "mkdir /home/docker/Afrepo && sudo mount -t vboxsf -o uid=1000,gid=50 Afrepo /home/docker/Afrepo"


You files at F:/gitrepositories2 - in your host will be accessible inside boot2docker VM and finally to your docker !

Try the following:
$ boot2docker ssh
$docker run -v /Users/...:...   if you have used Users as sharename or
$docker run -v /Afrepo/...: ...  if you have used Afrepo as sharename




Tuesday, March 10, 2015

Setting up Docker and Boot2docker and shared folder MAc or Windows

On Mac:
$brew install docker
$brew install boot2docker
$ boot2docker stop
$ VBoxManage sharedfolder add boot2docker-vm -name home -hostpath $HOME
$ boot2docker up
$ boot2docker ssh "sudo modprobe vboxsf && mkdir -p $HOME && sudo mount -t vboxsf home $HOME"
You can now run docker -v transparently as long as the volume is inside $HOME
More tips:http://www.incrediblemolk.com/sharing-a-windows-folder-with-the-boot2docker-vm/
https://github.com/boot2docker/boot2docker/pull/284



Wednesday, December 31, 2014

vagrant/machine.rb:153:in `action': wrong number of arguments (2 for 1) (ArgumentError)


Change the line from :

                  def action(name, **opts)

to:
                  def action(name, opts)

in the file located at /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/machine.rb line 153.
This will be fixed in later versions of Vagrant after 1.7.1

Tuesday, December 30, 2014

Vagrant: Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available.



This is an issue of older version of VirtualBox. Download the latest virtual box from :
Virtual box Download site

You may need to do the following also if not resolved after upgrading to latest version:
$ vagrant plugin install vagrant-vbguest
More tips to solve the problems:
https://github.com/mitchellh/vagrant/issues/3341
https://www.virtualbox.org/manual/ch04.html#idp54932560

Tuesday, October 14, 2014

Caused by: org.apache.axis2.AxisFault: Address information does not exist in the Endpoint Reference (EPR).The system cannot infer the transport mechanism.



You may get the error as in my case :

<property name="wsdlFilename" value="MyServiceWS20Service.wsdl" />


The axis can not find wsdl somewhere as resource or misspelling.

Friday, August 1, 2014

Get http:///var/run/docker.sock/v1.12/info: dial unix /var/run/docker.sock: no such file or directory


If you are like me running on MAC OSX and you get this error because you have not started the docker and exported the DOCKER_HOST.
$ docker info
2014/08/01 17:34:31 Get http:///var/run/docker.sock/v1.12/info: dial unix /var/run/docker.sock: no such file or directory


Do as following to fix it:
$boot2docker

You will receive something like the following :
2014/08/01 17:34:21 Started.
2014/08/01 17:34:21 To connect the Docker client to the Docker daemon, please set:

2014/08/01 17:34:21     export DOCKER_HOST=tcp://134.155.10.100:2375

Export DOCKER_HOST in your command line:
$export DOCKER_HOST=tcp://134.155.10.100:2375

Check if you d not get the error again or DOCKER is working properly:


$ docker info
Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.15.3-tinycore64
Debug mode (server): true
Debug mode (client): false
Fds: 10
Goroutines: 10
EventsListeners: 0
Init Path: /usr/local/bin/docker


More good tips about docker:
https://gist.github.com/wsargent/7049221


Friday, July 11, 2014

Naive Bayes classifier using Mahout



Bayes was a Presbyterian priest who published "Tractatus Logicus" in 1795. Not far after his dead did anyone appreciate the value of his great work a century later in the scientific community. This is a study of Boolean Calculus (conditional probability).

This classifier is used in supervised learning data-mining.

In order to use Naive Bayes Classifier to classify the dataset and train it you need to use Hadoop to convert the data-set to Hadoop sequence files. Hadoop take the files as input files and generate one chunk-file.The Hadoop command below illustrate the use of Mahout to generate these files:

$./mahout seqdirectory -i ${WORK_DIR}/input_files -o ${WORK_DIR}/new_sequencefiles

This command take as input every files in the directory /input_files and transform them into a sequence  file.
Check the help command of mahout to find out more about the command:
$./mahout seqdirectory --help


The following Hadoop command examine the outcome of the sequence file:

$hadoop fs -text  ${WORK_DIR}/new_sequencefiles | more

A number of machine-learning and data-mining algorithms are based on the calculation of vectors that must be provided.

The naive Bayes algorithm does not work with words and raw-data, but works with weighted vectors associated with the documents. To transform the raw data or text to weighted vectors, the mahout-command provide an convenience way as follows:
./mahout seq2sparse -i ${WORK_DIR}/new_sequencefiles -o ${WORK_DIR}/new_vectorfiles
-lnorm -nv -wt tfidf

Refer to the helper manual for further understanding of -lnorm -nv -wt tfidf like L_2 norm, namedVector.

We now need to train the algorithm, The best approach is to split the vectors into 20-80 which the 20% of the vectors are preserved to test and the 80% is used to train the algorithm.
mahout provide a command line approach to split the weighted vectors:

$./mahout split
-i ${WORK_DIR}/new_vectorfiles/tfidf-vectors
--trainingOutput ${WORK_DIR}/new-train-vectors
--testOutput ${WORK_DIR}/new-test-vectors
--randomSelectionPct 40 --overwrite --sequenceFiles -xm sequential

After this command runned we will have two directories for training and test vectors.
We train first the Naive Bayes algorithm with the vectors from ${WORK_DIR}/new-train-vectors as follows:




Sqoop is an Apache software that is used to acquire data from RDBMS and import data into HDFS to prepare it to Mahout Analysis.


./mahout trainnb
-i ${WORK_DIR}/new-train-vectors -el
-o ${WORK_DIR}/model
-li ${WORK_DIR}/labelindex
-ow

This will generate a MODEL in form of binary file. This represents the weight matrix, the feature and label sums.

We test the algorithm against 20% of the initial input vectors:
./mahout testnb
-i ${WORK_DIR}/new-test-vectors
-m ${WORK_DIR}/model
-l ${WORK_DIR}/labelindex\
-ow -o ${WORK_DIR}/new-testing

After this command you will see a result of accuracy of the training. A result of accuracy at least 80% should be enough.

And use the following command to dump to a text file:
mahout vectordump -i ${WORK_DIR}/new-vectors/tfidf-vectors/
part-r-00000 –o
${WORK_DIR}/new-vectors/tfidf-vectors/part-r-00000dump

Checkout more on :
https://mahout.apache.org/users/classification/twenty-newsgroups.html










Thursday, July 10, 2014

Bitbucket: how to avoid writing password everytime in git to Bitbucket?



This can not be avoided. The only way is to cache it to get rid of typing everytime:

$git config --global credential.helper "cache --timeout=3600"

Wednesday, July 9, 2014

Information Retrieval Tasks

Here is a list of typical Information Retrieval Tasks:



Information filtering 

Remove redundant or undesired information from an information stream in semi or fully automatic methods before presenting them to human users. 

Document summarization
Create a shortened version of a text in order to reduce the information overload.

Document clustering and categorization 
Group documents together based on their proximity (as defined by a suitable spatial model) in an unsupervised fashion.
Clustering is an unsupervised technique that does not assume a priori knowledge: data are grouped into categories on the basis of some measure of inherent similarity between instances, in such a way that objects in one cluster are very similar (compactness property) and objects in different clusters are different (separateness property).
Classification is a supervised technique that assigns a class to each data item by performing an initial training phase over a set of human annotated data and then a subsequent phase which applies the classification to the remaining elements. Learnings are done either unsupervised or supervised. Techniques such as naive Bayes, regression, decision trees, and support vector machines are used in classification problems. Unsupervised learning models require priori knowledge about the classifications. In contrast Unsupervised learning models does not require pre-knowledge about the classifications and intrinsic  similarities in data is used as measurement in clustering of data. K-means is an example of clustering analysis. Objects are tagged to the clustered data once the classes are determined. This is known as labeling. In other words, the labeling is performed by automatically, no human is involved.

Question answering (QA) 
Select relevant document portions to answer user’s queries formulated in natural language.



Recommending systems
A form of information filtering, by which interesting information items (e.g., songs, movies, or books) are presented to users based on their profile or their neighbors’ taste, neighborhood being defined by such aspects as geographical proximity, social acquaintance, or common interests.

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