Monday, March 13, 2017

Installing Kubuntu 16.04 on ThinkPad T420

Installing Kubuntu 16.04 on ThinkPad T420

It was again time to reinstall Kubuntu to get more of latest stuff. I had purchased a Kingston 480 GB SSD drive, which was much bigger than the 120 GB one that I had used for some five years. I need to do a lot of video editing, so I needed a lot of disk space, and it must be fast.

I downloaded the Kubuntu 16.04.2 LTS version. I definitely want to use the LTS versions, as I don't want to upgrade every few months.

These are my notes for the process, just to remember what I did there. I'm writing them here just in case someone benefits from it somehow, such as regarding some of the problems.

Creating a USB image

Run usb-creator-gtk. Select the ISO image and the drive to write to. Start writing the image. The actual burn took me quite long, perhaps around half an hour. I have no idea what it did there, but at some points I thought it was stuck. Nevertheless, got it done.

Booting

Booting from the USB stick, I got the following error:
gfxboot.c32: not a COM32R image
It kept repeating.
Pressing Tab gave a menu of commands. I typed "live" to start the live mode. It worked just fine.

Installing Kubuntu

Once the live mode had started, I just clicked the Install Kubuntu 16.04.2 LTS icon. The installation APP popped up.
  1. Language – I chose "Suomi" (Finnish) as my installation language. I've been doing Finnish localizations of KDE and always want to use that. (Note that UI captions mentioned from here on are my back-translations from Finnish to English)
  2. Wireless connections – I chose to connect to network. Oddly, the keyboard layout was in en-US layout, not Finnish. That should not go so.
  3. Preparations – I wanted to choose to download updates when Kubuntu is installed, and also install 3rd party drivers. Oddly, the check box for downloading updates did not work! Pressing Continue took quite a while with no progress feedback.
  4. Installation type – I wanted encryption, but "encrypted LVM" sounded like some low-level encryption, which I didn't want. I assumed that the default was to have encrypted home directory, and encrypting entire disk would not be a huge benefit. I was installing on SSD, so I didn't want swap. Using the guided installation seemed to use swap, which is kind of stupid nowadays that it doesn't default no-swap on SSDs, so I had to do manual partitioning. Hence, I selected Partition yourself. So, I added a single /dev/sda1 partition with root (/) mount point that uses the whole disk. Ext4 filesystem was OK. Again oddly, it complained about the missing swap. Really, why doesn't it recognize SSDs? Everybody uses SSDs nowadays and nobody wants swap on SSDs!
  5. Time zone – chose my time zone.
  6. Keyboard – chose my keyboard (Finnish). It is a bit bad that it asked keyboard here and not before entering wireless password, where it really would be needed.
  7. User info – pretty straight-forward here. Noticed to select Encrypt my home folder, which enables EncFS for the home folder. That can cause trouble in some cases, such as reinstalls, but it's mostly what you want unless using whole-disk encryption. I did not want that because I want to have encryption more controllable and have more efficient non-encrypted directories.
  8. ...installation went quite smoothly. Reinstalled the machine. Pulled the USB drive out a bit too quick, so had to restart, but everything seemed to be OK.
Kubuntu booted rather fast and also KDE started rather fast. That's an improvement. And it looked good.

Then on to the settings.

System Settings

  • Optimize for SSD. You don't want atime access and such for SSD drives, so have to set in /etc/fstab for the root filesystem:

       defaults,noatime,discard

    There's probably some other relevant settings needed as well. This is a bit surprising issue, as most laptops nowadays have an SSD drive and they should be optimized automatically, without hell requiring a specialist. OK, I'm rather one, but still.

 Toolbar Settings

  • Chose to hide the toolbar automatically.
  • Set it a bit higher, as the height doesn't really disturb when it hides automatically, and I want to be able to see and click even smaller icons better.
  • Application Launcher –  The default is a new "fancy" application launcher, but I want to use the old tree-like one.
  • Quick Launcher – This is a handly grid for having quick launch buttons for the most commonly used applications.
  • Pager – Allows switching between desktops.
    • Configured to no text, but icons, so that it shows miniature icons for open windows in each desktop. You can actually drag and drop windows from one desktop to another in the pager.
  • Task Manager
    • Rows at most: 2, and always organise tasks in those two rows.
    • Only show windows in this desktop, as I often need to control the visibility of windows from the task manager and it gets rather confusing if it shows also the windows in other desktops. Only show windows in this display (I only use one display anyhow).


Arranging the toolbar proved really difficult. Applets were positioned in wrong places and moving them was really buggy.

KDE System Settings

Started up the System Settings. First, I chose the "Classic Tree View", which I've used for the last 15 years or so.

There was a lot of settings that I wanted to do:
  • Appearance
    • Workspace Theme
      • Look and feel – There are two choises: Breeze and Breeze dark.
        I want to use dark theme on my external OLED TV display. In OLED, black is true black, so I wanted to use black desktop. Hence Breeze dark.
      • Desktop Theme – Again choosing a dark theme, the Oxygen theme. That actually didn't have much effect.
      • Oddly, I haven't found a way to set desktop background to completely black. Setting black background still has some low brightness, making the screen look like LCD. In an OLED display, black should be completely black and it works that way with my other computer, so I don't understand why not here. Can't find a setting that could cause the problem.
    • Colors – Chose Obsidian Coast, which seemed rather dark, but not entirely. I don't want all black inside windows, as that sometimes causes trouble when applications assume black-on-white colors.
    • Font – The default font was Noto 10 pt, which looked rather great. However, in Libreoffice, I noticed that font rendering is horrible, so I tried tuning the font antialising settings, as instructed somewhere, but that didn't seem to help.
  • Workspace
    • Desktop
      • Desktop Effects
        • Desktop Cube – I use the desktop cube animation (see below), and set the rotation time to faster 200 ms, set Windows float on top, and Use the effect to browse desktops.
        • Desktop Cube Animation – I set the animation time to 200 ms, which is rather OK, although could be a bit quicker still. The default was way too slow. I had to disable "Use pager layout for animation", as I have two rows in the pager, but animation gets really weird that way.
      • Virtual Desktops
        • Layout – I always want eight, in two rows in the desktop pager in the panel, hence 8 and 2 in the settings.
        • Desktop names – Yeah I like to give them names.
        • ChangingAnimation – I really like the KDE's 3D desktop cube animation, so I chose that, as describe above.
        • Shortcuts – Changed the keyboard defaults for changing the desktops. For some sick reason, KDE uses Win+Tab and Shift+Win+Tab to browse "activities", but I really want to browse the desktop list. OK....there still seems to be the bug that can't use Shift+Win+Tab. The Shift key there does nothing, so had to use Ctrl+Win+Tab.
        • For some reason, the Win key does not work on my Logitech G110 keyboard. I was able to use the keyboard for several years with the old version, but then it appeared suddenly. I have to see if
      • Desktop Locking – Disabled this for now, as 5-minute locking is a bit annoying at home.
  • Window Chooser
    • Choose to use Compact rather than the default one.
    • Deselect Show selected window. The default is too disturbing.
  • Power Saving – When plugged in, don't dim and don't change mode if the lid is closed.

Extra Packages

  • kubuntu-restricted-extras – Gets MS core fonts (Times New Roman) and such.

Firefox

  • General
    • Set Firefox as the default browser
    • Set Ctrl+Tab to browse in order, not latest
    • Save downloads to a custom folder. I don't want those under my home directory, which is encrypted and backed up. Hence, I usually have a download folder directory such as /ftp (some long history with that naming).
    • Deselect opening new windows to tabs. I want to control that.
  • Content
    • Set default font size to 14. The default 10 resulted in really tiny letters on many pages.

Other Software

  • KDEnlive – Linux video editing software. I use this for all of my Youtube and other videos.
  • Synfig – Animation editor, which I have been experimenting with recently.
  • Kaffeine – Video and movie device viewer. I have been using Kaffeine for TV viewing for years. Nowadays I'm not using my TV card anymore, rather a real TV, and use Kaffeine for viewing camera videos.
    • MP4 support was missing, had to install also libxine2 plugins:
      # apt-get install kaffeine libxine2 libxine2-all-plugins
    • MTS video playback is broken! It shows green "static" about once a second. Actually, it also shows for MP4 in some cases.

      This is rather annoying, as all of my camera videos are in MTS. It looks like it's a problem with hardware acceleration. If I edit .kde/share/apps/kaffeine/xine-config and set video.driver to a safe setting such as xshm, it plays just fine. Well actually it doesn't, because the video mode is not hardware-accelerated, so it is laggy like hell. I haven't found a good video mode, so Kaffeine is currently rather unusable.
  • VLC – Installed also this, as MTS playback was broken in Kaffeine, but it seemed to work just fine in VLC. VLC also has some other features that I need, such as playing 50 FPS video back in half speed. I don't like VLC's GUI so much and some things like browsing video folders is total hell.
  • Octave – Mathematical software.
  • Jed – My preferred quick command-line editor.
  • Atom – I like to use the Atom editor for some stuff. There was no Ubuntu package for that, so had to get the DEB package from atom.io. It required installing "apt-get install git gvfs-bin".
  • Thunderbird – My preferred email client, although it does have some issues.
  • Kazam – A screen recorder that I use to make video presentations. 
  • LibreOffice –  This was actually preinstalled, but for some reason, the font rendering is horrible. It's a Gtk application, so it renders fonts a bit differently from native KDE/Qt applications. I tried some fixes, but no success so far.
There's tons of other software that I need to install, but that's a start.

New Things

For one thing, KDE was able to link up with my Android phone with KDE Connect. It's at least useful for file transfer and such. It will be interesting to learn what it exactly does.

Conclusions 

It took me some years to update (K)ubuntu, but it was worthwhile. The speed seems to have improved greatly. Some of that may be due to the faster SSD, but also rendering seems significantly faster.

I am a bit disappointed with some serious bugs, especially in organizing the desktop panel. That is a very basic task and beginners would get really frustrated. Font problems with LibreOffice seem like something very basic. I am also surprised that there is no special installation mode for SSDs. KDE also has many rather odd defaults.

There is probably much to learn about Kubuntu 16.04. Most importantly, it gives me latest versions of various important software.

Thursday, March 17, 2016

Finding longest lines in XSLT

I needed to scale some code listings so that they fit the width of the page. DocBook doesn't have a particular automation for that, so I needed to find the length of the longest line in a listing and do scaling according to that.
So here it is:
<!-- Finds the length of the longest line in the given text -->
  <xsl:function name="vaadin:longestLineLength">
    <xsl:param name="listing">

    <xsl:variable name="firstLineLength">
      <xsl:choose>
        <xsl:when test="contains($listing, '&#xa;')">
          <xsl:value-of select="string-length(substring-before($listing, '&#xa;'))">
        </xsl:value-of></xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="string-length($listing)">
        </xsl:value-of></xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="longestInRest">
      <xsl:choose>
        <xsl:when test="contains($listing, '&#xa;')">
          <xsl:value-of select="vaadin:longestLineLength(substring-after($listing, '&#xa;'))">
        </xsl:value-of></xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="number(0)">
        </xsl:value-of></xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:choose>
      <!-- Must use number() here or otherwise it'll use string comparison. -->
      <xsl:when test="number($longestInRest) &gt; number($firstLineLength)">
        <xsl:value-of select="$longestInRest">
      </xsl:value-of></xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$firstLineLength">
      </xsl:value-of></xsl:otherwise>
    </xsl:choose>
  </xsl:param></xsl:function>

It can be called for example as follows:
<xsl:template match="programlisting | screen">
    <!-- Extract text content by eliminating formatting tags -->
    <xsl:variable name="content">
      <xsl:apply-templates select="* | text()" mode="text-listing"/>
    </xsl:variable>

    <xsl:variable name="longestLineLength">
      <xsl:value-of select="vaadin:longestLineLength($content)"/>
    </xsl:variable>

    <xsl:copy>
      <xsl:if test="$longestLineLength > 50">
        <xsl:attribute name="dbscaling">
          <!-- This should give 65% scaling for lines 63 chars long -->
          <xsl:value-of select="(50.0 div $longestLineLength) * 95"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

Note how you need to give the listing as pure text to the method, and node as an input node structure.

Monday, February 29, 2016

Editing PDF with a Text Editor (Emacs)

I'm again making a new edition of Book of Vaadin. The PDF was made some time last year and the place in which it will be printed has changed.

In earlier times, this kind of changes to editions would be a matter of the printing house and little interest to the authors. One interesting example is the printer's key, which was a list of numbers to indicate the print run. The printer (a person) simply had to file off the letters from the Linotype plates. Changing the print location was not possible in Linotype or offset, but easy in even earlier letterpress printing. But here we are, in the age of technology, that the people doing printing do not want to open a PDF editor to change such details.

There are some PDF editors for Linux, but I want to be careful about not changing the content in any other way. Thereby, editing PDF with a text editor is handy for such tasks. The problem is that PDF is compressed, so you can't edit it directly.

The very simple solution that I used was to use the pdftk tool to uncompress the file, edit it with XEmacs, and then compress it again.

$ pdftk original.pdf output uncompressed.pdf uncompress

Then edit it in Emacs (which is suitable for editing even huge binary files) and compress again:

$ pdftk uncompressed.pdf output edited.pdf compress

Start heating the printing machines!

Sunday, May 18, 2014

Problems with Goal Zero Sherpa 50 and 220 V Inverter

I have again been developing my outdoor power system, with the goal of eventually being able to work remotely. With the Goal Zero portable solar system, my success has been more than zero, but still lacking.

Some two years ago, I purchased the Nomad 7 and the Guide 10 power pack. They have been proven great for charging AA batteries, cell phone, and such while hiking or kayaking. However, I'd like to be able to power a laptop, even a small one, so that I could communicate, write, and perhaps even work while on the go.


Last year I experimented with a 27 W folding panel and the Sherpa 50 v2 power bank. While they worked somewhat well, I was not completely satisfied. The 27 W panel was not able to power even my small Acer Aspire One D270 netbook, which takes around 15W power. Well, the sun is not so bright in Finland, but I had expected better than that.


So, I went on and purchased the newer 13 W folding panel. With it, I seem to get enough power for the netbook, and even my ThinkPad T420 seems to work at midday, although just barely. The laptop should take around 25 W when it's not charging, and more when it is.


Unfortunately, I have not yet found proper connectors, so that I could hook up voltage and ampere meters to the solar panels to measure their real power output. That is something I intend to do in near future.

Broken Inverter


I also purchased a 220 V inverter for the Sherpa 50 power bank, so that I could power devices that want more than the 5 V 1 A, 12 V, or 20 V that the power bank gives out by default.

Unfortunately, after using the inverter for just a week, it broke down. I had used it just to power my camera battery charger, so the load was very light, and when it broke, it wasn't even charging. After breaking up, it seemed to short-circuit the power bank so that it gave out error status.

Fortunately, the German dealer replaced the inverter without question and I did not even need to send the broken one back, which would have been a bit expensive overseas. So, that was great.

This also gives me the possibility to open up the inverter and see what might be broken, but I haven't had time for that yet.

Oddly Behaving Inverter


Now, trying the new inverter, it mostly seems to work. I have tried it with my different laptops and curiously, it seems to give power even better than through the 20 V laptop connector, which should have less power loss.

Well, the only way how I can measure that it is to see whether the power bank's indicator flashes to indicate that it's charging from the solars, while a load (a computer) is plugged into it. I'm not quite sure how reliable measure it is.

The trouble now is that the new inverter seems to heat up quite a bit. I can't measure the exact temperature, but it's quite hot to touch and especially the attachment screw is so hot that I can't keep my finger on it for even just a second. The inverter has a cooling fan, but it's not working even when it's that hot. Well, perhaps it doesn't need to, as the electronics could take it, I don't know. Nevertheless, I'm worried about that.

What I'm even more worried about is that the power output seems to vary greatly. When I attach a power meter to the inverter's output, and attach my laptop to it by it's 230 V power plug, the power output fluctuates wildly between 0-60 watts. Using the inverter when it's cool may make it a bit more steady at around 19-21 watts most of the time, but nevertheless occasionally dropping to zero.

Reading the voltage output, it is not 220 V, but varies between 170-200 volts!


Attaching the power meter to wall outlet says 232 V and it gives a steady 25-27 watt output to the laptop. So, the problem does not appear to be with the meter.

So, it partially works for now, but I'm rather worried that it could again break anytime. It is entirely possible that the problem is with the power bank, even though it otherwise works fine. For example, it could cause the trouble if it does not give enough power to the inverter.

I'll need to study the problems further. Seem like Goal Zero has had some quality problems at least in the past. An owner of the previous version of the Sherpa 50 power bank reported horrible quality of the electronics, with a lot of bad solding and such. I don't know if that is the problem with the inverters as well, but it seems bad.

Friday, November 29, 2013

First Experiences with the Jolla Phone

So, I found myself standing in the "World's Merriest Queue" yesterday. It was dark, cold (4°C), and damp after a rain. There were 450 other people shivering in the long, dark, cold queue. With the Finnish melancholic mentality, that's actually merry, so there's no problem with that.


After waiting for an hour me and my penguin friend got in. The non-alcoholic drinks were excellent and some snacks good. There was Marc Dillon and others. Oh I just hate those professional presenters. The Jolla workers showed the phones around and gave some tips for using it.


How merry it can get in a queue of 450 nerds? Some said that the music was bad, I don't really care, me and the penguin got our phone, that's all that mattered.

Build and Hardware

The phone has a nowadays standard Gorilla glass display and otherwise a plastic shell. I was quite OK with the plastic build of my first smartphone, Galaxy S2, so this is not much different, except that the Jolla phone is bigger and the corners are more square, a bit like in many of the recent Nokia phones. The Jolla design is a thin "sandwich", with the replaceable "Other Half" making the other half of the body. Well, the "Other Half" is just a back-cover with a NFC chip that contains some data, such as themes or something. A black "Other Half" would be nice to have.


The MicroUSB connector is a bit oddly in the top side of the phone. It's a bit odd considering car use, but I think it was common in many of the latest Nokia phones, and it's maybe better for hand use.

The volume button in my phone is a bit loose. That's essentially something that would normally qualify for replacement.

Inside, are the slots for the micro-SIM and an SD card.


The requirement for micro-SIM caused me some trouble, as my SIM cards are regular SIM. I got a micro-SIM cutting template from the shop that sold me the phone at the event, and used my Victorinox to cut and file my SIM card to the correct size. After almost an hour of working, I finally got it working. I hope that it doesn't cause problems, as my backup phones use regular SIM, and I really need to use them sometimes.


The specs say that it's supposed to have a compass, but at least the one Android compass app that I found didn't work, and the Jolla maps app doesn't use compass for anything either. So, the compass, or the accelerometer or the gyro, are not much use right now.

The User Interface

One of the most important features in the Sailfish Operating System is it's user interface, which has no buttons, only swipe gestures. There is only the power button and a volume button on the side. The Home button in Android and iOS devices is replaced with a swipe-from-the-side gesture.

Compared to Android or iOS, the visual simplicity of many user interface views is extreme, no buttons or decorations almost anywhere. When you open the phone app, you just see a very plain call log. In the email app, you just get a list of emails, and when you open an email, there's just a title followed by text. On the downside, the views are often maybe over-simplified, so that things are hidden too well, and workflows to get to what you want are often a bit complex and unintuitive. I'm too often left guessing whether to swipe left or right, open the pull-down menu, tap, or long-tap something.

I'm having hard time deciding whether the simplicity is really beautifully elegant or just confusing. Maybe it's both.

Following the extreme simplicity, there is no status row, so finding out anything about the status requires going to the start screen, and there's not much info there either. Some status is shown between the start and task screens. There's also a message screen, which you can access by swiping from the bottom of the screen, but it only has a plain list of events, which is a bit poor. There's occasionally some status messages, such as for lost connection, but it's not indicated anywhere on the screen after flashing briefly.

The screen layout is vertical with three screens on top of each other:
  1. The start screen on the top
  2. The task screen with the running apps
  3. The app list

Start Screen

The start screen shows just the current time  and network connection status. Additionally, it shows icons for various notifications, such as new mail, or finished download.

You can't actually click the notification icons to get information about the notifications, you need to go to the notification screen. You get there theoretically by swiping from the bottom of the screen. However, this works me only every second time totally randomly, on other times the swipe simply scrolls to the tasks view below the start screen. So, it doesn't always properly detect that the swipe is done from the edge. Update: this apparently applies to all swipes-from-the-side. If you swipe too quick, it sometimes doesn't notice that it's from the side. So it's a bug, I just hope it's not a hardware-limited bug.

System Settings

The system settings can be accessed by pulling the start screen down (but not swiping from the top which turns off the screen!).

Compare this with with Android, where you can access the basic settings like screen brightness anywhere in any app, by pulling from the top of the screen. So to change screen brigness on Sailfish, you need to swipe-left to get from an app to the task screen, then swipe one down to get to the start screen, then pull-down the menu, select "Settings" to get to the screen with the settings app, and then get back to the app after changing the setting. Well, if the settings app is running, it can be accessed from the task screen. Anyhow, quite complex for making routine changes to basic settings. Same applies to many basic tasks like switching Internet connection on/off, etc.


Accessing the settings by pulling the menu down by swiping down anywhere on the screen is the Sailfish way of doing it. The availability of settings is indicated by a bright horizontal bar at the top of the screen. It often gets confusing, when you're already making some settings, and then there's even more settings available from the pull-down menu.

Tasks

The task screen is one of the special features in Sailfish, a descendant of the multitasking screen in Nokia N9. It shows either minimized versions of the actual screens of the running apps or specially optimized mini-screens if the apps support it.


Some native apps have special mini-controls that you can use by swiping left or right on the mini-screen. If you push long, you get to close tasks. You can also close an app when maximized by swiping down from the top.

The mini-screens are sometimes a bit unclear, so that it's not easy to see which is which. And when there's a lot of them, they get even mini-er.

So, the UI seems a bit strange now, but I remember that Android was also quite confusing in the beginning. I'm not sure if this is better or worse, but it feels promising.

Some issues:
  • No apparent way to take screen shots (hence none in this review)
  • There's no way to order apps in the apps screen. I wonder how it gets with 200 apps. Update: found it, just long-tap an app icon again to move it. Not very obvious, as after the first long top, the app icons have a delete mark, and I thought they could only be deleted there.
  • I haven't yet figured out how to move the cursor to the beginning of an input box, especially if the box is near the left side of the screen. 
  • In the virtual keyboard, pressing a letter on the first row long doesn't allow inputting numbers, you always have to switch to the numbers layout.
The list would be rather long if I listed all the small things I've noticed, so I'll just let it be for now.

Phone

Yes, it's also a phone. I haven't used it as a phone much yet, so I'll just cover this quickly.

I had to spend a few seconds trying to think which phone icon indicates answering a call and which rejects it. Both icons have phone icons, maybe the other one is green and the other one red, but the colors are so faint that me as a slightly red-green color blind can't see any difference. How about having a big X over the reject icon or something?

I find that answering requires a bit too delicate interaction, selecting the "Answer Call" option from the upper pull-down menu (or "Reject" from the pull-up menu). Also Android requires a bit too delicate swipe, as you have to actually hit the buttons and then swipe, while here you can swipe anywhere, but then swipe delicately to select "Answer Call". Hard to say which is worse.

The contact for the last call can't be created very easily. Just clicking on the phone number in the log makes a call...uh-cancel-cancel-cancel! Long-pushing the item allows selecting "Create Card" (or something like that), which creates a card, but not further contact info like who the person is. It's not saved in the contacts, which is a separate app. You apparently need to "link" it with an existing contact, which is rather unintuitive when you want to create the contact. While trying to create a contact, I accidentally managed to link the phone number with an existing contact, and was unable to unlink it. So, the workflow for creating a contact from the phone log was rather unintuitive to me on the first try.

Opening the phone from the phone icon just shows the log. To call to a contact, you need to pull-down the menu and select "Call a Person". While this is again more minimalistic, the Android way of showing the log, address book, and dial view as tabs doesn't leave you guessing how to make the call.

Sending and receiving SMS messages worked just OK, much like in Android, so I have nothing bad to say about it yet. But, it's minimalistic as everything in the phone.

Networking

The phone currently supports 2g and 3g, apparently the 4g/LTE support is still in the works and should arrive with OS update.

For my coworker who put a micro-SIM in right when starting the phone first time, the 3g mobile internet was installed in the startup. I didn't find any automation, but had to copy the connection settings from my old phone manually.

The WiFi settings are a bit confusing and unintuitive, but I have managed to get myself connected several times, so it works. To connect to a new network, you need to navigate rather deep in the settings, selecting an item, using the pull-down menu, then long-pressing an item to modify it. Not all is quite intuitive there. The settings UI quite often looks rather messed up, with texts here and there with no apparent layout.

I get "connection lost" for both WiFi and 3g internet occasionally, apparently for no reason.

There's apparently no way to share 3g internet connection by having the phone act as an access point, at least I haven't found such feature anywhere. This is a mission-critical feature to me, as none of my three laptops has an internal 3g card, and even if one had, I'd anyhow need it. It's been a pretty standard feature in smartphones for the last few years, so it's hard to understand that it's missing. For this missing feature alone, the phone is useless to me as a smartphone.

Web Browser

The built-in web browser works mostly OK with most pages. I first had some trouble connecting to Twitter, as it didn't handle the SSL certificate properly for some reason, and I simply couldn't connect to it. After doing something, it has worked just fine.

After a day, I still haven't quite figured out how the over-simplified browser UI works. There apparently is no location bar, but you get to open a new page by URL only by opening a sub-screen. It's of course a good thing that the location bar is not visible all the time, but on the other hand, the control bar is often maybe too visible, and the logic when it's visible or hidden is not quite obvious to me.

The navigation sub-screen is a bit messed up, containing a location bar, list of browser tabs, and the bookmarks. The bookmarking functionality is very basic, and it's not even possible to have bookmark folders, making life really confusing later when you have dozens or hundreds of bookmarks.

However, Firefox can be installed from the Android store and works much better. It's just not a native app, so it has some issues and it lacks some integration. It appears reasonably fast, although maybe not as fast as the built-in browser, which is also gekko-based. The built-in browser rendered some pages better, some pages worse.

One problem could be that some websites may have trouble recognizing the browser type. For example, Vaadin applications do not work properly because of the odd User-Agent info. That's probably fixed soon in Vaadin though...

The workflow for downloading and playing an MP3 file was really confusing. Clicking an MP3 starts download, but no progress is shown in any obvious place. The progress can be seen if you go to the start screen, select Settings, select System Settings, scroll down and select Downloads. In the downloads screen, you can't actually launch viewers for any downloaded files, just see the list. You can't delete any downloads in any way, you can only clear the list. This is an obvious bug. When a download finishes, a message flashes on the screen and clicking it takes you to the download list (where you can't play it). To play the file, you need to yourself open the Media Player, and the MP3 is there waiting for you. Oh, you can't delete it there either.

Apps and App Shops

The phone had almost no applications at all factory-installed, only the phone app, web browser, camera, the application shop, and the tutorial application. Everything else, such as a clock, calculator, and a calendar, you need to install from the Jolla Shop. There's not much there yet, mostly just some Jolla apps, like the clock, calculator, media player, notes, map app, email client, documents, etc. I suppose there's some logic to not have the basic apps preinstalled, so that you really go through them and know what's in your phone with no extra clutter.

The map app uses Nokia's maps. It's very minimal. The maps are OK, but there's no satellite maps, no extra info about the locations, the navigation is fairly limited, the interaction gestures are a bit unintuitive, etc. But, there's maps.

I have no idea what the Documents app does. I think it's supposed store text documents, but on the start screen it suggests swiping down, but nothing happens. There's no pull-down menu visible. So, apparently, it doesn't do anything.

Well, I could do a detailed review of all the apps, but it would take another article, or two.

Problems:
  • There's no progress indicator whatsoever in the web shop, so you have no idea how long downloading an app might take or if the download has frozen because of some networking trouble.
  • You can't also cancel downloads.
  • There's application "Categories" screen, but it's really just quite a horrible list of categories.
Well, there's only 25 or so apps in all, of which 5 or so are the basic Jolla apps such as the clock, etc, so the awfulness of the web shop isn't that relevant yet.

Android Apps from Yandex

Installing Android applications requires first installing the Yandex shop and then registering it. For some reason, I was unable to install the shop app with a WiFi connection at all, so it only worked after installing the micro-SIM and 3g networking. However, registering in the shop didn't work, as when I got to the "captcha" screen, it complained about network connection, even though I'm sure the network was up, as I was able to browse with the browser. Luckily, I got a tip to register in the Yandex email service with a computer. After doing that, I was able to log in into the Yandex shop.

So far I have tried to use only one app from the Android shop, Skype. It starts, but when I try to join a chat, it always crashes. So, no Skype. Update: Skype works just perfectly now. I have no idea why it didn't work earlier. Most other apps also seem to work, such as Angry Birds, etc.

Oh, also the Yandex app shop sometimes crashes right when I start it. When this happens, I need to reboot the phone to get it working again. Update: For some reason, I have not experienced the problem any longer.

The Yandex shop has very few apps that I would need. No Navionics, no astronomy apps that I like to use, and especially no Google apps. Google has even some quite critical apps that I need, like the Authenticator, which I need for work. So, the Android compatibility is a bit limited value to me, because of the limited app shop.

Conclusions

I can't really make conclusions for anyone else. For myself, the lack of WiFi access point makes the Jolla phone currently unusable to me as my primary phone. There's also a couple of apps that I just need, such as a call recorder, no explanations accepted, I simply can't use it as a phone without them. So, I hope to get the critical features soon.

If my review sounds negative, please note that I've mostly just listed all the things that bug me, that's how it goes. Mostly, Sailfish appears to have most of the essential features that you need in a phone. The simplicity of many user interfaces is both highly elegant and often frustrating. It's an OK phone with a browser (especially after you install Firefox), but not as a full-featured smartphone, rather a minimally-featured. But I'm not really expecting much more than that yet.

This is still about the Day 2, with developers just starting to take a look at the phone, and I'm sure Jolla will be doing its best to make it perfect.

I might be one of those developers, if I just had time, but I doubt I will have. Sailfish is based on Linux on the low-level and Qt for the UI development, which together make up probably the best development platform out there currently. The main problem with Android is that its applications run in a virtual machine, while Jolla apps run as native code, and therefore are much more efficient, as iOS apps are. That is why Sailfish and Jolla matter, I hope so at least. The big challenge they have is building up the ecosystem. Elop didn't even dare to try it with Nokia, we'll see how the tiny Jolla will do.

But, for now, I have a very expensive alarm clock. I know Jolla is working on updates, I hope they get them done soon.

Sunday, March 31, 2013

First Impressions About AR.Drone 2.0

I got an AR.Drone 2.0 some weeks ago and have been getting in touch with it, mostly studying its basic flight behaviour. My first impressions are mainly positive - AR.Drone is a well-finished product that works out of the box and is versatile and amazingly robust.

Control and Video Recording

The drone acts as a WiFi access point to provide a control link. The controller can be any Android or iOS device, such as a phone or a tablet, which requires a special flight control app. I normally use Galaxy Tab 10.1, which runs Android.

The flight control is very similar to some first-person shooter games for touch devices, with control pads for both thumbs. By pressing with the left thumb, you enable tilt, so that it tilts and moves to that direction as you tilt the controller. There are two control modes - relative and absolute. In the relative mode, tilting forward tilts the drone forward in its forward direction, while in absolute mode the drone uses compass to tilt in the same absolute direction as the device. The right thumb controls altitude and direction. The interface requires some getting used to and I can't say it's great, but it works.

There's a launch/landing button, as well as an emergency shutdown that stops the drone immediately. There's also a button to switch between the main camera and the ground camera. Behind a configuration menu, there are various settings, such as for altitude and tilt limits, and the control mode. The drone can also do flips, which are fun for about one time.

To record video you just tap a button in the control interface. It normally stores the video on the control device, but the drone also has a built-in USB connector to store the video on a USB memory. Using the USB store is usually better, because when using the WiFi connection, it can often lose the connection momentarily (or longer), as can be seen in the following video when the drone almost flies away.


The video is 720p and reasonably good quality, at least on good weather. It's a bit shaky and not quite production quality, but hey, for the price it's quite enough. On snow it's probably more jerky than on a surface with more texture, as the visual stabilizer makes rather erratic corrections.

The biggest issue is that the main camera is leveled horizontally and can not be tilted. So, to get angled shots, you have to fly the drone to tilt it. It is possible to tilt the camera head with a knife and some glue, and get great results with just some 5° tilt.

The video quality can be greatly enhanced by attaching a better camera to the drone. I have a GoPro HD HERO2, so I'll have to try that soon. The GoPro weighs some 100 grams, and the drone can carry it without much effort. However, the rugged camera cover weighs another 100 grams, so it is too heavy to be used. The legs need to be extended to keep the lens away from the ground. And fly carefully.

Indoor and Outdoor Hulls and Build Quality


The drone came with both an indoor and an outdoor protective hull. The purpose of the indoor hull is to protect the rotor blades if and when the drone bumps into a wall, as well as the walls themselves. The blades are incredibly flexible and, amazingly, they have lasted dozens of contacts with various objects. The drone has a safety feature that it makes an instant emergency stop if the blades hit something, which seems to prevent most damage.

It is worth to note that the indoor hull does not help almost at all when colliding against branches, so when the drone hits a branch, it almost always crashes. As the fall distance outdoors is often rather high, typically over two meters, it is usually enough to break the rims of the indoor hull. So, the purpose of the outdoor hull is mainly to preserve the indoor hull from breaking into a hundred pieces.

The motors and the small electronic boards of their speed controllers are completely exposed. Fortunately, even though the drone has crashed in wet snow many times, the electronics haven't short-circuited.

Apparently, the parts do break sometimes, as all the parts are available as spare parts. They are a bit expensive though, and building a drone from the separate parts is more than twice as expensive.

Flight Stability

The drone has a number of sensors to maintain its position, level, and direction:
  • 3-axis accelerometer
  • ultrasonic range finder at the bottom for altitude stability (up to 6 meters)
  • barometric pressure sensor for altitude stability (at 6+ meters)
  • secondary ground camera for visual stabilization
  • 3-axis gyroscope 
  • 3-axis magnetometer (compass)
The magnetometer is especially nice, as coupled with the magnetometer of the controlled device, it allows absolute direction control, so that tilting the controller causes the drone to fly to the same direction.

Unfortunately, even all the sensors are not always sufficient to maintain the position properly. The ground camera is only useful if there's enough light for it (see the problems later) and the ground has enough texture to stabilize on. The ultrasonic sensor doesn't seem to do its work quite properly, and the drone's altitude sometimes changes uncontrollably, for example by climbing to the roof.

I would expect that the next version gets a GPS module for better long-range stability. With that, it could have homing feature, as well as planned flight routes. Most of the more expensive drones already have that.

Flying Away


There's one thing that I learned quite well. The WiFi range is rather limited, just about 40 or so meters, and once it gets out of the range, it won't land immediately. So, it will fly away with the wind (1, 2, etc).

So, when trying it out at night, I lifted it up to some 40 meters...at which point it lost the connection and I couldn't control it any longer. As it didn't have any visual stabilization in the dark, it started slowly drifting away over the treetops into the night, and I soon lost sight of it.

So, a rescue effort was launched, combing the forest in a 10-meter grid. The forest was covered in 30 cm deep snow, so I had a good opportunity to practice skiing with my Altai Hoks.

After many hours of searching on two days, it was finally found in the snow some 200 meters into the forest. The indoor frame was stuck in a tree, and came down later after some windier days. Had the drone been stuck up in a 30 meters high pine tree, it would have been almost impossible to find.

To make the search easier if it ever flies away again, I taped the drone with plenty of reflecting tape so that it shines brightly from over 100 meters away when illuminated with a headlamp.

The main issue, however, is the limited range of the WiFi link. It's specified to be some 50 meters, some claim 80 meters, but it depends on the controller. With my Galaxy Tab 10.1 it seems to be around 40 meters. Some people have used directional antenna to extend the range, some even up to 2.25 km!

Logging In


The fun part about AR.Drone is that its on-board controller is a Linux computer and you can log into over the wireless network with Telnet.

First, I found out the network, then guessed that the device is .1 in the subnet:

magi@vaire:~$ ifconfig
wlan0     Link encap:Ethernet  HWaddr c0:18:85:70:65:48 
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
...

magi@vaire:~$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.

BusyBox v1.14.0 () built-in shell (ash)
Enter 'help' for a list of built-in commands.

# ls
bin       dev       factory   home      licenses  proc      sbin      tmp       usr
data      etc       firmware  lib       mnt       root      sys       update    var

There are a number of TCP ports open. The port 23 is for Telnet and 21 is for FTP. I assume that it uses FTP for updating the firmware. Then there's a number of ports in range 5551-5559, I suppose those are the control links. The video could be transmitted over UDP to allow losing frames on bad connection instead of piling them up.

# netstat -l -t
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 0.0.0.0:5551            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5553            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5555            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5557            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:5559            0.0.0.0:*               LISTEN      

There were at least couple of interesting-looking processes:

# ps
...
  806 root     77672 S    /bin/program.elf -360p.slices 0 -live.tcp 
  896 root      1540 S    /bin/parrotauthdaemon 
...

There also seems to be at least one AR-related kernel module:

# cat /proc/modules
ov7670 9943 1 - Live 0xbf083000
soc1040 20292 2 - Live 0xbf079000
omap3_isp 95899 9 - Live 0xbf056000
ar6000 278079 0 - Live 0xbf000000

And various memory devices:

# mount
rootfs on / type rootfs (rw)
ubi1:system on / type ubifs (rw,relatime)
tmp on /tmp type tmpfs (rw,relatime)
proc on /proc type proc (rw,relatime)
dev on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
sys on /sys type sysfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
ubi0:factory on /factory type ubifs (ro,relatime)
ubi2:update on /update type ubifs (rw,sync,relatime)
ubi2:data on /data type ubifs (rw,relatime)
The UBIFS is some sort of Flash memory filesystem.

Well, nothing very interesting. The control applications seem to be closed binaries, both in the kernel and user-space, and it's a big question if it is possible to hook custom on-board applications to do something interesting.

The main development APIs are for using over the remote link. I haven't yet looked at those, but will at some point.

Wednesday, March 27, 2013

Navigating URI Fragments in AJAX Apps

I just updated the URI Fragment section in the Book of Vaadin yesterday. The section was one of the most horribly outdated sections in the book. I didn't even include it in the print edition, although it was in the web edition.

To rewrite the section, I had to rewrite the book examples for it. The section now includes a subsection about supporting web crawling in Vaadin applications. It is a tricky topic, as stateful AJAX applications can not be normally crawled simply by loading the page. Google supports a special notation for the purpose, about which you can read in the section.

Anyhow, I'm writing this article mainly to test if Google manages to index the demo pages:
If all goes well, those pages should be indexed in a few days and you should able to google them. It could take less, as Blogger/Blogspot is a Google service.

Update: Now googleable

At least some of the pages can now be found by Google. Google for:
Well, for another example in use, you can google the add-on components in the Vaadin Directory. For example, try googling for:
You should be able to find the #-marked directory page in the results.