Monday 24 February 2014

Cross platform mobile development tools

Pros
  • Code reusable.
  • Easily accessible to plugins.
  • Easy for web developers.(HTML5, CSS3)
  • Reduce development cost.
  • Support for enterprise and cloud services.
  • Easy Deployment.

Cons

  • Might not support every features of OS or device.
  • Can’t Always Use Your Own Tools: Most frameworks want users to use their own development tools and suites, and that can mean that a developer has to forgo his or her own IDE preferences and use something else. PhoneGap (which Adobe acquired last summer) is different in this regard; in that it uses the native IDE for each platform it supports (XCode for iOS, Eclipse for Android, Visual Studio for Windows Phone).
  •  High end graphics and 3D support is often limited.
  • Vendor lock-in : Most of the cross-platform frameworks build using their own subsets of JavaScript, which means that if you want to switch to another platform, that code you wrote before is likely not going to be reusable without a lot of work.
Rhodes:
  • Open source Ruby based framework.
  • Achieves cross-platform by providing a runtime environment wrapped around the native app.
  • The runtime VM is ported to different platforms, abstracts the communication between device and app.
  • MVC development pattern. Only framework that supports MVC.
  • IPhone, Android, RIM, Windows Phone 7 windows mobile (4 platforms)
  • Object relational mapper component(Rhom)
    • Mini ORM(object relational mapper).
    • High level way to create local database easier to program to.
    • Database is SQLite on all platforms except BlackBerry where it is HSQLDB.
      Supports two model types: Property bag/ Fixed Schema.
    • Property Bag:  all data stored in single table using object-attribute-value pair( Entity-Attribute-Value model).
    • Fixed Schema: each model will have separate table and each attribute exists as a column in the table.
    • UI – HTML, JavaScript, CSS, JavaScript UI frameworks.



  
           installs all Rho products, and provides an IDE for Rhodes and RhoConnect development.

  •  Eclipse installation for developing Rhodes Application.
  • Installs Rhodes development suite; Rhodes, RhoConnect.
  • Generate Rhodes application(s).
  • Generate Rhodes Model(s) and associated Controllers and View templates.
  • Generate RhoConnect applications.
  • Generate RhoConnect source adapters.
  • Manage build configuration (build.yml and rhobuild.yml) using the RhoStudio/Eclipse UI.
  • Build, run, and debug your application in the RhoSimulator.
  • Build and run your Rhodes application on iPhone, Android, Windows Mobile, and BlackBerry simulators and devices.
  • See the build and application execution logs in the Eclipse output console.
 

  • Synchronization Framework.
  • REST API.
  • Administration web console.
  • Asynchronous Job System.
 a synchronization framework consisting of a backend application (a client component on the mobile device) and a server component (a RhoConnect application) that runs on any server capable of running Ruby.   
  • RhoConnect requires that you write a small amount of code for the query, create, update and delete operations of your particular enterprise backend. You can write this code in Ruby as a RhoConnect source adapter, or you can write this code as a RhoConnect plugin application written in Java, .NET, or Ruby on Rails. 



  • Build online without installing iPhone sdk locally.
  • Can build complex codes from windows machine for iphone.
  • Rhohub cloud platform lets developers to work on both Mac and windows for all mobile platforms.
  • Option to convert app to any mobile platform, online.
              RhoGallery?



  • Handles all the work of connecting to enterprise back-end applications.
  • The alternative that is done with most iPhone Objective C or other framework-based apps is to do all the code to connect to backend applications yourself: connecting to the backend web service in SOAP or REST, retrieving the data as XML or JSON, parsing the data and populating and managing the local device database. Objective C developers tell us that they spend more than 50% of their app code on these tasks. RhoSync removes all of this effort.

Reference

http://www.rhomobile.com/blog/modern-app-development-goodness-for-native-apps-what-rhodes-offers-that-no-other-framework-or-underlying-sdk-does/





Phonegap

  • Developed by Nitobi now acquired by Adobe.
  • Standards-based, open-source development framework for building cross-platform mobile apps with HTML, CSS and JavaScript for iPhone/iPad, Google Android, Palm, Symbian, BlackBerry, Windows Mobile and more.
  • Supports 7 mobile OS – Apple iOS, Android, WebOS, BlackBerry, Windows, Symbian and bada.
  • Development environment. DreamWeaver CS5.5 has built-in PhoneGap framework. IDE like Eclipse and XCode supports PhoneGap.
  • MVC
    - Model = PhoneGap JS API + offline storage/cache
    - Controller = JavaScript
    -  View = HTML + CSS
  •  HTML for layout ( Better yet HTML5 ).
  • JavaScript for accessing device functionality.
  • CSS for rich look and feel. ( Better yet CSS3 ).
  • Phonegap apps are just webpages that access device functionality.
  • Rich UI. Supports javascript frameworks.
    • Images are usually loaded from the device, so it's quick.
    • Interaction is quick if you use touch events instead of click events.
  •  Architecture of App
    • Server component.
    •  Javascript calls the server via XHR to get the JSON data.
    • Javascript can stored retrieved data in SQLite database for offline access. Can cache images.
  •  Different from mobile website?
    •  Mobile websites are domain restricted to their origin url and cannot access other sites/APIs.
    •  PhoneGap applications are loaded from the file:// protocol so server requests are NOT restricted.
    •  With PhoneGap you can build powerful mashups accessing multiple services.

Limitations

  •  Complex games, intensive graphics. Use OpenGL for that, not PhoneGap.
  •  For slower phones (not iPhone, not Nexus One, not Xperia X10), PhoneGap apps using the latest interactive Google Maps APIs tend to be slow. Static maps OK, though.
 Reference

http://savagelook.com/blog/portfolio/8-things-to-know-about-phonegap
http://geekyfry.com/topics/tech-it/smartphones/phonegap/
http://savagelook.com/blog/portfolio/a-deeper-look-at-appcelerator-and-phonegap
http://www.slideshare.net/inouemak/rhodes-and-phone-gap
http://groups.google.com/group/phonegap/browse_thread/thread/f23fedaa06abd3b8/2c5005410e7da4e0


Appcelerator

  • while using the familiar JavaScript syntax, developers will also have to learn the Titanium API, which is quite different from familiar web frameworks such as jQuery.
  • is sometimes compared to Adobe Air for developing desktop applications.
  • Titanium Studio is a full open standards IDE that is derived from Aptana Studio.
  • Offers cloud based services for packaging, testing and distributing software applications developed on the Titanium platform.
  • Supports HTML,CSS, Javascript on all platforms and PHP, Ruby, Python for desktop platforms.
  • Supports various javascript frameworks.
  • API access to UI components and geolocation, maps, accelerometer.
  • Extensibility through open interfaces, licensing, support for other scripting languages,  media codecs.



jQuery Mobile = Unified UI system for myriad mobile devices. (layout/animation/interactivity)
Phonegap = library to access native hardware APIs.
jQuery Mobile + Phonegap = UI + Native Functionality.
SenchaTouch and JQueryMobile are both javascript mobile UI libraries. Their approaches to development and device support are very different,  but both can be used to construct the UI for mobile apps and should be considered peers.

You could also consider  other such libraries such as YUI3, dojo or even with appropriate licensing - Enyo from Palm/HP.
Phonegap can be used with any of these UI libraries to package the web.
UI for delivery as native apps with full access to phonegap APIs.


HTML Tags - DIV vs TABLE instead of DIV or TABLE

DIV/TABLE are HTML tags which can populate data inside the markup language. Most of us have come across the situation, where we have to choose between DIV and TABLE. Both have there own way of presenting data inside the HTML. Ofcourse TABLE tag gives easier way of displaying data like, showing a weekly/monthly/yearly report with legible heading for each column, any tabular data etc. So is it possible to use DIV instead of TABLE in the above example?, yes it is possible. Its hard for a beginner to go with a DIV, because inorder to make a perfect aligning of DIV, some styling basics (Cascading Style Sheet – CSS )also should be known. 

 Comparison

DIV TABLE
Loads faster. Loads slower.
Quite few tags needed (div). More tags needed (table , tr, td, thead , tfoot ,th).
Make use of Search Engine Optimization (SEO) more powerful. Less powerful.
Reduce size of the page significantly. Page size increases.
Flexible. Inflexible.
Styling issues compromised using CSS. Only partially.

 
DIV and SPAN tags

DIV which creates a division inside html content. Usually used to dynamically populate data, using AJAX calls.SPAN also creates a division. The main difference between these two is that
  • DIV creates a line break after the tag is closed.


Example 1


Example 2


Output

Example 1
Example 2

Inorder to make this in single line. This need to be changed to:




Example 1


Example 2




Output

Example 1 Example 2

  • SPAN will not create any line breaks. Usually SPAN is used for styling text with the help of CSS.

    Example 1
    Example 2


    Output

    Example 1Example 2

Methods for passing values from one page to another

1. '''Query String''' ['''''GET Method''''']

Passing variables using query string, which means the values are passed along with the URL.

http://www.example.com/page2.php?a=2&b=4&c=6


This can be achieved using one of the form method submission 'GET'.
So You can see that using GET method the values can be sent through query string, and ofcourse the key-value pairs are 'visible' to the user as well. So it is restricted to sent very sensitive data like password and other secured data from one page to another.
In page1.php









The browser divides the URL into parts and recognizes a host, then sends to that host a GET request with the rest of the URL as argument. The server takes it from there. Here the form data are restricted to ASCII codes. Special care should be taken to encode and decode other types of characters when passing them through the URL in ASCII format.

All form data filled in is visible in the URL. Moreover, it is also stored in the user's web browsing history/logs for the browser. These issues make GET method less secure.

One advantage of form data being sent as part of the URL is that one can bookmark the URLs and directly use them and completely bypass the form-filling process.Length of the URL is limited



2. '''Passing as hidden''' ['''''POST Method''''']







The above form when submitted, it calls
this URL - http://www.example.com/page2.php , in which the key-value
pairs are sent as hidden.

GET POST
Caching/Bookmark Can be bookmarked. Can not bookmarked.
Security Less secure. More safer.
Type of data Sent via URL string,so data can be text only(only ASCII characters) Text as well as binary data('enctype' attribute with a value "multipart/form-data" ).
Data length Limited. Unlimited.
Submission If the page is refreshed it would not prompt before the request is submitted again. It would prompt before the request is re-submitted.


3. Using COOKIE/SESSION

Before going into that what is the difference between cookie and session?

Cookies - piece of information that a website stores on its client machine, and can be used to keep track of your movement from page to page so you dont need to enter the information that you've already given to the site. But the thing is that, you can save only less amount of data and also storing anything sesitive in the client machine makes anyone to tamper it. So it seems insecure.

Session - which is stored in server side, more secure while using sesitive data.

Can use both the combination of cookie and session to make the website work as the way developer wanted.

== ''When and Where to use these?'' ==


In cases like validating login credentials we can use both cookie and session.

When we storing the login credentials like login username and password into cookie variable it will get stored in the browser so user do not have to re-login to the website every time he visit. That is no need to re-submit login credentials again and again.
Since it is stored in browser, the user can block cookies or delete them at any time. Problem with sessions is that when you close your browser you also lose the session.Session id created will be different each time.

Another situation arises in the case of a shopping cart.
If you are using cookie for storing cart variables and a user had their browser set to block them, then he could not shop in the website. Since the cart variables is to be updated in database, it should be set using a session.


WampServer phpMyAdmin - default password

Its a software bundle :
  • Windows
  • Apache
  • MySQL
  • PHP
which is a windows web development environment; creates web application using Apache,MySQL, PHP.
For managing MySQL database there is a UI part available called PhpMyAdmin.
So after installing the software bundle, when user tries to access the phpMyAdmin it will show a login screen.


The default username is 'root' and the default password is '' (empty/null).

Now go ahead and create your database :).




Saturday 22 February 2014

File Load Exception: Could not load file or assembly ASP.NET MVC

My first post :)

This is a common exception that happens when we upgrade an installed package. So why is this throwing this exception.

FileLoad Exception
Could not load file or assembly 'BLToolkit.4, Version=4.1.10.2158, Culture=neutral, PublicKeyToken=b1d3f6ab3aadaca3' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


I got this exception when I tried to upgrade to BLToolkit version 4.1.21. In order to get a detailed description for this exception there is a handy tool Fuslogvw.exe (Fusion Log Viewer /Assembly Binding Log Viewer) which is automatically installed with Visual Studio and with the Windows SDK. The Assembly Binding Log Viewer displays details for assembly binds that Visual Studio fails to bind at runtime.

To enable Fusion Log viewer

If you have Visual Studio installed on your computer: On the taskbar, click Start, click All Programs, click Visual Studio, click Visual Studio Tools, right-click Visual Studio Command Prompt, and then click Run as administrator from the shortcut menu.

At the administrator command prompt, type

fuslogvw

http://msdn.microsoft.com/en-us/library/e74a18c4%28v=vs.110%29.aspx

Assembly Binding Log Viewer- Figure 1

Add the following registry values to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion

DWORD ForceLog set value to 1
DWORD LogFailures set value to 1
DWORD LogResourceBinds set value to 1
String LogPath set value to D:\FusionLogs\ (optional)

Make sure to include the backslash after the folder name. You can also give custom folder path in Log Location in the popup window.
After configuring and verifying the Log Viewer is enabled; start the application in visual studio debug mode.
You will get list of all assemblies loading for that application in the Log Viewer. Select the assembly having conflict issues and click on View Log button in the popup.

Listing both versions - Figure 2
Two version of assembly is loaded, select the application and click on View Log. It will open in a new browser window with detailed description of error.

LOG: Assembly Name is: BLToolkit.4, Version=4.1.21.0, Culture=neutral, PublicKeyToken=b1d3f6ab3aadaca3
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.


Solution

Since after upgrade, the application is trying to load previous version which is not available in the assembly path. So we need to redirect the binding from previous version to newly updated version number.
Add the below code to your web.config.






In Figure 2 it is listing both the versions. After updating web.config, run the log viewer, you will see only the latest version of the BLToolkit package.