Scriptico

HP IDOL OnDemand. Query Text Index Example with UI

With the Query Text Index Swift Example article, I demonstrated how to query text indexes in IDOL OnDemand. A simple RESTful client was created to make a call to API and output the result. For that example, I used Xcode Playgrounds and unfortunately, I did not find a way to make UI written in the playground responsive to user’s actions (text inputs, button clicks, etc.). Eventually, I came to the conclusion that for now such features are simply not supported, and decided to make a simple iOS application to demonstrate how to communicate between UI and the client; this article describes how to do so. Let’s begin! Read the rest of this entry »

HP IDOL OnDemand. Query Text Index Swift Example

HP IDOL OnDemand provides format conversion, image analysis, indexing, and text analysis RESTful APIs to help the developers process unstructured data and build amazing, innovative, flexible, and robust solutions.

The following article demonstrates how to consume one of the available HP IDOL OnDemand APIs and query a text index from an application written with Swift, a new programming language for iOS and OS X. Let’s start from the basics. Read the rest of this entry »

Issue with Facebook Key Hashes for the Android Application

During the last three months I have been working as a developer for a consulting android project. It is actually my first commercial experience (I do not count written demo examples at my previous work) and I found it extremely interesting, though a quite confusing at some moments.

The following article describes an observed problem with the facebook key hashes for the android application. To describe the problem and its solution, let’s define a simple use case.
Read the rest of this entry »

How to restart an application in android programmatically

The following code snippet shows how to restart an android application after the specified delay programmatically:

public void restart(int delay) {
	PendingIntent intent = PendingIntent.getActivity(this.getBaseContext(), 0, new Intent(getIntent()), getIntent().getFlags());
	AlarmManager manager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
	manager.set(AlarmManager.RTC, System.currentTimeMillis() + delay, intent);
	System.exit(2);
}

Related API:
PendingIntent
AlarmManager

How to minimize an application in android programmatically

The following code snippet shows how to minimize the current application in android programmatically:

Intent main = new Intent(Intent.ACTION_MAIN);
main.addCategory(Intent.CATEGORY_HOME);
main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(main);

Related API:
Activity