EzDevInfo.com

ubuntu-sdk interview questions

Top ubuntu-sdk frequently asked interview questions

How to deploy an Ubuntu touch application for other GNU/Linux distributions?

My situation:

  • I have created an Ubuntu touch application using Ubuntu SDK, in QML & C++.
  • The application uses Ubuntu UI Toolkit (Ubuntu.Components 0.1)
  • I want the application to run in other GNU/Linux distributions as well.

How to deploy this application along with Ubuntu Components, so that it runs on other GNU/Linux distributions as well?


Source: (StackOverflow)

What are Click packages?

I noticed that Ubuntu SDK recently had some updates and it installed a program named "Click". I would like to know what they are and how to use them.

Also, would they make Debian packaging easier?


Source: (StackOverflow)

Advertisements

How to lock ubuntu device orientation in portrait or landscape from user input?

I am working on a reader app to be used on Ubuntu-Touch. When reading books from the app it would be a helpful feature to lock the orientation in either portrait or landscape. This would be useful when reading in bed sideways.

I've tried to use automaticOrientation = false or true, however, the SDK currently locks the orientation in portrait when set to false.

Is there a way to lock the orientation of the device screen in one or the other and have it stay locked?

Update:

Newer releases of Ubuntu for Phone have a global option to lock orientation, however, I would still like to do this at the app level.

I am still looking for a way to do this.


Source: (StackOverflow)

What does the takeover of Nokia mean for the Ubuntu SDK?

Well, the title says it all:

What does the takeover of Nokia by Microsoft mean for the Ubuntu SDK, as the Ubuntu SDK relies on Qt which is (was?) a Nokia project?


Source: (StackOverflow)

Can a single Ubuntu SDK target touch and desktop with separate layouts?

I know that touch apps will run on the desktop with the same UI, but I was wondering if it will be possible for a single Ubuntu SDK app to have a multi-window UI with desktop style UI elements when running in desktop mode, while also providing a separate touch UI when running on touch platforms.


Source: (StackOverflow)

How do I dynamically add tab to tabs?

I am trying to add a new tab to the tabs component with the code below.

When running there is no error reported but no additional tabs are show. I have tried using both tabs and tabs.__tabsModel as the parent but no additional tabs are show.

import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import Ubuntu.Components 0.1

MainView {
    // objectName for functional testing purposes (autopilot-qt5)
    id: mainView
    objectName: "mainView"
    applicationName: "news-feed"

    width: units.gu(100)
    height: units.gu(75)

    Tabs {
        id: tabs
        anchors.fill: parent

        Component.onCompleted: {
            mainView.initializeDB();
            mainView.saveFeed("BBC News","http://feeds.bbci.co.uk/news/rss.xml");
            mainView.saveFeed("Jono Bacon","http://www.jonobacon.org/?feed=rss2");
            mainView.saveFeed("The Register", "http://www.theregister.co.uk/headlines.atom");
            fillTabs();
        }

        tools: ToolbarActions {
            Action {
                objectName: "action"

                iconSource: Qt.resolvedUrl("avatar.png")
                text: i18n.tr("Tap me!")

                onTriggered: {
                    label.text = i18n.tr("Toolbar tapped")
                }
            }
        }

        // First tab begins here
        Tab {
            id: tabFrontPage
            objectName: "tabFrontPage"

            title: i18n.tr("Front Page")

            // Tab content begins here
            page: Page {
                Column {
                    anchors.centerIn: parent
                    Label {
                        id: labelFrontPage
                        text: i18n.tr("This will be the front page \n An aggregation of the top stories from each feed")
                    }
                }
            }
        }
    }

    function fillTabs() {
        var db = getDatabase();
        db.transaction(function(tx) {
            var rs = tx.executeSql('SELECT * FROM feeds;');
            if (rs.rows.length > 0) {
                for(var i = 0; i < rs.rows.length; i++) {
                    var feedTab = Qt.createQmlObject('import QtQuick 2.0;import Ubuntu.Components 0.1;Tab {anchors.fill: parent;objectName: "Tab";title: i18n.tr("Tab");page: Page {anchors.margins: units.gu(2);Column {anchors.centerIn: parent;Label {id: label;objectName: "label";text: i18n.tr("Tab");}}}}',tabs,"feedTab");
                }
            } else {
                res = "Unknown";
            }
        })
    }
    //Storage API
    function getDatabase() {
        return LocalStorage.openDatabaseSync("news-feed","1.0","StorageDatabase",10000)
    }

    //Initialise DB tables if not already existing
    function initializeDB() {
        var db = getDatabase();
        db.transaction(function(tx) {
            //Create settings table if not existing
            tx.executeSql('CREATE TABLE IF NOT EXISTS settings(setting TEXT UNIQUE, value TEXT)');
            tx.executeSql('CREATE TABLE IF NOT EXISTS feeds(feedName TEXT UNIQUE, feedURL TEXT UNIQUE)')
        });
    }

    //Write setting to DB
    function setSetting(setting,value){
        //setting: string - setting name (key)
        //value: string - value
        var db = getDatabase();
        var res = "";
        db.transaction(function(tx) {
            var rs = tx.executeSql('INSERT OR REPLACE INTO settings VALUES (?,?);',[setting,value]);
            //console.log(rs.rowsAffected)
            if(rs.rowsAffected > 0) {
                res = "OK";
            } else {
                res = "Error";
            }
        })
        return res;
    }

    //Read setting from DB
    function getSetting(setting) {
        var db = getDatabase();
        var res="";
        db.transaction(function(tx) {
            var rs = tx.executeSql('SELECT value FROM settings WHERE setting=?;', [setting]);
            if (rs.rows.length > 0) {
                res = rs.rows.item(0).value;
            } else {
                res = "Unknown";
            }
        })
        return res;
    }

    function saveFeed(feedName, feedURL) {
        var db = getDatabase();
        var res = "";
        db.transaction(function(tx){
            var rs = tx.executeSql('INSERT OR REPLACE INTO feeds VALUES (?,?)',[feedName,feedURL]);
            //console.log(rs.rowsAffected)
            if (rs.rowsAffected > 0) {
                res = "OK";
            } else {
                res = "Error";
            }
        })
        return res;
    }

    //Return a single feed
    function getFeed(feedName) {
        var db = getDatabase();
        var res = "";
        db.transaction(function(tx) {
            var rs = tx.executeSql('SELECT feedURL FROM feeds WHERE feedName=?;', [feedName]);
            if (rs.rows.length > 0) {
                res = rs.rows.item(0).feedURL;
            } else {
                res = "Unknown";
            }

        })
        return res;
    }

    //Return all feeds and urls
    function getFeeds() {
        var db = getDatabase();
        var res = "";
        db.transaction(function(tx) {
            var rs = tx.executeSql('SELECT * FROM feeds;');
            if (rs.rows.length > 0) {
                return rs;
            } else {
                res = "Unknown";
            }
        })
        return res;
    }
}

Source: (StackOverflow)

How can I use emacs instead of Ubuntu SDK to write Ubuntu Touch Apps?

I want to use emacs and console tools instead of Ubuntu SDK to edit and debug my projects. Where can I learn about doing that?


Source: (StackOverflow)

Is it possible to use Python with the Ubuntu SDK?

David Planella wrote in his answer to a question I posted that:

...the recommended way to develop apps for Ubuntu is the Ubuntu SDK.

So I installed it, but looks like the supported programming language is C++. Does it mean I will need to know C++ to develop a new application for Ubuntu? Is C++ the recommended programming language for Ubuntu application now?

What about Python, I started learning it hoping to develop applications for Ubuntu.


Source: (StackOverflow)

How to change index in OptionSelector immediately (without animation)? [closed]

In my app, I use an OptionSelector to choose from a list of bike stations. I also have a map component with placemarkers for each station.

When I tap a placemarker, it also changes the OptionSelector to the index of the corresponding station, as this is good UX.

What isn't good UX is how the OptionSelector responds to this index change, which is animating itself as if it had been flicked by the user's finger. In other words, long after the user has tapped the map marker and received all the information they need, the OptionSelector is still "spinning" to the index of the station.

Here is a video demonstrating this behaviour: https://www.youtube.com/watch?v=jXKWlAmNYsw

I'd like for this OptionSelector to just change its index immediately, with no animation. Is there a way to do this?

Here's how I currently do things. I'm more than happy to be corrected if this is the wrong way of going about this. I use a WorkerScript (a QML thread, more-or-less) to make API calls. When this WorkerScript returns, it moves the OptionSelector like so:

WorkerScript {
    id: queryStationsWorker
    source: "../js/getstations.js"

    onMessage: {
        [...]

        // Move the OptionSelector to the corresponding station's index.
        stationSelector.selectedIndex = getLastStationIndex(lastStation.contents.stationName, stationsModel)

        /*
         * For the sake of clarity:
         *
         * getLastStationIndex() is a function which just returns an integer.
         * lastStation is a U1DB database used for state saving.
         * stationsModel is a model containing all of the stations.
         */
    }
}

Any help or insight appreciated - cheers!


Source: (StackOverflow)

Ubuntu SDK: How can I see error logs for my ubuntu touch app?

I've built an ubuntu touch app, it works well on desktop, but when I install it on the device and try to launch, it crashes. Where can I find error logs or any other output that the app can give me to figure out what's wrong?


Source: (StackOverflow)

How can I update the Ubuntu SDK preview from the Qt 5 Beta PPA to the Qt 5 Release PPA

When the Ubuntu SDK preview was announced on the 2nd of January, it was based on the Qt 5 Beta release (as Qt 5 had not yet been released and packaged for Ubuntu). At some point, the Qt 5 release was packaged on a separate PPA and the Ubuntu SDK migrated to be based on the contents of that PPA.

New installs work fine as described on the Ubuntu SDK installation instructions, but I'd like to know how those of us who installed it on release day on the 2nd can migrate to the latest version of the SDK, as the change of PPAs requires a manual upgrade.

This seems to be related to reports of folks who get the "error importing Ubuntu.Components" message when upgrading the SDK.


Source: (StackOverflow)

QtCreator error; can't load library; ProjectExplorer(2.6.82)

I try to install the new Ubuntu Phone SDK using the instructions here: http://developer.ubuntu.com/resources/app-developer-cookbook/mobile/currency-converter-phone-app/

Unfortunately when I run Qt-Creator it says a bunch of plugins failed to load:

Cannot load plugin because dependency failed to load: ProjectExplorer(2.6.82)
Reason: /usr/lib/x86_64-linux-gnu/qtcreator/plugins/QtProject/libProjectExplorer.so: Cannot load library /usr/lib/x86_64-linux-gnu/qtcreator/plugins/QtProject/libProjectExplorer.so: (libQt5Declarative.so.5: cannot open shared object file: No such file or directory)

Is there a missing step in the instructions, is something wrong with my setup, or is this not yet working in 12.10?


Source: (StackOverflow)

What exactly is an "Ubuntu App", as made with the Ubuntu SDK?

The Ubuntu SDK appears to be only for creating Ubuntu Apps. What exactly is an "Ubuntu App"? The website is very detailed, but I can't see any description of what is meant by an Ubuntu App.

I understand that these apps can run on either the desktop or an Ubuntu phone, but which desktop? Is it specifically Unity, or will these apps be usable on Xubuntu, Kubuntu, Ubuntu MATE, or even Linux Mint?

Or does this depend on whether or not I use any Unity specific hooks?

Edit: the referenced website has been updated since I asked this, so the question is not really relevant any more.


Source: (StackOverflow)

How can I run a command from a qml script? [duplicate]

This question already has an answer here:

I'm working on an Ubuntu Touch app that needs to modify iptables and do various other things that requires interaction with the command line. I found this and I understand that it must be done with a C++ plugin or a possible future extension in the SDK. Is there any such extension available now? And can someone elaborate on how I can use C++ to run a command from qml?


Source: (StackOverflow)

Can I develop a hybrid native/HTML5 app for the Ubuntu Phone?

Can I develop a hybrid app that was used in conjunction with the native API and HTML5 in Ubuntu phone?

I know that it is possible to develop either native app or HTML5 app.

However, I want to know to develop a native app that has a HTML5 UI (hybrid) in Ubuntu Phone.


Source: (StackOverflow)