21. January 2017

Tutorial with Examples - Converting a Simple Web Application to Cordova Mobile App

This is the third part of a tutorial demonstrating the ability to re-use JavaScript in many different environments. The first part dealt with the creation of the re-usable service, a simple command line wrapper which called the service as well as a simple test which checks the service is performing as expected. The second part of the tutorial discussed the development of a simple web application based on that service, using browserify to wrap the service so that it will run in any modern browser. This third part will take the web app, and show you how to use Apache Cordova, a platform independent JavaScript mobile phone development framework, to make your simple app run on modern smartphones.

This third part of the tutorial assumes that you have understood the concepts so far raised in earlier parts of the tutorial.

more

29. November 2016

A Simple Web Application for Querying Bitcoin Price Information

This is the second part of a tutorial demonstrating the ability to re-use JavaScript in many different environments. The first part dealt with the creation of the re-usable service, a simple command line wrapper which called the service as well as a simple test which checks the service is actually working as expected. This second part of the tutorial assumes that you have understood the points raised in the first tutorial.

more

29. November 2016

A Command Line Tool for Querying Bitcoin Price Information

This tutorial demonstrates how to create a nodejs command line tool, and a very basic reusable JavaScript service which can be re-used in many different environments. It also touches on writing tests for the service which is good practice. The example of a bitcoin price querying service is used because the API is freely available, and doesn’t require any authentication or API keys and so one which can complicate what is designed to be a simple tutorial.

This tutorial assumes you’ve successfully installed nodejs and have a code editor. The example here will always try to be operating system agnostic. It should work on any platform that nodejs runs on.

more

29. November 2016

Javascript Everywhere

By many accounts, JavaScript really has become a universal scripting language. This is, in large part, is thanks to the v8 JavaScript engine originally developed for the Google Chrome browser and then extracted to run as a separate engine on a server or on the desktop without the browser.

Added to that you also have Apache Cordova which allows you to run a web application inside the phone.

There are a number of benefits to this for especially for developers. A developer can write a lot of business logic and to run directly on the developers desktop, greatly facilitating testing and debugging. Then by adding various layers of wrapping its possible to eventually create a web application and then finally a mobile application.

more

18. November 2016

Git Checkout Subdirectory with Sparse Shallow Checkout

A frequently asked question for git is How can I checkout only part of a repository? or How can I clone just a subdirectory with git? Git doesn’t directly support this option, but since version 1.9 it comes pretty close. The answer is to use a combination of features, a git sparse checkout and shallow checkout.

more

20. October 2016

Building command line tools (CLI) in Node.js JavaScript from scratch

Originally developed from the JavaScript engine you find in browsers such as google chrome, Nodejs is a JavaScript engine for running scripts in a variety of other environments. Given the large amount of libraries developed for JavaScript it provides a very productive environment for writing quite sophisticated command line tools. The command line tools can be installed globally on your computer, and if carefully written will work exactly the same on Windows as on Linux.

There are a large number of tutorials on the Internet showing you how to install NodeJS, and principles of JavaScript programming, as well as several well equipped editors with syntax highlighting and code completion, so I won’t dwell on those points here, rather this tutorial will concern itself with the unique needs of developing command line tools, such as parsing the command line, saving settings, installation and so on.

more