Mobile Apps Must Work Offline Because Wireless Connectivity isn’t Ubiquitous

Albuquerque

Intermittent wireless connectivity requires mobile apps to follow sync patterns using pre-fetched data via APIs and offline local storage.

If the network isn’t available, it’s pretty hard for your native app to call web APIs or for your web app to load new web pages. On the Ethernet connected desktops of the past, developers didn’t concern themselves with this issue. In our wireless connected mobile society, ignoring this issue leads to a poor user experience. Most of the time, devices are connected via 2G/3G/4G wireless data networks whose reliability is driven by cell tower density, the number of devices connected to a given tower, wireless frequencies, bandwidth and the number of buildings in the area.

Rather than assuming everything will “just work,” developers of successful apps assume “nothing works.” For starters, mobile apps must take advantage of platform APIs that detect the existence of network connectivity. Once this is established, an app must not only download the data it needs at that given moment but enough data to get through the day. Depending on the amount and complexity of this data, it should be stored locally on the device in a mobile database or as serialized files. From then on, the app should only use the local data to perform its tasks rather than reaching out to servers. Changes made by the user to this local data should be tracked so that only deltas are sent to backend systems when it’s time to upload. Extensive error handling and “sync retries” are needed to ensure reliability. Employees can work in airplane mode or when roaming internationally without using data.

Increase revenue and improve user productivity by using sync to create apps that keep working whether the Internet is available or not. App downtime on a sales call in front of a customer is not an option. Has your company made the move to apps that work offline?

Learn how to digitally transform your company in my newest book, “Mobile Strategies for Business: 50 Actionable Insights to Digitally Transform your Business.”

Book Cover

Click to purchase a copy of my book today and start transforming your business!

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

It’s Time to Dump your 1990s App Authentication

Orlando

Migrate Win32 applications secured by client/server database logins to mobile apps that use OAuth & enterprise cloud directories for authentication instead.

Do you know Scott Tiger? Are you familiar with SA and no password? If so, you probably worked with client/server database security mechanisms from companies like Oracle, Microsoft, IBM and others. Anyone who’s built client/server, multi-tier database systems over the years has worked with Oracle Net Listener, TNSNames, Sybase DBLIB, ISAM and VSAM drivers plus a revolving door of Microsoft drivers. App logins were typically the same as the database login. DBAs were in control and app developers worked with what they were given. Sometimes data access was secured through the use of views or stored procedures. Things improved when databases started supporting integrated authentication where data access could be controlled by users and groups found in the company Active Directory.

Today’s mobile apps don’t connect to client/server databases this way. Win32 apps connecting via the LAN or VPN can kick the can down the road a bit longer. Everything else talks to databases with web APIs or sync. While these mobile-friendly APIs use database authentication to connect, the services they expose must be secured by an enterprise directory. This pattern provides identity management to mobile apps. Furthermore, cloud-based enterprise directories must be kept in sync with existing on-premises directories to keep the login procedures seamless for employees. Add multi-factor authentication to boost security and avoid consumer auth providers like Facebook or Twitter.

Reduce risk to your organization by decoupling app security from database authentication and make the move to company-wide directory services. Has your employer switched all its enterprise apps to modern authentication methods yet?

Learn how to digitally transform your company in my newest book, “Mobile Strategies for Business: 50 Actionable Insights to Digitally Transform your Business.”

Book Cover

Click to purchase a copy of my book today and start transforming your business!

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

It’s Time for one Mobile Database to Rule Them All

WashingtonDC

Migrate Win32 applications using a mobile database like FoxPro, dBase, Access and SQL Server Compact to SQLite across all mobile devices.

If it weren’t for desktop databases and learning SQL, my career as a developer may never have launched. I learned dBase for DOS in college, moved on to Paradox when Windows arrived on the scene and then fell in love with Access. I want to take this moment to say “I’m sorry” to all the IT departments that watched in horror as workgroup-level Access databases spread like wildfire on NetWare, Windows for Workgroups and NT servers to take over the corporate world. Employees who weren’t developers or DBAs were empowered to build their own solutions.

When devices for the mobile enterprise arrived in the late 90s and early 2000s, new databases like Sybase SQL Anywhere and Microsoft SQL Server Compact picked up where their desktop forbearers left off. These tiny relational engines brought serious business apps to life with built-in data sync with server databases. Today, platforms like iOS, Android and Windows are the biggest game in town and the only mobile database that runs on all of them is SQLite. From a pragmatic standpoint, this open source, cross-platform database with ACID (Atomicity, Consistency, Isolation, Durability) support should be your choice to give enterprise mobile data apps the broadest reach. Don’t worry about SQLite just being the database flavor of the week. It supports SQL-92 and works with most programming languages. It has a public domain license and has been around since the year 2000. It also happens to be the most widely deployed database in the world.

Improve user productivity and increase revenue by using a mobile database that works with every device and keeps your apps working with or without connectivity. Which desktop, mobile or embedded databases are you currently using?

Learn how to digitally transform your company in my newest book, “Mobile Strategies for Business: 50 Actionable Insights to Digitally Transform your Business.”

Book Cover

Click to purchase a copy of my book today and start transforming your business!

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

Rob Tiffany Named Among Top 30 Technology Influencers in Major Report

Industry Analysts

I’m thrilled to be included in this group of technology influencers and luminaries like Werner Vogels, Steve Wozniak and Mark Russinovich.

To become one of those technology influencers, it’s taken a lot of years of hands-on experience building mobile, cloud and Internet of Things solutions combined with writing books, speaking at conferences around the world, blogging, tweeting and mentoring.

Top Technology Influencers

Check it out at: https://apollotarget.com/the-top-15-industry-analysts-usa/

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

Improve Employee Productivity by Delivering Web Scale to your Mobile Workforce

Victoria

Bring web scale to backend business systems via adapters, replication, sharding, queuing & caching to support a growing mobile workforce.

Many of the backend systems running global business over the last several decades have something in common besides not being able to communicate with mobile devices. They’re not designed to support the scale needed to empower today’s mobile workforces. Actually, most of these packages and associated databases were designed for departmental or workgroup use in a world where everyone had a single PC on their desk. The IT infrastructures of most companies are wholly unprepared to support mobility.

Whether you’re wrapping your systems in REST APIs or using a mobile middleware package, you have the ability to boost the scale of those old systems using several clever techniques. For starters, the servers used to create a new mobile API tier should be designed to cache frequently-used data so repeated calls to the backend servers won’t be needed. This could range from a simple file cache, to using staging tables in a database. To scale-out this mobile API tier, data could be replicated across multiple nodes resulting in a sharding architecture that further spreads the load generated by mobile devices making requests. To further de-couple the system, data uploads from mobile apps could be dropped in queues and processed by background processes. All these things will have the effect of boosting both the performance and scalability of your existing backend systems.

Improve User Productivity and reduce expenses by increasing the number of employees and customers served by existing line of business systems. What is your organization doing to beef up its systems to serve more users and devices?

Learn how to digitally transform your company in my newest book, “Mobile Strategies for Business: 50 Actionable Insights to Digitally Transform your Business.”

Book Cover

Click to purchase a copy of my book today and start transforming your business!

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

Looking to the Future of Cross-Platform Mobile Data Sync with SQL Server

Zumero

If you’ve used Merge Replication to sync SQL Server Compact data on mobile devices with SQL Server in the past and you’re looking for a cross-platform solution to take you into the future, take a look at Zumero.

As many of you know, I spent most of the first decade of the 21st century building massive-scale mobile enterprise solutions for the world’s largest companies. The backbone of many of those architectures was based on the Merge Replication technology built into SQL Server that allowed mobile devices running the embedded SQL Server Compact database to sync data and take it offline for use with mobile apps. This was a great solution that took care of all the bi-directional, mobile-to-server data movement, conflict resolution and filtering without writing any code allowing development teams to focus on their apps. Unfortunately, the journey for this Microsoft technology arrived at the end of the road with SQL Server 2012 and SQL Server Compact 3.5 SP2. It’s no longer supported on the more recent versions of those products.

For those of you who need to keep synchronizing mobile data with SQL Server, the folks over at Zumero have a solution you should investigate. They smartly took a dependency on SQLite as the mobile database since it already runs on iOS, Android and Windows. The Zumero server runs on an Internet Information Server (IIS) to broker communications between devices and your SQL Server database. This architecture should look familiar to those of you who have built mobile Merge Replication infrastructures in the past.

Zumero Architecture

They’ve even gone so far to provide you with a migration document that will help move you from SQL Server Compact and Merge Replication to their Zumero offering. If this solution matches the scenario you’re targeting, I would encourage you to perform your own due diligence and see if Zumero meets your needs.

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

Wrap a Web API around Your Enterprise & Take Microsoft SQL Server 2014 Data Offline w/ NoSQL via Universal Apps for Windows

Windows NoSQL

At TechEd New Zealand, I presented a session on how to integrate a company’s backend systems into SQL Server 2014 and deliver that data out to mobile devices via Web APIs to support the operations of occasionally-connected apps on mobile devices using NoSQL tables.

Enterprise mobility is a top priority for Chief Information Officers who must empower employees and reach customers by moving data from backend systems out to apps on mobile devices.  This data must flow over inefficient wireless data networks, be consumable by any mobile device, and scale to support millions of users while delivering exceptional performance.  Since wireless coverage is inconsistent, apps must store this data offline so users can be productive in the absence of connectivity.

In this video, I’ll teach you how mashup disparate backend systems into high-speed, SQL Server 2014 in-memory staging tables.  I boost the speed even further through the use of natively-compiled stored procedures and then link them to fast and scalable REST + JSON APIs using the ASP.NET Web API while employing techniques such as in-memory caching.  On the device, I’ll show you how your apps can work with offline data via in-memory NoSQL tables that use LINQ to support the same CRUD operations as relational databases.  You’ll walk away from this session with the ability to deliver flexible server solutions that work on-premises or in Azure and device solutions that work with Windows Phones, Tablets or Laptops.

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

How to Create In-Memory Database Tables in SQL Server 2014

SQL Server 2014

Getting data off disk drives and into RAM is the biggest game changer for relational databases in decades and SQL Server 2014 brings it to the masses.

RAM is cheap and it’s finally time to reap the benefits of 64-bit computing.

SQL Server In-Memory OLTP, also know at Hekaton is here and it’s ready to transform your business.  Unlike other recent entries to the in-memory database space, SQL Server 2014 integrates this new technology directly into the database engine instead of being a separate add-on. Additionally, existing SQL Server DBAs and developers will feel right at home building memory-optimized databases with same SQL Server Management Studio they’ve used for years.  Not having to retrain your staff is pretty cool.

Benefits to using SQL Server 2014 include:

  • In-memory execution for low-latency data retrieval vs. disk-bound I/O
  • Elimination of contention (locks, latches, spinlocks) from concurrent data Inserts and Updates due to optimistic concurrency control (row versioning without using TempDB)
  • Disk I/O reduction or elimination depending selected data durability (more on this later)
  • 5x – 25x performance improvement and the equivalent throughput of 5 – 10 scaled-out database servers

Create a Memory-Optimized Database

  • Create a normal database in SQL Server Management Studio

Create Database

  •  Add Memory Optimized Data Filegroup to ensure data durability

Memory Optimized Filegroup

  • Add a FILESTREAM Data file type with Unlimited Autogrowth/Maxsize

Filestream Data

Create Memory-Optimized Tables

  • Right-click on the Tables folder of the database you just created and select New | Memory Optimized Table… to get a starter SQL script
  • Create and execute CREATE TABLE scripts to create one or more tables where MEMORY_OPTIMIZED=ON (example in a sec)
  • Set DURABILITY=SCHEMA_ONLY for staging tables to prevent transaction logging and checkpoint I/O (this means only the schema but no actual data will be saved to disk in the event of a server restart)
  • Set DURABILITY=SCHEMA_AND_DATA for standard tables (this saves the schema and in-memory data to disk in the background with the option to delay durability for better performance by not immediately flushing transaction log writes)

Here’s an example of a SQL script to create a memory-optimized Customer table with an Id, FirstName and LastName column:

USE TechEDNZ2014
GO
CREATE TABLE [dbo].[Customer] (
    [Id] uniqueidentifier NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT=1000000) DEFAULT (NEWID()), 
    [FirstName] nvarchar(50),
    [LastName] nvarchar(50)
) 
WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA)
GO

Create Natively-Compiled Stored Procedures

Just when you thought performance couldn’t get any better, SQL Server 2014 rewrites the book on stored procedures.  Your T-SQL code now compiles to C DLLs which minimizes code execution time to further boost performance and scalability.  Furthermore, they significantly reduce CPU usage on your SQL Server box due to the need for fewer instructions to execute.

Here’s an example of a SQL script to create a natively-compiled stored procedure to retrieve data from the memory-optimized Customer table you just created:

USE TechEDNZ2014
GO
create procedure [dbo].[CustomerSelect]
with native_compilation, schemabinding, execute as owner
as 
begin atomic with
(
    transaction isolation level = snapshot, 
    language = N'English'
)
    SELECT [Id], [FirstName], [LastName] FROM [dbo].[Customer];
end
GO

I’m hoping by now you’re feeling the need for speed.

I’ve heard plenty of reports from companies that upgraded from previous versions of SQL Server to SQL Server 2014 that they instantly doubled their performance.  This is before converting disk-based tables to in-memory tables which is pretty incredible and well worth the upgrade on its own.  Just knowing that you can jump from a 2x performance increase to anywhere from 5x to 25x is mind boggling.

Most of you know me as a mobile strategist, architect and developer.  Being a mobile guy doesn’t mean I don’t think about the server.  In fact in all the large-scale enterprise mobile solutions I’ve designed for Fortune 500 companies, I figure I spend more than 70% of my time ensuring that servers are fast and can scale.  With SQL Server 2014 being the heart of most enterprise systems, just imagine how delighted all your mobile users will be when their apps become dramatically more responsive.

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

Empower your Demanding Mobile Line of Business Apps with SQLite and Offline Data Sync on Windows

Presenting at TechEd in Houston, watch my session: “Empower your Demanding Mobile Line of Business Apps with SQLite and Offline Data Sync on Window.”

Most mobile apps require the ability to store data locally to deal with the realities of a disconnected world where ubiquitous wireless networks are non-existent.  While many consumer apps get by with saving light amounts of information as small files, the data requirements of mobile line-of-business apps is significantly greater.  With Windows 8.1 and MSOpenTech’s Portable Class Library for SQLite, .NET developers can build structured data storage into their apps.

In this video, I walk you through creating local databases and tables and show you how to work with offline data.  I also demonstrate a new data sync capability in Microsoft Azure Mobile Services which uses SQLite for local data storage and change tracking.  It even detects data conflicts during a sync so your can resolve them either programmatically or interactively.  There’s no faster way to build robust mobile apps to meet your most demanding enterprise needs.  If you know me, you know that I’ve been in the mobile data sync business for well over a decade and I’ve designed and developed many of the world’s largest architectures.

Where you may have used SQL Compact in the past, now you can use SQLite.  Likewise, where you’ve used the Sync Framework or Merge Replication before, take a look at Azure Mobile Services today.  It might be time to move your mobile enterprise application platform to an mBaaS architecture.  Either way, you still sync data with SQL Server.  I’m really excited about the next chapter in this journey where SQLite runs across all mobile platforms and synchronizes with cloud and on-premise data stores via Azure Mobile Services.

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany

NoSQL on Windows

In this week’s episode of “Inside Windows Phone,” Matthijs Hoekstra and I discuss the use of NoSQL.

When building mobile apps for the enterprise, an offline data store is absolutely essential so that users can keep working in the absence of wireless connectivity.  In addition to SQLite and SQLCE, NoSQL is a great option to consider in order to achieve your goals with local data storage.

Below are some code snippets I created to get you started:

Define Table schema (Entity)
public sealed class Customer
{
    public int CustomerId { getset; }
    public string FirstName { getset; }
    public string LastName { getset; }
}

Define Table (Generic List to hold collection of Customer objects)
public static List<Customer> Customers { getset; }

 

Create Table
Customers = new List<Customer>();

 

Save Table
public static async Task SaveChanges<T>(T collection, String tableName)
{
    var file = awaitApplicationData.Current.  LocalFolder.CreateFileAsync(tableName, CreationCollisionOption.ReplaceExisting);
    var outStream = await file.OpenStreamForWriteAsync();
    var serializer = new DataContractJsonSerializer(typeof(T));
    serializer.WriteObject(outStream, collection);
    await outStream.FlushAsync();
    outStream.Dispose();
}
 
Calling the Save Table Method
await SaveChanges<List<Customer>>(Customers, “Customer”);
 
Load Table
public static async Task<T> LoadTable<T>(string tableName)
{
    StorageFile file = awaitApplicationData.Current.
LocalFolder.GetFileAsync(tableName);
    Stream stream = await file.OpenStreamForReadAsync();
    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T));
    T table = (T)serializer.ReadObject(stream);
    stream.Dispose();
    return table;
}
 
Calling the Load Table Method
Customers = await LoadTable<List<Customer>>(“Customer”);
 
INSERT Customers
Customers.Add(new Customer
{
    CustomerId = 1,
    FirstName = “Andy”,
    LastName = “Wigley”
});
 
UPDATE Customers
foreach (var item in Customers.Where((c) => c.CustomerId == 2))
{
    item.FirstName = “Mike”;
}
 
DELETE Customers
Customers.RemoveAll((c) => c.CustomerId == 2);
 
SELECT Customers
var query = from c in TableService.Customers
            select c;
CustomersList.ItemsSource = query.ToList();

 

Have fun!

Sharing my knowledge and helping others never stops, so connect with me on my blog at http://robtiffany.com , follow me on Twitter at https://twitter.com/RobTiffany and on LinkedIn at https://www.linkedin.com/in/robtiffany