Android for Real Work

This post publishes a report on my initial attempts to set up and use Android devices for real work, rather than simply as a reader and web surfing device.

Notes on Android for Real Work

Mon Dec 11th 2017

Introduction

The point of the exercise is to determine if one can in fact use an Android device, like a phone or a tablet, as a device for real work. Specifically, can one edit documents, switch languages in keyboards, use a full size external keyboard, a mouse, a regular monitor and so on ?

Test Devices

Three devices were used in tests.

  • A Samsung Note III on Android 5.0
  • A Lenovo Tab4 8″ on Android 7.1.1
  • A Samsung Tab S3 on Android 7.0

Test Cases

The first is typing this document using an external keyboard and mouse, in iA Writer.

Keyboard and Mouse

There are basically two external keyboard options; wireless or USB. Wireless is usually Bluetooth which has security issues. If we ever see an appreciable number of Wifi Direct keyboards that use WPA PSK this might be more secure, but for now that leaves USB keyboards. The description that follows documents how to do this.

This is relatively straightforward for English keyboard input but if you want to change languages, that is, keyboard mappings, there are a couple of gotchas.

Bluetoooth

Interesting note to make on Bluetooth here in respect of the Lenovo. I have a Microsoft Sculpt Bluetooth mouse. It works fine on the Note III and the Tab S3, but while it connects to the Lenovo it does not work.

Regarding security, Bluetooth has a very short range and thus use in certain locations is likely no problem at all. But in places such as crowded coffee shops and so on it is less satisfactory. Now of course, many will think there is no need to be paranoid and that there are other security risks. Indeed there are. So if you prefer the convenience of wireless peripherals and aware of the risks, by all means use them.

There is much to say about setting them up. Enable Bluetooth on the tablet and put the mouse or keyboard into pairing mode. Once the device is recognised simply connect.

USB OTG

So first, the simple case. Get a micro USB to OTG cable. Most tablets and phones will have a micro USB socket but some are now coming with USB-C. (In that case you will need USB-C to OTG or a male USB-C to female micro USB adapter.) USB OTG is the USB On The Go standard. This allows the phone or tablet to act as a host for USB devices, just as a laptop or desktop computer does. It requires that the tablet or phone support OTG. In order to run both a mouse and a keyboard you will also need USB hub. For just a mouse and keyboard I did not need a powered hub on any of the devices.

But there is one problem you will likely run into. The host device (your phone or tablet) cannot be charged while running in such a configuration without a special cable. It is possible to get an OTG cable that will charge the host while providing OTG data access for peripherals, but be careful to check compatibility with your device, if you can, and make sure the cable expressly states this simultaneous charge and data support.

Charging and use of data devices simultaneously appears to requires 11 pin micro USB rather than 5.

Keyboard Driver and External Keyboards

In order to be able to use Hebrew and Greek you will need to install a keyboard application. There are a number of issues so keyboard software will treated later more fully. This issue to describe here though is this; when you install a keyboard driver in Android it is usually the case that you will be using it on the virtual keyboard which appears on-screen. I had initially assumed that setting the virtual keyboard driver would also apply to the USB keyboard. This is not the case. Each are mapped separately. You will not see the option to choose the keyboard driver until you actually plugin in the keyboard.

In addition, on the Note III (Android 5.0) the USB keyboard is then visible in the Languages and Input there will appear a setting for the keyboard. It is separate from the virtual keyboard and at least in my case identified the keyboard by name. On the TAB4 (Android 7.1.1) the situation was more frustrating in that the keyboard entry is not always visible in the settings. When the keyboard is first plugged in a notification appears and you can map it. After that was been done I only saw that appear once or twice more and not since. As a result the mapping is hard to update. I still do not know how to update it after the initial assignment. I also do not know if this is Android 7.1.1 or the Lenovo that is responsible for this.

Video Output

Again there are various options for video output to a larger screen. This is device dependent. You can go with MHL (Mobile High-Definition Link) to HDMI, to get to a monitor, if your device supports it. Otherwise you will need a wireless solution and there are a number of protocols available.

Wireless

What I have tried successfully with all three devices is wireless screen casting. This requires a Miracast or similar dongle which outputs HDMI. No doubt there are many other options. I use an AnyCast M4 Plus which does Miracast, DLNA and Airplay. (Airplay is apparently Apple’s wireless video protocol, Miracast is the industry alternative and DLNA is the Digital Living Network Alliance which is form of universal plug and play.). It also does Wifi Direct. The instructions are terse.

You will also need a female to female HDMI adapter to plug the dongle into your monitor HDMI cable unless you plug it directly to the monitor or TV’s socket. Once this is plugged in and booted it will present a wireless endpoint which may be discovered by the phone or tablet. Follow the instructions for the dongle and once it is booted up and in the right mode navigate to the screen mirroring option in the phone or tablet. It will scan for wireless endpoints and once it finds one you can connect.

Screenmirroring (Screencasting)

On the TAB4 the setting is called Cast under Settings -> Display -> Cast. On the Note III it is under the Settings -> Connections -> Screen Mirroring. On the Tab S3 it is under the quick settings and is called Smart View.

If the dongle is not in the right mode you will fail to connect. Ask me how I know. So as I said, follow the instructions. You may have to try more than once. Once it is connected I have found the connection to be very stable. The Tab S3 is the easiest to connect actually and you do not even need the steps below. Just plug the AnyCast in and start Smart View.

The TAB4 is not doing Miracast. It disconnects from the Wifi network when it connects to this dongle. My suspicion is that it is using the Wifi to discover the Wifi Direct endpoint. It will connect with a slightly different sequence of messages being issued by the dongle, clearly being issued an IP address. Once it connects you can simply reconnect the Wifi and both will work.

Troubleshooting Tips with AnyCast

Finally the AnyCast dongle is not always very easy to connect. Once connected it is fine, but sometimes connecting can be problematic. I find that one must rigorously follow the following steps :

  • plugin the dongle to a USB power brick
  • plugin the HDMI cable
  • when it comes up, it displays the “Waiting for connection…” message, then press the little button on it once.

This is pretty much all in the instructions.

If that does not work I then try again but sometimes I erase its data and retry. This is done by holding down the button until the somewhat scary “Erase user data …” message appears. It will reboot and it will have chosen a new random name which it will advertise. It should be noted that sometimes the phone or tablet benefits from a reboot. The TAB4 had a problem shutting down wfd (Wifi Direct) daemon after one session and could not connect subsequently, until rebooted.

This will not be a fast connection but if you aren’t it shouldn’t matter much.

Screen mirroring to a PC

It is possible to use a Windows 10 PC as a Miracast host and screen cast your tablet or phone to it. This is useful if you wish to then web cast activity on the tablet or phone. Windows 10 has an application called Connect which turns the PC into a Miracast host. With this running, you can simply run Smart View on the Tab S3 and cast the screen into a window on the PC. The Note III Screen Mirroring also works simply with Connect.

The Lenovo TAB4 also connected successfully which surprises me because I thought it could not do Miracast. But perhaps Connect is providing Wifi Direct support also. The TAB4 seems to be able to receive input from the PC mouse, which neither the Note III nor the Tab S3 could do. However, this resulted in two odd affects. First, the mouse thumbwheel seems to operate in the opposite direction in the tablet window. Secondly, the mouse seemed to get stuck in the tablet window and I had to halt the screen casting to regain control of it. Not especially useful in short.

Wired

I got an MHL cable and sure enough the Note III and TAB4 work with it. The Tab S3 does not because Samsung has moved away from MHL I understand and the device only supports wireless video casting.

Keyboard Drivers

I have tried a number and it will depend what you are trying to do as to which one works for you. I am interested in Biblical Greek and Hebrew and thus I need a keyboard that can produce various diacritics marks. I am currently using Keyman with English, Greek and Hebrew languages installed.

Pitfalls with keyboard drivers

In addition to keyboards you will need an editor or two. They may not support various things you need.

TextMaker will not render entered Hebrew with nikkud though it will display documents containing them. In addition it does not like Keyman’s language switching. This is clearly a bug; it loses the ability to process the carriage return quickly until it is restarted. Otherwise though, TextMaker is a very good program and will open Word and Open/Libre Office files. In addition it is easy to add fonts to it. I have installed the Accordance font in it which makes it easy to get it to correctly render documents that have Greek and Hebrew and show the diacritics.

iA Writer is happy enough with either language on Keyman but it does not properly pass on the hot key for activating the language change for the keyboard. This is also a pain as you have to temporarily exit the app to switch language.

Andro Open Office does not handle diacritics but is happy to correctly process the language changes. It also does not do RTL text.

Finally the behaviour of the same keyboard with the virtual keyboard may differ in small ways from the way it works with an external keyboard.

Performance and Behaviour Notes

I am prompted to included this section only since I have now got more basic things going and I am writing this document on a full-size USB keyboard. I am noticeably out-typing the tablet (the Lenovo TAB4) and can sit here and watch the words being rendered on the screen. And this without mirroring the screen. This is just OTG with a mouse and keyboard. That said it is way easier and faster to type than it would be on the virtual keyboard. But one amusing side-affect of this is that one can grab the mouse while the characters are appearing and click in the middle of some place, say further back in the text and the characters will be entered there. You need to be a bit careful with backspace if you have a few words in the buffer too. All a bit odd I must say.

With the keyboard cover on the Tab S3 I have not been able to outpace the tablet. This is no doubt due to its considerbly greater power of the Tab S3, and perhaps to some extent my needing to get use to the small keyboard. But it doesn’t feel like I am even getting close.

Other Peripherals

Unitek Dock for the Note III

As you should now be able to imagine connecting an Android device to a mouse, keyboard and external screen can result in a mess of cables, connectors and adapters. Indeed it can. This is where a dedicated dock can be a huge benefit. The problem is that these are often device specific, or at least not functional for all devices. In addition some will not charge the device while it is in use.

I eventually found a dock for the Note III which supports a number of earlier Samsung phones made by Unitek. This is the MHL+OTG Smart Phone Dock. It provides 3 USB ports and one HDMI output. It has a small micro USB pig tail to connect to the phone. It requires power to be supplied via the phone’s USB charging brick. It comes with a regular USB cable to connect the dock to the power brick. This dock also charges the phone while it is docked and in use. Overall this is a very good solution. If you can find such a dock for your device it can be a very good buy. This only cost about $16.

Wacom Bamboo Tablet

This was just an outright fail. No response from the TAB4 to this device at all.

Next Items for Testing

  • A wireless keyboard perhaps

Alphabet trainer …

Just posted a new application to puzzles.fortysevenrooks.com for practicing various alphabets. Check it out at puzzles.fortysevenrooks.com/alphabets. This app gets you to practice ordering the letters of Biblical Greek, Biblical Hebrew or Hebrew transliteration in alphabetical order.

In addition it will time you and highlight any errors you have made when you are done. Hinting will come when I can work out a decent way to hint without giving too much away.

Page sizes on the web

It’s been quite a while since I have built a website. At the time I did it I was very conscious of page size. I was working on a website with many images of pottery, and it was 10 years ago, so there was reason to be concerned. Today I was working on a revision to puzzles.fortysevenrooks.com to add a new SPA. I wanted to put up, and in fact did put up, an image based landing page with screenshots of the now two apps on the site. Comically it turns out I was worried about 150K of images ! A quick search on the web revealed a very informative article about page size growth over recent years. See https://www.soasta.com/blog/page-bloat-average-web-page-2-mb/ to understand why I needn’t have been concerned.

Some technical details of the Word Puzzles site

As mentioned in my recent post http://47rooks.com/2017/04/15/word-puzzles-in-dead-languages/ I published the puzzles.fortysevenrooks.com word puzzles website. Here are a few technical details for the techies among you.

As with the previous post this is based on the Text-Fabric library, this time for the Greek and Hebrew word lists used to construct a word search puzzle. Another key library is the uniseg UAX 29 segmentation library which allows one to segment a string with diacritics in it into a list of letters for each box in the grid. In pointed Biblical Hebrew of course each letter will contain diacritic marks. uniseg allows one to group the consonant with its vowels and other marks correctly for display. The same is true of the Greek where accents are common.

The site itself is hand constructed from HTML, CSS, Javascript, JQuery and a few other JS libraries. This served mainly as a update for me in these technologies since I last did a site. Hopefully a web components update lies in the near future which would enable things such as on-screen puzzle solving for the user and so on. The site will likely evolve over time with newer tech in other places also.

I should note that for anyone looking to get their feet wet with coding in these languages before diving into fully fledged frameworks like Django, or UI JS libraries like Oracle JET, Polymer or React, Dane Cameron’s A Software Engineer Learns HTML5, JavaScript and JQuery is well worth a look. It is aging just a little now, and one could fault it here or there, but overall it gives one a good clear introduction on which to build later.

Regarding hosting environments. I decided to pilot using Google Cloud Platform for this. I initially thought to try using AppEngine for it but hit a snag. The first issue is that one must configure a custom AppEngine environment because the code I use needs Python 3.6 and GCP, as of this writing, only supports up to 3.5 pre-installed. But this is not a great difficulty and getting 3.6 is ok. The second problem is harder though. It appears that they do not support the use of sqlite in AppEngine. This pretty much sank the attempt. There are various speculations on the web as to why this might be. It really doesn’t matter much because if it isn’t supported uniseg will not run as it relies on it.

So to ComputeEngine. Now CE requires more setup but with it you get more flexibility. I initially tried the smallest CE instance they offer, an f1-micro instance. This instance is simply too small. My bottle container kept getting killed and my suspicion is that it was the CPU hogging protection. I suspect I would have had memory issues too. In the end my container stabilizes at about 2.4GB resident with both Greek and Hebrew data loaded. An f1-micro only has about half a GB if I recall. After that I simply went to a n1-standard-1 (1 vCPU, 3.75 GB memory) instance. That works very well and is noticeably more performant. I won’t bore you all with the details of how I set it up unless there is interest.

But suffice to say, with a bit of playing with Google’s Cloud DNS configuration and some iptables magic I have a serviceable network presence and a nice little VM in which to further develop this project.

It’s currently built on bottle which I suspect it just not adequate so I’ll probably look at other options pretty soon.

Let me know if you have any suggestions, comments or problems.

47

Word puzzles in dead languages !

For some time now I’ve been working on a word games program against biblical texts. Having fun with language and meeting it in multiple contexts really helps with absorption. To this end then I have wanted to be able to produce word searches, cross-words and the like in Biblical Greek and Hebrew.  puzzles.fortysevenrooks.com provides a way to generate word searches from the original languages of the bible as a first step, and could be expanded very readily beyond that. It is rudimentary in many respects right now and there are a ton of obvious enhancements that could be done. But it demonstrates the point. It’s also basically usable. I cannot swear to stability.

I hope that with such puzzles people will find an enjoyable and educational pass time as they learn these languages, and just for fun.

Feel free to post comments or suggestions below. Also feel free to copy the word searches and use them for teaching, or just for fun. That’s the point after all – fun with language !

47

Pandas and the Greek New Testament

This post is really starting in the middle but then why not !

I have been using a Python framework out of The Netherlands called Text-Fabric which gives one programmatic access to the ETCBC Hebrew and SBLGNT texts. It is very far off the topic of this post to discuss its features and such so I refer the curious to https://github.com/ETCBC/text-fabric/wiki which provides full instructions on how to set up the environment. Anyone not familiar with ETCBC  (Eep Talstra Centre for Bible and Computer previously known as WIVU) can learn more here http://www.godgeleerdheid.vu.nl/en/research/institutes-and-centres/eep-talstra-centre-for-bible-and-computer/index.aspx.

From this point I will assume a certain familiarity with Python, IPython, Jupyter Notebooks, Text-Fabric, hereafter TF, and less with Pandas. Told you I was starting in the middle ! So onward …

I have been reading Luke in Greek and in conjunction with that Steven Runge’s Discourse Grammar of the Greek New Testament and I was reading about δε. Now it occurred to me that it would be interesting to know how widely distributed δε is in Luke. Of course, one can do such queries in a snap in programs such as Accordance and then graph the results. Naturally I wondered if I could do an Open Source version. Last week I ran across Pandas, not the large furry black and white almost bears, but the panel data set library for data science work in Python. Reading a little on it, it occurred to me that it would be possible to combine Pandas and TF and produce a plot of the kind I was looking for. (Anyone not familiar with Pandas is going to need to quickly look over http://pandas.pydata.org/ and in particular http://pandas.pydata.org/pandas-docs/stable/10min.html. By the way, it’s not even close to just 10 minutes !)

Data Science is a huge topic which I am equally hugely unqualified to say anything much about. However Python has many cool libraries with which to do data science work, Pandas being one. Pandas is used for work similar to that often done in R. Here, its basic Series data type will be of help. In addition one can make use of matplotlib to plot the graph. TF will provide the raw data from the SBLGNT and a little bit of Python will bucket the occurrences of the word δε.

Assuming you already have a Python 3.6 setup with Jupyter the next thing to do is get Pandas and matplotlib installed into python. Use pip:

pip install pandas
pip install matplotlib

With that in place and TF installed per the wiki above, and the text-fabric-data installed and set up also we are ready to begin.

At this point the next thing you will need is the Jupyter Notebook which I githubbed here https://github.com/47rooks/bible-software-modules/blob/master/TF-Notebooks/de%20in%20Luke.ipynb. It requires 3.6 of Python for which I make no apologies. (The person who got me onto 3.6 f-strings knows who is he is 🙂 ) The notebook is pretty self-explanatory if you have done all the required reading 🙂 If not you be able to follow the trail once you have looked at a few of the sites above.

And as a little encouragement here is the final chart

47

Eclipse as a basis for LRW

The Eclipse development IDE (eclipse.org) is a extensible platform providing a substantial set of basic facilities that applications need. It may be extended in many ways through a very well developed plugin model. Entire products are developed on its substrate that look nothing like the IDE itself. Having written a plugin for Eclipse for source code control I wanted to explore how the platform might be leveraged to run LRW. Attached is my first take on this possibility.

47

BSSAOnEclipse

Language Study Software

For some time now I’ve been thinking about the state of bible study software. Features are constantly being added to these tools. Yet it always seems that someone would like to do something a little differently, or would like this or that little tweak. I’ve thought before now that an extensible model for bible software would be a good idea. That way users with the skills could also contribute modules, not just books or commentaries or notes but actual new functionality. This would allow people to pursue the particular features they would like to see and perhaps other users would not ever need to install or use that functionality. This approach is fairly common in software.

Another thing that has also struck me, and others, as problematic is that while users may create modules in some software, these modules are often more restricted in what functionality they offer. This makes such modules rather like second class citizens. This seems completely unnecessary and could be readily done away with.

While considering these and other aspects I realized that one could make the argument that bible study software is in fact too narrowly focussed. Much, perhaps almost all, of the features available in bible study software could be deployed in the study of other texts. One could imagine the study of Shakespeare using such software, even creating a syntax model for Early Modern English. Likewise morphological tags could be created to permit morphological queries against other literature, the Edda’s perhaps. Why not ? And the note taking and highlighting and other support of these tools plus of course the search capabilities would find great use.

The attached documents explore the possibility of the creation of a fully extensible language study tool, one which could be developed on open source principles if desired.

47

BibleStudySoftwareArchitecture