iOS Extensions – Getting started with “Custom Keyboard”

With iOS 8.0 Apple has provided app extensions that let developers extend custom functionality and content beyond a particular app and make it available for other apps.

Extensions available on iOS platform are listed as :

  • Action
  • Custom Keyboard
  • Document Provider
  • Photo Editing
  • Share
  • Today

In this blog we will discuss basics of creating a Custom Keyboard using extension.

A custom keyboard can replace the system keyboard for users who want to use a novel text input method or want to use a language not supported in iOS by default.
The essential function of a custom keyboard is just to provide the capability to respond to taps, gestures, or other input events and provide text, in the form of an unattributed NSString object, at the text insertion point of the current text input object.

Note : Use a Custom Keyboard extension only if you want to provide a systemwide keyboard. To provide a fully custom keyboard or some custom keys in system keyboard limited just to a single app, iOS SDK provides other, better options as described in Custom Views for Data Input in Text Programming Guide for iOS.

Continue reading

IKImageBrowserView – Know how to implement Grouping and Nesting

I believe if you are a Mac OS X developer you must be aware of IKImageBrowserView. If you are new to Mac OS X application development, then

The IKImageBrowserView class provides a view that displays an array of images. The size of each image depends on the zoom value that you set for the image browser view.

Details of how to create a basic image browser, implementation of drag-drop and other cool features are documented in ImageKit Programming Guide.

But in this blog we will not talk about the documented features of IKImageBrowserView which is readily available in  ImageKit Programming Guide.
Here we will discuss the least documented and the most awesome and powerful feature of IKImageBrowserView i.e Grouping and Nesting.

To have an idea of Grouping and Nesting , the objective is to create a GUI like shown in following fig :

ImageBrowser

Continue reading

How to calculate PBKDF2 key and HMAC hash using OpenSSL and C++

On Mac OS X, Cocoa applications are not the only choice. You might need to create a application in a cross platform framework such as QT Framework. In this case there could be a need to encrypt or create hash of some data.

In this blog we will see how we can generate a key using PBKDF2 algorithm and then using that key, we will see how to generate HMAC hash for any data.
I have used OpenSSL library and some C++ code to accomplish this.

First, add libssl.dylib in your project. On Mac OS X OpenSSl is by default installed so no need to download from anywhere.

Let’s declare a class to accomplish our task at hand.

class CHashGenerator
{
public:
std::string calculateHMACHash(const char* password, const char* salt, const char* data, int iterations);

private:
char* generateKey(const char* password , const unsigned char* salt, int iterations);
char pbkdf2Key[64];
char hash[41];
};

Continue reading

Featured Image -- 74

Tech Tip Tuesday: HTML Donut Charts and Apache Web Server on Mac OSX

Denny Lee

UntitledQuick tech tip for today, how to create HTML donut charts like the one below and use Apache Web Server on Mac OSX.  Hats off to the BI Happy Blog and Coolest Guy on the Planet Tech blog.   I wanted to quickly generate some mockup donut charts by using HTML – and being lazy, figured I would just borrow some code.

For starters, I needed to get Apache Web server started on my Mac OSX Mountain Lion – fortunately, the instructions are already provided – so here’s the link: Install and configure Apache, MySQL, PHP and phpMyAdmin on OSX 10.8 Mountain Lion.

The BI Happy Blog has a great one that allowed me to create a HTML donut chart with relative ease.   The original source code for this can be found at: http://bihappyblog.com/2012/03/29/google-visualization-donut-chart/

I have modified the code slightly so it can be run locally on my Mac OSX…

View original post 206 more words

AppleScript – XML Parsing

Although Cocoa has a class for parsing XML i.e NSXMLParser and if XML parsing is needed in a Cocoa application I would recommend to use NSXMLParser, But there could be a application which is not Cocoa based and needs XML parsing support through scripting.

For any such scenario we can use AppleScript to parse XML content. The following code will demonstrate the parsing of a sample XML. Continue reading

AppleScript – Get file information as shown in Get Info

On Mac OS X , Information such as “creation date” , “type” , “size” etc. about a file or folder can be easily seen by cmd+click and selecting “Get Info” for the selected file in a panel as shown in the figure.

Get Info Panel

Let’s see how can we get the information programmatically using AppleScript. Continue reading

Inter-Process Communication on Mac using Distributed Objects – Know How

Using Distributed Objects (DO) enables a Cocoa application to call an object in a different Cocoa application (or a different thread in the same application). The applications can even be running on different computers on a network.
Distributed objects operates by having the server make public, an object to which other client processes can connect. Once a connection is made, the client process invokes one of the public object’s methods as if the object existed in the client process.
Distributed Objects normally runs over mach ports but can also be used with sockets, allowing it to work between computers as well.

For more information on Distributed Objects architecture see here.

Let’s look at some client-server code using Distributed Objects for IPC.

Common Macros :

#define  ServerName  @”MyPrivateServer”

Continue reading