Wednesday, June 29, 2016

Android: mvn clean install fails and asks for ANDROID_SDK path

Here's a way how to provide ANDROID_SDK path to Maven mvn clean install call:

mvn clean install -Dandroid.sdk.path=/home/path1/sdk1

Android Development - using native .so libraries


Class using native libraries (.so) does not work, and LogCat shows warnings like this:

android eclipse Rejecting re-init on previously-failed class java.lang.Class< ***SOME CLASS**>

Problem description:

Basically, if you cannot get the native library to load, and you have included both the .jar file (in libs folder in Eclipse) and .so file (in approprate armeabi / armeabi-v7a folder), you should first check the full stack trace for the error.
In LogCat, let the program run after the exception. It should point out something like "Cannot load class XYZ", which is probably the root cause of the issue.

In case you cannot load class com.sun.platform or something similar, you should include jni.jar inside your libs folder, and delete all incompatible .so files inside of that .jar (for example, for linux, freebsd and other OSes). Also, you should include appropriate in your armeabi folder.

Monday, June 27, 2016

Eclipse - Android project crashes with errors like "Cannot determine URI for /"

If your Eclipse project has crashed with the errror like "Cannot determine URI for /", then here's what you can  try:

You can solve the problem by trying this:
  • Right click Package Explorer
  • Select Import
  • General > Existing Projects into Workspace > Navigate to the project
    folder(Select root directory)
     > select the Project.
  • Finish. This will certainly solve your problem.
If this doesn't work proceed to File System (General>FileSystem) and select the project files.
First method is quite easy and works perfectly in most cases.

Thursday, June 23, 2016

Converting a bitmap (.bmp) to data URI using Java

If you want to show a bitmap (encoded in base64) in <img src>, and you are using Java Convert class to do the conversion to base64, make sure you use Base64.NO_WRAP instead of Base64.DEFAULT as the second parameter (otherwise, you'll get blank or  broken img in img tag).

Friday, June 10, 2016

Experiences with maven

mvn clean install seems to be the most powerfull command in maven :)

mvn clean install does not seem to be recursive in it's nature, or at least it does not always report failures on any sub-projects

mvn clean install should be called locally

Maven is build around concepts of Plugin (java code) and Repository (pom files + output of projects, usually in ~/.m2 on Ubuntu systems).

It's an idea, of DSL from config files (POM).

Thursday, June 9, 2016

AngularJS - ng-options is very sensitive to type information

In ng-options, "0" (string) and 0(int) are completely different states.

Reduction to minimal number of parameters

If function call fails with N optional parameters,

the first appproach is finding the minimal number of parameters which make the function succeed.

After that, we proceed by identifying the important params which decide whether the function will fail or succeed.

Usually, if function of a remote service asks for 30-40 parameters, only 1 or 2 are the really important ones (like EntryID field which identifies the actual record in the database).

Wednesday, June 8, 2016

bootstrap's data-spy="scroll" can cause elements to disappear

If you are using a plain old standard bootstrap, and you seen some elements disappearing on scroll, make sure that you delete these entries in your html:


That way, you will disable Bootstrap's AFFIX plugin (which is a cool plugin when you need some more  advanced stuff).

PSR-1 and PSR-2 coding standards for PHP

Visual aspects of code play a significant role in raising or drowning developer's productivity. In case that there's too much clutte...