Android Support

Been thinking about supporting Android lately – if this is feasible and how easy it would be.. To be frank it would be troublesome porting sprot & spipc to Java and I am not even sure this is interesting enough to spend my free time on it.

However, as Android has Linux at its core running native code should be relatively easy, so my idea for now is to use this possibility – compile the whole solution with NDK, there is even Boost for Android so everything should be covered.

fplog, which is a client-side API will have to be wrapped JNI style to be usable out of Java apps. Also I am planning to include fplogd daemon as a resource for installable APK package and run the fplogd process from Java like it is described here.

The project is pretty far from running on Android but at least I see the way it could be done and I will try that after I see fplog working on Windows and normal desktop Linux.

Progress Report

A brief summary of how things are going with my projects.

Touch Typing

After 7 weeks I stopped training and started using this new skill in day-to-day activities. Now 12 weeks have passed since I started and I should say that I am back to regular practice – I keep making lots of mistakes and need to correct myself all the time, especially when typing involves large number of special characters & punctuation (e.g. programming). So, back to keybr.com non-legacy version, they made great improvements and provide possibility to include all those pesky punctuations into training sessions. For now I am stuck at about 19 wpm with 5 or so mistakes per minute in general.

fplog

Protocol is ready and tested but IPC proved to be a harder nut to crack so I am doing and re-doing it currently. sprot does not allow broadcast and full duplex communication which makes everything harder and communicating processes need a way to identify themselves, like when some process is writing it specifically needs to state who should be the receiver of this message. This does not align well with the model of fplogd listening for “new connections” from components that want to send log information. So there should be some mechanism (maybe config files) that will tell fplogd what senders it should listen to.

That’s about all I wanted to tell with this update 3 months into the not-so-new-anymore 2014 year. Last bit of statistics – I managed to put around 6 hours per week into fplog project, so I am a lazy bastard and should do a better job :)

Touch Typing Week #7

Seems like I have reached a plateau – for about a week speed & number of errors stayed more or less the same. I have tried to use this new skill in my daily tasks but have again noticed that I am totally lacking skills in using punctuation and other special characters which makes using touch-typing not practical yet.

With this in mind I have started to search for a software that includes other characters besides letters in training sessions. It turned out that using non-legacy mode it is already possible with http://www.keybr.com, however as I understood, digits are still out of the scope of the regular lessons. Anyway I am continuing my training sessions, now including punctuation & capital letters. Because of that reported stats have dropped significantly (as you can see on the last bar of the chart), the actual results are worse than the chart shows though because non-legacy version of the http://www.keybr.com has different charts and I will be posting those later, what you see on the last bar was an attempt to type in some text from the news site.

So my actual typing speed now is ~14 wpm on average, including punctuation & stuff. However a good news is that now I can start using touch-typing to some extent, for example to write this post. That wasn’t very fast but at least I see the progress and really believe that in some weeks ahead I will be able to type like this at work.

touch-type-week-7

Touch Typing Week #5

Please look at your left, we will be passing the initial estimation right about now. Well, that’s it for touch typing in 5 weeks – not happening. Lots of of work and other small tasks forced touch typing out of the day-to-day activities, will be trying to get back on course during the weeks ahead, now I guesstimate another 3 weeks should do the trick for English but then 8 more weeks for Russian.

touch-type-week-5

Touch Typing Week #3

Time for another update on my touch typing skill progress: after 3 weeks I can say that I definitely see improvements, the chart will tell you the same, however I am not ready to touch-type yet (tried to type this post using this method but it was so slow and frustrating that I had to do it the old way :) )

The main problem now is that the tool does not use any other keys except letters and when I need to press “backspace”, correct a mistake or place quotes – this just ruins the flow completely and slows down things tremendously – I wonder if the tool has some exercises for those keys too or I will have to just adapt to other keys on my own.

Anyway besides me being lazy and skipping some days of practice it is working and I am going to continue, the initial estimation is surely going to be blown off by a significant margin but hey, I still want this skill – probably couple more weeks and English will be conquered, then it’s Russian.

touch-type-week-3

SProt Client Mode State Diagram

Client side of sprot is finally ready too. Well, at least main logic is defined. While I was at it I understood that sequence numbers of data frames will be needed to resolve situations when server accepted a frame X and sent an ack but client did not receive this ack from server  for whatever reason and retransmitted the same X frame. In a such situation the server should just ignore the frame and answer with ack again.

Introduction of the sequence numbers caused some changes on diagrams posted previously, so those posts were updated. The sequence number will be reset each time mode switch frame is received and mode switch is performed, also because it’s only a single byte sequence number will be reset to 0 after reaching value of 255.
sprot client states

SProt Server Mode State Diagram

Here is how message exchange looks like from sprot server perspective. Diagram could be optimized by having a generic frame received state followed by crc check and sending nack in case of failure, but I realized it too late – already spent more than hour drawing that thing so I just left it “as is”.
sprot server states

Meet SProt, FPLog Communication Protocol

As one of the features of FPLog should be an ability to send arbitrary large log messages, communication protocol with packet assembly is required. The same protocol will be used for application to fplogd and fplogd to log collecting server communications. For now I am thinking about having only blocking IO but it might change later. Also this simple protocol (or just “SProt”) might be moved to a separate library. Maybe I am reinventing a wheel a bit with this protocol but in this project I do have such luxury because the goal is not to make it happen as fast as I can but to gain knowledge and practice my craft to become better, I have enough of reusing stuff at work so at least here I can make dumb choices from time to time :)

Here is an overview of the frames protocol consists of, state diagrams and logic will be described in later posts.

sprot frames*CRC7 polynomial 0×91 was used for CRC calculations.

FPLog Design Overview

Spent several hours thinking, selecting the drawing tool and finally making the sketch. Decided to try some diagramming tools available for Android tablets and found one that I liked very much (DrawExpress Diagram) – it allowed me to produce quality schematics pretty fast, learning curve is very merciful and the tool supports various connector types to show OOP relations, “bring to front” / “send to back” functions to create composite objects like boxes inside boxes, etc. Of course there is a group selection ability and finally the most interesting part – the tool is gesture-based, there is a number of simple to remember gestures that draw stuff on screen.

However not everything was as smooth as I wanted it to be: when I was making final strokes to fplog draft design the application crashed and it started to crash every time I tried opening fplog.de file.. I thought that I would have to start over and was quite disappointed as you may imagine but there was a possibility the format of the file is human-readable like XML or something and there is a chance I can fix the corrupted file to make DrawExpress work with this file again.

Docked my Galaxy Note 10.1, fired a terminal, switched to root to see all files (yes, my tablet is rooted) and executed

find / -type f -name "*fplog*"

That gave me a file inside “/data/data/com.drawexpress.full/files/” so I copied it to a non-root accessible folder, chmod to 777 and copied to my PC over FTP.
When I opened fplog.de file I was pleased to find simple JSON inside, it looked like there were all objects sorted by creation time followed by array of connectors that connected all these objects. When the editor crashed I was trying to add couple of connectors, so I decided to remove several connectors from the end of the file. Well, few JSON objects later I was overwriting my original fplog.de file on my tablet with the one edited on PC.
Rejoice! It worked and DrawExpress stopped crashing, here is the design I was so eager to save:

fplog_design_draft

Touch Typing Week #1

Well, I must say that it is harder than expected and also I was too lazy to do it every day at least not for 30 minutes (on average I was touch-typing for 21 minutes a day). Anyway there is some progress, see the chart below (don’t pay much attention to the first 2 days – I was not positioning my hands correctly for doing proper touch typing, on the 3rd day that was fixed and speed dropped almost below zero :) along with the number of typos). So now I am able to touch-type 12 words per minute doing 10 errors, that’s it for the first week.

touch_type_week1