Dec 14, 2012

Parse Platform for Mobile apps


Parse is platform designed to offer a highly configurable backends that can be integrated with mobile apps and JS apps as well. This type of service is known as Backend as a Service, or BaaS for short. These services provide you with a package of backend storage and other functions that can be leveraged from your app, usually with a handy library on a variety of platforms (Android, iOS, Win, JS) to make integration nice and easy.

Parse stands out for being one of the the easiest and fastest backend services to work with, as well as having the best documentation. The documentation is easy to understand, as well as being comprehensive. Generally, it will take you less time to start uploading objects to Parse than any other service. Parse offers most of the features that you’d expect from a backend service provider, including the following:

  • Custom Objects: This is the ability to create custom objects from the app itself without the need to define a schema first, each object type is defined as a Class. The app will be able to access these objects and query them similar to a DB. The Parse SDK provides an easy way to take this data from object format, and store/retrieve it from the central database. 
  • Users: Parse provides the logic to create and authenticate users right out of the box. These users can even be integrated with Facebook/Twitter so that the user doesn't need to create a new account. These users can be used later on to authorize read/write operations on any object class using Access Control Lists (ACLs). 
  • Push Notifications: This is the ability to send a push notification to all your users, or to a selective subset of your users. In Parse, sending notifications is done from the Web Console, the REST API, the Cloud Code or even triggered by the existing client SDKs. 
  • Social Integration (Facebook / Twitter): Additionally to having your own users storage, you can also enable the user to login through Twitter or Facebook. The SDK will take care of the OAuth process and even cache the credentials while still using the same ACLs for authorization and security. 
  • Files: In addition to storing plain old data, sometimes you need to store files -- such as images, large documents, and the like. Parse will provide file storage that you can use to associate a file with a custom object. 
  • Geolocation: In mobile apps, it’s often useful to be able to perform queries of objects near a certain location. Parse provide the ability to tag your objects with a specific location so the user can make queries on objects based on location. 

A nice thing about Parse is that it has sample projects that you can download, as well as custom UIViews that you can add to your project, such as Facebook and Twitter login views. Additionally, there is a large collection of 3rd party libraries offered for use with the service. For example, integration with Twilio to send SMS messages from a mobile app.

The free plans that Parse offers are very good and offers enough capabilities for a small app. However, it's worth to mention that the price does seems to ramp up more quickly than other services if you exceed your free allocation.

The pricing of the tiers in Parse is based on API calls:

  • Free:  1M API Calls,    1M Push notifications (0.07 per 1k over), 1GB Storage (0.20 per 1GB over) 
  • $199: 15M API Calls, 15M Push notifications (0.05 per 1k over), 10GB Storage (0.15 per 1GB over) 

Is Parse the right choice for my project?


Advantages

  • Good features, pricing, and excellent documentation when compared with similar BaaS companies.
  • Custom UIViews that you can add to your project, such as Facebook and Twitter login views. 
  • Several sample projects that you can downloaded for reference and as a quick start. (FB authentication, file storage, push notifications, object-level security, geolocation). 
  • A large collection of 3rd party libraries offered for use with the service. For example, Twilio, Mailgun, SendGrid integration. 
  • New attributes can be added to a particular object class at any point. 
  • Ability to export all data stored in Parse to a zip file as JSON files (For stored files, an URL is provided on the attribute). 
  • Importing Data: In addition to the REST api, data can be imported to the backend through CSV files. 
  • Abstracts most of the complexity of Push notifications. 
  • Scalability is handled for you. 

Disadvantages

  • Not suitable for projects that require to handle complex logic on the server side. For example, each operation might affect many different classes. 
  • Data Type Lock-in. Once the first object has been created, its field are locked into the particular type that was saved. For example, if a User object is saved with field name of type String, that field will be restricted to the String type only. One special case is that any field can be set to null, no matter what type it is. 
  • While the free plans are very good, the price could ramp up more quickly than other services if you exceed the free allocation.

Aug 24, 2012

Is PhoneGap the right choice for X project?

Depending on the context of the project, needs of the client and time constraints we might consider using the PhoneGap framework to do the implementation of the app instead of going native. But, it’s the right technology for the task at hand? Here are some points that might help in the decision making process:

Phonegap good points:

  • Small learning curve for web developers since it uses known technologies such as HTML5/CSS/JS. The PhoneGap API offers a event model that is familiar to client side developers. It’s easier to find web developers than native iOS developers.
  • Single code base for all platforms (iOS, Android, Windows 7, mobile web).
  • Reusability: If the app is structured in modules, this could be potentially reused for a web app that shares common functionality.
  • Options: There are a plethora of different frameworks and libraries in the web that can be used to fulfill different needs in each app. For example: jQuery Mobile, Sencha Touch, JQ Touch, iScroll, SpineJS, just to mention a few.
  • WebKit: since both iOS and Android platforms rely on Webkit for their browsers, PhoneGap apps can use some of the latest HTML5 and CSS3 awesomeness.
  • Support for web version of Google Analytics.


Considerations:

  • Conditional code for each platform.
  • iOS issues:
    • Scrolling for iOS might have glitches handling large views.
    • Position:fixed style does not work in <iOS4. Although, it can be achieved using hacks or iScroll library, the are still some issues: http://remysharp.com/2012/05/24/issues-with-position-fixed-scrolling-on-ios
  • For large apps using a JS MVC framework is encouraged. SpineJS is a good option that includes also a flexible template engine.
  • CSS Media Queries can be used to handle the resolutions and orientation across devices.  For example, this technique can be used to load higher resolution images for bigger screens.


Summarizing, PhoneGap is a good option for projects where:

  • Need to deploy in several platforms.
  • Performance is not critical.
  • Simple apps with reduced budget or human resources for the project.
  • The hierarchy of views is not more than 5 levels deep.
  • Does not need to handle large images or too many of them in a single view.

Here is a infographic that might help further in the decision making process:

http://www.appliness.com/infographic-decision-path-to-phonegap/

Mar 11, 2012

Programación del FIA 2012 para móvil


Durante este mes de marzo, Costa Rica vivirá el acontecimiento de arte más importante del año donde las calles, avenidas, museos, teatros y escenarios abiertos de la capital costarricense se convertirán en focos de arte y cultura. El FIA este año tendrá a Corea del Sur como invitado de honor y ofrecerá a los asistentes más de 300 espectáculos con la participación de más de 1250 artistas nacionales e internacionales en eventos de altísima calidad.

Como parte de una iniciativa para ayudar a difundir la variedad de eventos que ofrece el Festival e invitar a más costarricenses a participar de esta fiesta cultural se crea el "FIA'12" app.  Esta es una aplicación que le permitirá tener acceso a la programación del Festival, conocer donde y cuando serán las presentaciones de cada evento, marcar un evento particular como favorito y más.



Estas son algunas de sus características:

  • Programación: Acceda al calendario de actividades del 15 al 25 de marzo así como también los detalles de cada evento. ¿Tiene interés en un evento particular? Márquelo como favorito para agregarlo a la lista de eventos preferidos. 
  • 'En este momento': Permite ver cuáles eventos están actualmente en curso tomando en cuenta día y hora. 
  • Favoritos: Aquí se guardan los eventos de tu interés. 
  • Mapa: Conozca la ubicación de los escenarios y tarimas del Parque Metropolitano La Sabana. 

La app para Android puede ser descargada gratis desde el Google Play Store en su smarthphone o bien ingresando a https://apkpure.com/es/fia-2012-costa-rica/com.sysnetik.FIASched12

Quiero agradecer a las personas que dieron su apoyo a esta aplicación y en especial a los organizadores y colaboradores del FIA por respaldar esta iniciativa.

 ¡A disfrutar de esta gran fiesta del arte!

Para más información del FIA ingrese a: festivaldelasartes.go.cr

Feb 26, 2012

Android - How to stretch video to fill VideoView area

The VideoView class included in the Android SDK provides a very convenient wrapper of the Surface View class. It takes care of computing its measurement from the source video so that it can be used in any layout manager.

By default  Android will scale the video to fit the VideoView but keeping the video aspect ratio. That means that depending on the device's screen size there might be some black spaces left around the video the video since the it's not filling the screen.

Depending on what you are looking for, you might actually want to completely fill the parent container area even if that means to stretch the video to fill the gaps (in other words, altering the aspect ratio of the video).

Well, turns out that even though the VideoView doesn't provide an explicit way to specify the filling mode, you can achieve the same result by wrapping the video view in a Relative Layout and setting the VideoView alignments to match the parent's boundaries:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <VideoView android:id="@+id/videoViewRelative"
         android:layout_alignParentTop="true"
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
         android:layout_alignParentRight="true"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">
    </VideoView>
    
</RelativeLayout>
Here is an example of two different layouts, one using a Linear Layout to wrap a VideoView and the other one using a Relative Layout:

LinearLayour wrapper
RelativeLayout wrapper

So, whether you want to keep the aspect ratio of a video or stretch it to fill its parent area, using the right layout manager can get the job done.

Hope this helps!

Feb 21, 2011

DNA Model using HTML5


This is my small contribution to the HTML5 community. It's an experiment that uses the HTML5 canvas element and the associated drawing methods to generate a DNA structure on the fly.

You can select from 7 fixed color schemes or let the application generate a random sequence following the basic pairing rules for a DNA sequence (A - T & C - G). Additionally, change the number of pairs and the vertical spacing between each pair at any time.


Internally, JS objects work together to calculate, cache the position of the nucleotides and finally draw them to the canvas.
The nucleotides were first created using the createRadialGradient method, however the it would take around 1 -3 seconds to generate the animation, so images were used instead to represent them.
Also, to avoid a flickering animation the elements are drawn offscreen and then copied into your onscreen. At the core of the application only plain javascript is used, the jQuery library was used only to provide the sliders functionality and basic selectors.

It would be very interesting to allow anyone to create their own color schemes and save them.. might be nice features for a version 2.

Hope somebody finds this useful. Enjoy! :)


Technologies: HTML5/canvas + javascript + jQuery

Jan 23, 2011

Sunset @ San Diego - Time lapse - 2011

Time lapse clip of the sunset from San Diego, CA. Taken on 2011. Enjoy!

Camera:Canon PowerShot SD1200 IS
White Bal: Day Light
Real time: 4:30pm - 5:30pm
Speed up:32X


Oct 18, 2010

Tren metropolitano rumbo a San José

El tren metropolitano cerca de la Sabana frente a la Municipalidad de San José en su recorrido matutino a la Estación del Ferrocarril al Pacífico.

Sep 24, 2010

Morning time-lapse at Herndon, Virginia

Just a wonderful morning with a cloudy sky.

This video was recorded near the Washington Dulles Airport from 5am to 6 30am and speed up 32X.

Thought it would play well with some trance.
Song: In and Out of love - Armin van Buuren

Mar 25, 2009

World Builder

This is a short film from Bruce Branit, it's about a man that uses holographic tools to build a world for the woman he loves. It reminds us that we should never take for granted even the simplest of things. The sound of a running river, the sight of a flower, the dance of a leave when it falls off a tree... all the things that we experience every day but rarely notice, and even more rarely appreciate.

Hope we can develop this kind of technology in a near future, it would take the phrase "The imagination is the limit" to a whole new level... =D

Mar 24, 2009

How to install Drupal 6.x (6.9) in AwardSpace


I recently had to install this PHP framework into Awardspace for testing purposes. Although Drupal is designed to ease the installation process to the users, you have to make some modifications

You can download Drupal in this site if you haven't already =P ( Drupal 6.9 )
Once you have downloaded Drupal and created an account in Awardspace we need to upload the files to our Awardspace account. The easiest way to do this is using and FTP client (I would recomend FireFTP).

If you try to install the site accessing the 'install.php' page using your browser, it will probably throw an "500 Internal Server Error" but don't worry, we will review that issue right away.
You need to connect to your file manager from the Hosting Control Panel (or using your FTP client) and rename the file .htaccess file to another name (I renamed it to .htaccess.old) or delete it, but the first option is the recommended.

Now, if you run again the install.php script, the page will let us access the install page. The first page is the Choose language screen where you can choose whether to install Drupal in English or another language. But before you can install your new Drupal site, you need to go to PHP settings on the Web Manager of the Awardspace Control Panel, and then change the version from PHP 4.x.x (mine was 4.4.1) to PHP 5.x.x (5.2.5). If you don't have permissions nor don't want to go to that version, then this error might appear:

register_globals is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when register_globals is enabled. The PHP manual has instructions for how to change configuration settings. (Currently using PHP register globals Enabled ('1'))

After you have changed this setting you are ready to go. Now you should be able to run the install script (install.php) normally and follow the steps like you normally would.

Happy "Drupalling".. Hope this is useful for somebody.


--
Kasen Lam