I am working on an iOS application where I want to use PhoneGap as well as a native iOS View. I want iOS view to be the first page from which user can navigate to a view created by PhoneGap. I have developed iOS applications either completely using PhoneGap or native APIs, but never tried to use both in the same application. So figuring out how to do that took some time and I thought I would share that here.
By the way, if you want to embed PhoneGap WebView into existing iOS project then follow instructions at Embedding WebViews. In this post I am going to explain how to embed native iOS view into a PhoneGap project and set it as the initial page.
First you create a PhoneGap project. I created the project using Command Line Interface of PhoneGap 3.1. Go to the folder where you want to create the project and run following command (I am assuming project name to be iOSPhoneGapProject here)
$ phonegap create iOSPhoneGapProject ram.kulkarni.iOSPhoneGapProject iOSPhoneGapApp
Continue reading “Using iOS Native Views in PhoneGap Projects”
The day 1 of CFSummit2013 was great. It started with Ben Forta’s keynote. It was, as expected, excellent. He talked about the history of CF, how it’s goal is still the same (productivity) and which features have worked really well and which ones did not work. It was followed by Rakshith’s demos of some of the new features in the next release of ColdFusion (code named Splendor). He touched upon language enhancements, improvements in PDF generation and Mobile features. My demos of mobile features followed Rakshith’s demos. Unfortunately by the time I walked up to the stage to present demos, we had almost ran out of time. So I had to rush through my demos. I had planned to show a demo of debugging mobile application running on a device using ColdFusion Builder, but could not do so. I was told that there were a few issues with audio and display screen during the keynote.
Adobe had set up a table where CF developers could meet and talk to CF team members. Many attendees came there and showed interest in the mobile work flow that we had presented. I also attended Simon Free’s session on Mobile development features in Splendor. He did an excellent job of explaining what cfclient is and some of its features. In the limited time that we had in keynote, we probably could not explain what cfclient was, but I think after Simon’s session people got pretty good idea of what it is. I am looking forward to the second part of Simon’s talk today.
I am back to writing blog after a gap of nearly two months. Past few weeks had been very busy working on new features of ColdFusion and creating a mobile app for CFSummit2013 . I along with my colleagues Asha and Rakshith had been working on this app for nearly a month, though not necessarily full time. There were two main reasons for building the app 1. to use mobile features of next ColdFusion releases to provide feedback and catch bugs 2. to create a useful app for the attendees of CFSummit.
I don’t know if attendees would find the app useful (I certainly hope so), but we were able to provide a lot of valuable feedback on ColdFusion mobile features and catch many bugs. The application took more time than it should have, because the mobile features of ColdFusion were still under developement. We would hit a bug and would have to wait (if it was a blocking issue) till it got fixed. In many case we did try to work around issues. But the whole process took a lot more time.
But this post is not about mobile features of ColdFusion and how they were used in the CFSummit app. I am going to talk about my experience in creating HTML5 UI for this app, the issues we faced and lessons learnt. Some of the UI issues are still unresolved.
Along with new mobile features of ColdFusion, this app is developed using JQuery, Bootstrap3, PathJS, JQuery Raty, Cordova (PhoneGap) and PhoneGap Build.
Eclipse 4.3 (Kepler) was released in June this year. There have been some changes to plugin dependencies in E4 RCP applications from version 4.2 to 4.3. I had created sample projects for my book using Eclipse 4.2. If you import those projects in Kepler, then applications would not work.
I have recreated sample projects for Kepler and have submitted them to PACKT. Hopefully they should be available for download soon.
However if you follow through code examples in the book by creating your own E4 RCP projects in Keper, then things should work fine. Eclipse RCP APIs haven’t changed, as far as code samples in the book are concerned. However some of the links mentioned in the book are different for Kepler. They are –
Application project wizard for E4 has changed a bit in Kepler. Now you have an option to create sample content (menus and views) in the wizard. Earlier you did not have this option and the wizard used to created sample content. This option is turned off by default. If you do not select this, then no menu options would be created. In which case skeleton sample application would look different from what is explained in the book.
If you select the above option, then along with menus and toolbar button, a view is also created.
To try out examples in the book, I would recommend that you select the option to create sample content and then delete the ‘Sample Part’ from Application.e4xmi (it is in Application->Windows->Trimmed Window->Controls->Perspective Stack->Perspective->Controls->PartSashContainer->Part Stack). You can also delete Java source file for this part (SamplePart.java in codesnippetapp.parts package). This will make the skeleton project same as explained in the book.
I was discussing with a couple of colleagues of mine yesterday about a HTML5 mobile application that we are developing, and one of the requirements was to pre-package database with the application. A few months back I had created an application that did just that. I thought the solution might be of interest to some of the readers of this blog.
Mobile (or for that matter non-mobile) browsers can create databases for your HTML5 applications. HTML5 provides APIs to create and access the database. But how do you pre-package the database?
The solution is not really to pre-package the database, but package data that you want a database to initialize with. I don’t think you can really package a SQLite database and ask browser to use it for your HTML5 application. You need to create database and tables when the application is run the first time and then load data packaged with the application. Let’s say we want to create a table called ‘person’ and want to populate this table when the application is run the first time. Continue reading “Pre-packaging database with HTML5 Mobile Application”
I use JavaCC for generating parsers in Java. And use JJTree to create AST after parsing. JJTree creates nodes of the AST and you can configure JavaCC options to capture tokens in the node – i.e. if you want each node to contain start and end tokens. The default code generated by JavaCC creates Token class with offsets that are relative to the starting offset of the line. It has fields like beginLine, beginColumn, endLine and endColumn. Here the line numbers are absolute line numbers (starting from 1) and column fields contain offsets (again starting from 1) within the corresponding lines.
However many times you want to capture absolute offsets of tokens in the input stream, and not just relative offset in the line. I wish there was a JavaCC option to enable this. But it is not too complex if you want to do it yourself.
To explain how to do this, I will take a grammer file that is generated by the JavaCC wizard of JavaCC Eclipse plugin. This is the default grammer file it generates – Continue reading “Capturing absolute offsets for JavaCC/JJTree tokens”
Last year I blogged about creating a recordable HTML5 Canvas. I explained how to record strokes/drawings created on a HTML5 Canvas and play them back. There are a couple of comments on that post asking me to explain how to save recordings and load them back. Serialization and deserialization of recordings was on my to-do list for a long time and finally this week I got around to implement it. There are different ways to serialize and deserialize recordings, and I have implemented a simple method – using JSON. The serialized data is a bit verbose because of descriptive variable names I have used, but you can change that easily.
RecordableDrawing (in this script file) function remains unchanged. I have added a new file drawingSerializer.js . Two important functions in this file are serializeDrawing and deserializeDrawing.
serializeDrawing takes a RecordableDrawing object as argument and returns JSON string containing array of recordings.
deserializeDrawing takes a String (serialized data) as argument and returns array of Recording objects.
To see how serialization and deserialization works, follow these steps – Continue reading “De/Serializing Recordings in Recordable HTML5 Canvas”
I am currently building a parser using JavaCC. I have used JavaCC in the past, but whenever I use it after a long gap, I have to relearn a few things about it – particularly handling warnings. So I thought this time I would blog about ways to handle some of the frequent warnings that I have seen.
If you are unfamiliar with JavaCC, then it is a parser generator. You create grammer using EBNF (Extended Backus-Naur Form) and feed it to JavaCC. JavaCC then creates Java classes for the parser. I do not want to make this post into JavaCC tutorial. There are some very good tutorials available at JavaCC Documentation page and FAQ. I especially find Lookahead MiniTutorial and Token Manager MiniTutorial very useful. If you use Eclipse IDE, then you would find JavaCC plugin for Eclipse useful – it provides wizard to create JavaCC or JJTree (JJTree creates AST, Abstract Syntax Tree, after parsing the input) files, provides code colorization, outline, code hyper link, syntax checking and compilation. You can also set JavaCC debug options easily using this plugin.
I will use following tokens that are generated by default if you use the wizard provided by JavaCC Eclipse plugin to create a JavaCC grammer file. I have created a .jjt file for examples in this blog.
Continue reading “Handling some of the warnings and errors generated by JavaCC”
I am happy to announce that my book titled Instant Eclipse 4 RCP Development How-to has been published by PACKT Publishing. It is a mini-book that describes specific tasks and solutions to build RCP applications using Eclipse 4.
Eclipse 4 has introduced new frameworks, APIs and tools to develop Rich Client Platform (RCP) Applications. In this book I have taken a sample application and explained how to implement it from start to finish using Eclipse 4 SDK. The book is divided into a number of focused tasks. Each task builds the sample application incrementally .
Here is the list of tasks covered in the book –
- Setting up a development environment
- Creating a skeleton E4 application
- Adding menu and toolbar items
- Adding views
- Injecting your own objects using DI
- Creating a pop-up menu
- Creating custom events and handlers
- Adding a keyboard shortcut
- Creating custom objects using DI
- Creating views dynamically
- Styling an application using CSS
- Customizing and exporting the application
I was contacted to write this book towards the end of last year. Initially it got delayed a bit because I was busy with other things. It was finally published yesterday.
The book is also available on Amazon.
I have always configured and used Android SDK from Eclipse. In fact, ADT (Android Development Kit) bundle now comes with Eclipse IDE pre-configured for Android development. This makes using the SDK very easy. Options like configuring SDK manager and virtual device manager are available right from Eclipse menu.
However, I had a requirement where I wanted to run only Android emulator and not IDE. The Android SDK site has all the information to do this, but not in one easy to find place. So I thought I will write about it, for my own reference.
Continue reading “Installing and configuring Android SDK outside IDE”