Kategorien
AngularJS Frameworks GotoCo HTML5 Javascript Programming Languages Projects

Lazy remote service access – REST and IndexedDB

Visiting the Goto Conference in Berlin let me code a quick hack of a personal conference planner GotoCo . GotoCo is a small mobile application based on web technologies using the Ionic framework. It features to access the conference information, store them locally for later use and build your personal conference schedule. Visit http://apps.mindcrime-ilab.de/gotoco/index.html to check out the app – but due to the conference is already over it might not that useful anymore.

Conference sessions and tracks become more or less fixed after some point and network usage is always critical on mobile devices (limited speed or transfer volume). Applying a cache mechanims seems appropriate in order to make the app more responsive and mobile friendly.

Kategorien
AngularJS Book Frameworks Review

Book Review|Mastering AngularJS Directives

1588OS_Mockupcover_normal

Mastering AngularJS Directives“ by Josh Kurz is a deep dive into the magic of writing directives using the AngularJS framework by Google. This review is based on the eBook which was amply sponsored by Packt Publishing. The book is divided into nine chapters on roughly 200 pages.

Kategorien
AngularJS CoffeeScript Dev Note

DEV-NOTES|AngularJS: Global fault handler

„Dev Notes“ is a small column about practical hints on certain problems or solutions taken from real world applications.

AngularJS is a great framework simplifying the development of JavaScript applications. The following example shows how to setup a global error handler to notify the user about the applications state.

fault-handler_sampleTo benefit from angulars super powers the global fault handler part visible to the user is encapsulated into an angular directive which is an easy but powerful way to enhance the HTML tag cloud with your own components. Building the handler involves roughly the following steps:

Note: For those who are not fluent in CoffeeScript the code can be ‚compiled‘ to JavaScript on the CoffeeScript homepage using the ‚Try CoffeeScript‘ tab.

  1. Add global fault handler and clear method
    app.run ($rootScope, $log) ->
      ###
      # fault handler
      ###
      $rootScope.faultHandler = (data) ->
        $log.debug "[faultHandler] error data[#{data}]"
        # handle and process error data here
        # assign error message to global fault message
        $rootScope = "ERROR: #{data}"
    
      ###
      # clear fault
      ###
      $rootScope.clearFault = () ->
        $log.debug "[faultHandler] clearing fault[#{$rootScope.errorMessage}]"
        $rootScope.errorMessage = undefined
    
  2. Create custom tag to include the error handler
    'use strict'
    
    angular.module('myApp')
      .directive('errorMessages', () ->
        template: "<div class='alert alert-danger' data-ng-show='errorMessage'><strong>Achtung:&nbsp;</strong><span data-ng-bind='errorMessage'></span></div>"
        restrict: 'E'
      )
    
    
  3. Refer to fault handler
    'use strict'
    
    angular.module('myApp')
    .controller 'UserprofilCtrl', ($scope, $rootScope, $log, UserProfilService) ->
        $scope.profil = $rootScope.user
    
        # query userprofile by UID
        result = UserProfilService.get({id: $scope.profil.uid})
    
        result.$promise.then (profil) ->
          $scope.profil = profil
          $rootScope.clearFault()
        .catch $rootScope.faultHandler
    
  4. Use it
    <!-- include the following place holder tag into your page -->
    <x-error-messages></x-error-messages>
    
Kategorien
C++ Frameworks Programming Languages QtTestLib

Creating class level xunit report files with QtTestLib

Working on my new project SynPlayer – an controller to the Synology AudioStation based on C++ and Qt – it becomes evident to set up a testing infrastructure. Keeping dependency small and simple the decision was to facilitate QtTestLib for testing purposes.