Category Archives: Uncategorized

Cross Platform iOS/Android Development

When developing a mobile app, it’s pretty much a given that you will eventually need to support the two major platforms: iOS and Android. Developing for both platforms can be a challenge because:

  • Development costs are almost double due to having to develop with two completely different frameworks and codebases
  • Testing and QA – You need to test every feature in both platforms
  • Different UI is required since iOS and Android have different design philosophies
  • Problems keeping things in sync – When you add features to one, sometimes it takes time to add the same features to the other so unless you can finish both at the same time you are waiting on the other platform to release, or you have to live with the two not having feature parity
  • The required development skills for each platform are different – Android is written in either Kotlin (our favorite), or Java while iOS is written in either Swift (our favorite) or Objective C. This means you need to engage developers with different backgrounds to code both platforms, or one with experience in both

What can be done about this?

Enter Flutter

In the past, we’ve used cross-platform tools like Adobe PhoneGap / Cordova, Xamarin, etc. While these are useful, we’ve recently started using Google’s new Flutter framework that uses the Dart programming language.

This is a great article that explains why Flutter is such a great framework for cross-platform development even though it doesn’t use native platform widgets: https://medium.com/flutter-io/why-flutter-doesnt-use-oem-widgets-94746e812510 .

Basically, it compiles to low level code, and it doesn’t use a webview or native UI elements like others; instead it uses Skia which means it’s using OpenGL.

Why do we like Flutter?

  1. Code once run anywhere
  2. Familiar Language and Layout
  3. Rapid Development
  4. Stateful Hot Reloading
  5. UI Flexibility
  6. Native Like Performance
  7. Small Deploy Size
  8. Eventual Support for Desktop and Web

Flutter had it’s 1.0 release in December 2018, and as of today, we’ve already successfully used it in 4 apps for our clients, including projects that required a lot of underlying hardware control such as Bluetooth interfacing with hardware devices.

Not Always the Right Choice

Having said that, Flutter may not always be the right choice depending on the app project. We carefully consult with each client to determine their requirements, and what kind of user experience they want with a project and we make sure we always use the right tool for the job.

We think Flutter is a great addition to the space but it may not always be the best choice, and we still do a lot of native iOS and native Android development and have a lot of expertise with those platforms. The great part about Flutter is you can still use all the native API’s or write native code in combination with Flutter for a unified user experience and faster development.

Technologies We Are Using Right Now

Today we did a quick check on the technologies we are actively using right now across all the projects we are actively developing and made this poster with a bunch of them. This isn’t fully comprehensive but it’s a good sample of the technologies we use and rely on every day as we code

Here is a brief list of some of the tech we are using right now:

  • Docker
  • NPM
  • Cordova
  • Android
  • iOS
  • AWS
  • Apache
  • Gitlab
  • MySQL
  • Flutter
  • Firebase
  • NGiNX
  • Java
  • WPF
  • Realm
  • .NET Core
  • Grape
  • Angular
  • MongoDB
  • PostgresQL
  • Node.JS
  • Rails
  • SQL Server
  • django
  • CakePHP
  • C# .NET
  • Laravel

Keep command-line Subversion client (svn) from saving credentials

If you share a server with multiple users, you may find yourself committing as root.  In that case, it’s helpful if you can keep svn from saving credentials.  All you have to do is edit:

/root/.subversion/config

Set the following:

store-passwords = no
store-auth-creds = no

Then remove any credentials file that exists in:

/root/subversion/auth

Web browser text search

So I am working on a project where I have to search some HTML documents for a possible text string. This lead me to an interesting find in how browsers do searching on text.

 

Let’s look at the following HTML.

<div>
<div style="background-color: #00ff00;">Hello ther</div>
<div style="background-color: #ff0000;">e,
<span style="background-color: #f0ff00;">bob</span> how are</div>
<div style="background-color: #00ff00;">you?</div>
</div>

The text displays as the following: Text displayed in a browser

The yellow represents the inner span. The divs are different colors to show their distinction.

If you search for the text “Hello there” no results will be found as the browser does not search across div elements.

If you search for the text “e, bob how are” the text will be found as the browser will search across span elements.

It’s interesting to note that the browser’s search works only across defaulted inline elements but not elements set inline by the html.

Using nullmailer as a simple MTA

nullmailer is a very simple MTA I like to use on Linux servers when I don’t want to have a lot of hassle with mail server configuration.

It will automatically send all local mail to one of my email addresses by simply installing it and configuring two files.  The /etc/nullmailer/remotes I put in my smtp server.  Here is an example:

mail.example.com smtp --user=myemail@example.com --pass=examplepassword

For /etc/nullmailer/adminaddr I put the following:

myemail@example.com

All mail delivered to, say, the local root account automatically gets sent to the email address put in the adminaddr file.  Simple and convenient.

Troubleshooting is also simple.  When the email is still in queue, you can see it with command mailq.  It will also show where it’s going to be delivered.  Logs can be found in /var/log/mail.log and /var/log/mail.err

One thing I’ve noticed is you’ve got to get your hostnames right.  Make sure /etc/mailname has the fully qualified domain name in it.  I had an issue when the hostname on the machine (/etc/hostname) was the same as the /etc/mailname.

Better jquery each loop for coffeescript

When writing object-oriented code in coffeescript, I’ve found that the jquery each method is insufficient, due to its use of “this”.  I am forced to use the following syntax:

$('.thing').each (index, thing) =>
  $(thing).css
    width: @width()

I’ve created an alternative which works better for this use case.  It passes the object as both “this” and as the first argument, and wraps them both in a jquery object automatically:

$('.thing').loop (thing) =>
  thing.css
    width: @width()

In cases where you don’t want access to the original “this”, it is also useful.  Here is an example with “each”:

$('.photo').each ->
  $(@).hide()

With “loop”, there’s no need to wrap “this” with a jquery object:

$('.photo').loop ->
  @hide()

Here is the source code for $.loop:

# Better each() for use with coffeescript
# 1. Wraps child in jquery object
# 2. Sets child first argument, so that fat-binding can be used.
# 3. Sets @ as well, for normal binds
jQuery.fn.loop = (block) ->
  for i in @
    element = jQuery(i)
    res = block.call element, element
    break if res == false