Canonical Voices

Dustin Kirkland

As announced last week, Microsoft and Canonical have worked together to bring Ubuntu's userspace natively into Windows 10.

As of today, Windows 10 Insiders can now take Ubuntu on Windows for a test drive!  Here's how...

1) You need to have a system running today's 64-bit build of Windows 10 (Build 14316).


2) To do so, you may need to enroll into the Windows Insider program here, insider.windows.com.


3) You need to notify your Windows desktop that you're a Windows Insider, under "System Settings --> Advanced Windows Update options"


4) You need to set your update ambition to the far right, also known as "the fast ring".


5) You need to enable "developer mode", as this new feature is very pointedly directed specifically at developers.


6) You need to check for updates, apply all updates, and restart.


7) You need to turn on the new Windows feature, "Windows Subsystem for Linux (Beta)".  Note (again) that you need a 64-bit version of Windows!  Without that, you won't see the new option.


8) You need to reboot again.  (Windows sure has a fetish for rebooting!)


9) You press the start button and type "bash".


10) The first time you run "bash.exe", you'll accept the terms of service, download Ubuntu, and then you're off and running!



If you screw something up, and you want to start over, simply open a Windows command shell, and run: lxrun /uninstall /full and then just run bash again.

For bonus points, you might also like to enable the Ubuntu monospace font in your console.  Here's how!

a) Download the Ubuntu monospace font, from font.ubuntu.com.


b) Install the Ubuntu monospace font, by opening the zip file you downloaded, finding UbuntuMono-R.ttf, double clicking on it, and then clicking Install.


c) Enable the Ubuntu monospace font for the command console in the Windows registry.  Open regedit and find this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont and add a new string value name "000" with value data "Ubuntu Mono"




d) Edit your command console preferences to enable the Ubuntu monospace font.

Cheers!
Dustin

Read more
facundo

Ordenando fotos


Hace un par de semanas sucediose el PyCamp. En este tipo de eventos, como en tantos otros, o paseos, o reuniones, o lo que sea, pasa que uno lleva "la cámara", pero no la usa todo el tiempo.

Con "la cámara" me refiero al dispositivo para sacar fotos de mejor calidad que uno tiene. Puede ser una reflex toda pipona, o una point and shoot berretona, o algo intermedio (o "bridge") como la que tengo yo (una Canon G15).

Canon G15

Y uno no la usa todo el tiempo por dos razones. La primera es que en general, a menos que sea una point and shoot finiiiiita, molesta un poco llevarla: te ocupa al menos una mano, o rellena bastante un bolsillo, o hay que llevarla al cuello, o hay que llevar todo un bolso al hombro.

La segunda razón es que como las cámaras en los teléfonos avanzaron bastante, uno siempre termina sacando fotos al voleo más con el celular que con otra cosa, y deja para momentos "más cuidados" el usar "la cámara".

Y me pasa todo el tiempo. Ejemplo típico del del PyCamp: tengo la cámara en la mochila, donde la guardé luego de sacar un par de fotos donde estábamos trabajando, pero luego fui a otro lado a preguntarle algo a alguien, y tuve ganas de sacar una determinada foto, y en el momento lo resolví con el teléfono. No iba a volver a buscar la cámara grande. O la sacaba con el teléfono, o no la sacaba.

Entonces, esta combinación de factores hizo que, en los últimos tiempos, termine con una serie de fotos de la cámara grande, más una serie de fotos del teléfono. Separadas.

Yo miro/edito las fotos con distintas herramientas. Pero en general, las veo ordenadas por el nombre del archivo. Entonces, tener dos series de fotos separadas me jodía bastante.

Es por eso que me armé un pequeño script que agarra todas las fotos de un directorio y las renombra en función de la fecha/hora que tiene guardada la foto, quedando ambas series efectivamente mezcladas de forma cronológica al ordenarlas por el nombre del archivo.

Un par de detalles con respecto al script.

  • Todavía está en desarrollo, pero está bastante estable y las últimas veces que lo usé anduvo 100% ok
  • Asume que las fotos de "la cámara" tienen el formato IMG99999.JPG, siendo los 99999 cinco dígitos cualesquiera. Si este no es tu caso, vas a tener que pedirme una mejora, o toquetear vos misma/o el código.
  • Tenés que tener fades instalado, para que te maneje automágicamente las dependencias (acá tenés una explicación al respecto). Si no querés instalar fades, arreglate.

Enjoy.

Read more
Stéphane Graber

This is the sixth blog post in this series about LXD 2.0.

LXD logo

Remote protocols

LXD 2.0 supports two protocols:

  • LXD 1.0 API: That’s the REST API used between the clients and a LXD daemon as well as between LXD daemons when copying/moving images and containers.
  • Simplestreams: The Simplestreams protocol is a read-only, image-only protocol used by both the LXD client and daemon to get image information and import images from some public image servers (like the Ubuntu images).

Everything below will be using the first of those two.

Security

Authentication for the LXD API is done through client certificate authentication over TLS 1.2 using recent ciphers. When two LXD daemons must exchange information directly, a temporary token is generated by the source daemon and transferred through the client to the target daemon. This token may only be used to access a particular stream and is immediately revoked so cannot be re-used.

To avoid Man In The Middle attacks, the client tool also sends the certificate of the source server to the target. That means that for a particular download operation, the target server is provided with the source server URL, a one-time access token for the resource it needs and the certificate that the server is supposed to be using. This prevents MITM attacks and only give temporary access to the object of the transfer.

Network requirements

LXD 2.0 uses a model where the target of an operation (the receiving end) is connecting directly to the source to fetch the data.

This means that you must ensure that the target server can connect to the source directly, updating any needed firewall along the way.

We have a plan to allow this to be reversed and also to allow proxying through the client itself for those rare cases where draconian firewalls are preventing any communication between the two hosts.

Interacting with remote hosts

Rather than having our users have to always provide hostname or IP addresses and then validating certificate information whenever they want to interact with a remote host, LXD is using the concept of “remotes”.

By default, the only real LXD remote configured is “local:” which also happens to be the default remote (so you don’t have to type its name). The local remote uses the LXD REST API to talk to the local daemon over a unix socket.

Adding a remote

Say you have two machines with LXD installed, your local machine and a remote host that we’ll call “foo”.

First you need to make sure that “foo” is listening to the network and has a password set, so get a remote shell on it and run:

lxc config set core.https_address [::]:8443
lxc config set core.trust_password something-secure

Now on your local LXD, we just need to make it visible to the network so we can transfer containers and images from it:

lxc config set core.https_address [::]:8443

Now that the daemon configuration is done on both ends, you can add “foo” to your local client with:

lxc remote add foo 1.2.3.4

(replacing 1.2.3.4 by your IP address or FQDN)

You’ll see something like this:

stgraber@dakara:~$ lxc remote add foo 2607:f2c0:f00f:2770:216:3eff:fee1:bd67
Certificate fingerprint: fdb06d909b77a5311d7437cabb6c203374462b907f3923cefc91dd5fce8d7b60
ok (y/n)? y
Admin password for foo: 
Client certificate stored at server: foo

You can then list your remotes and you’ll see “foo” listed there:

stgraber@dakara:~$ lxc remote list
+-----------------+-------------------------------------------------------+---------------+--------+--------+
|      NAME       |                         URL                           |   PROTOCOL    | PUBLIC | STATIC |
+-----------------+-------------------------------------------------------+---------------+--------+--------+
| foo             | https://[2607:f2c0:f00f:2770:216:3eff:fee1:bd67]:8443 | lxd           | NO     | NO     |
+-----------------+-------------------------------------------------------+---------------+--------+--------+
| images          | https://images.linuxcontainers.org:8443               | lxd           | YES    | NO     |
+-----------------+-------------------------------------------------------+---------------+--------+--------+
| local (default) | unix://                                               | lxd           | NO     | YES    |
+-----------------+-------------------------------------------------------+---------------+--------+--------+
| ubuntu          | https://cloud-images.ubuntu.com/releases              | simplestreams | YES    | YES    |
+-----------------+-------------------------------------------------------+---------------+--------+--------+
| ubuntu-daily    | https://cloud-images.ubuntu.com/daily                 | simplestreams | YES    | YES    |
+-----------------+-------------------------------------------------------+---------------+--------+--------+

Interacting with it

Ok, so we have a remote server defined, what can we do with it now?

Well, just about everything you saw in the posts until now, the only difference being that you must tell LXD what host to run against.

For example:

lxc launch ubuntu:14.04 c1

Will run on the default remote (“lxc remote get-default”) which is your local host.

lxc launch ubuntu:14.04 foo:c1

Will instead run on foo.

Listing running containers on a remote host can be done with:

stgraber@dakara:~$ lxc list foo:
+------+---------+---------------------+-----------------------------------------------+------------+-----------+
| NAME |  STATE  |         IPV4        |                     IPV6                      |    TYPE    | SNAPSHOTS |
+------+---------+---------------------+-----------------------------------------------+------------+-----------+
| c1   | RUNNING | 10.245.81.95 (eth0) | 2607:f2c0:f00f:2770:216:3eff:fe43:7994 (eth0) | PERSISTENT | 0         |
+------+---------+---------------------+-----------------------------------------------+------------+-----------+

One thing to keep in mind is that you have to specify the remote host for both images and containers. So if you have a local image called “my-image” on “foo” and want to create a container called “c2” from it, you have to run:

lxc launch foo:my-image foo:c2

Finally, getting a shell into a remote container works just as you would expect:

lxc exec foo:c1 bash

Copying containers

Copying containers between hosts is as easy as it sounds:

lxc copy foo:c1 c2

And you’ll have a new local container called “c2” created from a copy of the remote “c1” container. This requires “c1” to be stopped first, but you could just copy a snapshot instead and do it while the source container is running:

lxc snapshot foo:c1 current
lxc copy foo:c1/current c3

Moving containers

Unless you’re doing live migration (which will be covered in a later post), you have to stop the source container prior to moving it, after which everything works as you’d expect.

lxc stop foo:c1
lxc move foo:c1 local:

This example is functionally identical to:

lxc stop foo:c1
lxc move foo:c1 c1

How this all works

Interactions with remote containers work as you would expect, rather than using the REST API over a local Unix socket, LXD just uses the exact same API over a remote HTTPS transport.

Where it gets a bit trickier is when interaction between two daemons must occur, as is the case for copy and move.

In those cases the following happens:

  1. The user runs “lxc move foo:c1 c1”.
  2. The client contacts the local: remote to check for an existing “c1” container.
  3. The client fetches container information from “foo”.
  4. The client requests a migration token from the source “foo” daemon.
  5. The client sends that migration token as well as the source URL and “foo”‘s certificate to the local LXD daemon alongside the container configuration and devices.
  6. The local LXD daemon then connects directly to “foo” using the provided token
    1. It connects to a first control websocket
    2. It negotiates the filesystem transfer protocol (zfs send/receive, btrfs send/receive or plain rsync)
    3. If available locally, it unpacks the image which was used to create the source container. This is to avoid needless data transfer.
    4. It then transfers the container and any of its snapshots as a delta.
  7. If succesful, the client then instructs “foo” to delete the source container.

Try all this online

Don’t have two machines to try remote interactions and moving/copying containers?

That’s okay, you can test it all online using our demo service.
The included step-by-step walkthrough even covers it!

Extra information

The main LXD website is at: https://linuxcontainers.org/lxd
Development happens on Github at: https://github.com/lxc/lxd
Mailing-list support happens on: https://lists.linuxcontainers.org
IRC support happens in: #lxcontainers on irc.freenode.net

Read more
Stéphane Graber

LXD logo

Introduction

And that’s it!
After a year and a half of intense work by the LXD team, LXD 2.0 has been released today!

LXD 2.0 is our first production-ready release and also a Long Term Support release, meaning that we will be supporting it with frequent bugfix releases until the 1st of June 2021.

This also completes our collection of 2.0 container tools with LXC 2.0, LXCFS 2.0 and now LXD 2.0 all having been released over the past couple of weeks.

Getting started with LXD

I have recently been writing a bit about LXD 2.0, those posts are a great starting point to understand LXD’s goal and start using it for your own containers.

LXD 2.0 is now available in Ubuntu 16.04, Ubuntu 14.04 (through backports) and in the Ubuntu Core Store.

We expect other Linux distributions to pick it up over the next few weeks!

More information on how to install it can be found here.

Try it online

If you just want to see what LXD is all about without having to start a virtual machine or install it on your own machine, you can try it online straight from our website.

Just head to: https://linuxcontainers.org/lxd/try-it

Project information

Upstream website: https://linuxcontainers.org/lxd/
Release announcement: https://linuxcontainers.org/lxd/news/
Code: https://github.com/lxc/lxd
IRC channel: #lxcontainers on irc.freenode.net
Mailing-lists: https://lists.linuxcontainers.org

Read more
Dustin Kirkland


This makes me so incredibly happy!

Here's how...

First, start with a fully up-to-date Ubuntu 16.04 LTS desktop.

sudo apt update
sudo apt dist-upgrade -y

Then, install dconf-editor.

sudo apt install -y dconf-editor

Launch dconf-editor and find the "launcher" key and change it to "bottom".

dconf-editor


For good measure, I triggered a reboot, to make sure my changes stuck.  And voila!  Beauty!

:-Dustin

Read more
Michael Hall

Somehow I missed the fact that I never wrote Community Donations report for Q3 2015. I only realized it because it’s time for me to start working on Q4. Sorry for the oversight, but that report is now published.

The next report should be out soon, in the mean time you can look at all of the past reports so see the great things we’ve been able to do with and for the Ubuntu community through this program. Everybody who has recieved these funds have used them to contribute to the project in one way or another, and we appreciate all of their work.

As you may notice, we’ve been regularly paying out more than we’ve been getting in donations. While we’ve had a carry-over balance ever since we started this program, that balance is running down. If you like the things we’ve been able to support with this program, please consider sending it a contribution and helping us spread the word about it.

 

Read more
Dustin Kirkland

Update: Here's how to get started using Ubuntu on Windows

See also Scott Hanselman's blog here
I'm in San Francisco this week, attending Microsoft's Build developer conference, as a sponsored guest of Microsoft.



That's perhaps a bit odd for me, as I hadn't used Windows in nearly 16 years.  But that changed a few months ago, as I embarked on a super secret (and totally mind boggling!) project between Microsoft and Canonical, as unveiled today in a demo during Kevin Gallo's opening keynote of the Build conference....



An Ubuntu user space and bash shell, running natively in a Windows 10 cmd.exe console!


Did you get that?!?  Don't worry, it took me a few laps around that track, before I fully comprehended it when I first heard such crazy talk a few months ago :-)

Here's let's break it down slowly...
  1. Windows 10 users
  2. Can open the Windows Start menu
  3. And type "bash" [enter]
  4. Which opens a cmd.exe console
  5. Running Ubuntu's /bin/bash
  6. With full access to all of Ubuntu user space
  7. Yes, that means apt, ssh, rsync, find, grep, awk, sed, sortxargs, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, php, gcc, tar, vim, emacs, diff, patch...
  8. And most of the tens of thousands binary packages available in the Ubuntu archives!
"Right, so just Ubuntu running in a virtual machine?"  Nope!  This isn't a virtual machine at all.  There's no Linux kernel booting in a VM under a hypervisor.  It's just the Ubuntu user space.

"Ah, okay, so this is Ubuntu in a container then?"  Nope!  This isn't a container either.  It's native Ubuntu binaries running directly in Windows.

"Hum, well it's like cygwin perhaps?"  Nope!  Cygwin includes open source utilities are recompiled from source to run natively in Windows.  Here, we're talking about bit-for-bit, checksum-for-checksum Ubuntu ELF binaries running directly in Windows.

[long pause]

"So maybe something like a Linux emulator?"  Now you're getting warmer!  A team of sharp developers at Microsoft has been hard at work adapting some Microsoft research technology to basically perform real time translation of Linux syscalls into Windows OS syscalls.  Linux geeks can think of it sort of the inverse of "wine" -- Ubuntu binaries running natively in Windows.  Microsoft calls it their "Windows Subsystem for Linux".  (No, it's not open source at this time.)

Oh, and it's totally shit hot!  The sysbench utility is showing nearly equivalent cpu, memory, and io performance.

So as part of the engineering work, I needed to wrap the stock Ubuntu root filesystem into a Windows application package (.appx) file for suitable upload to the Windows Store.  That required me to use Microsoft Visual Studio to clone a sample application, edit a few dozen XML files, create a bunch of icon .png's of various sizes, and so on.

Not being Windows developer, I struggled and fought with Visual Studio on this Windows desktop for a few hours, until I was about ready to smash my coffee mug through the damn screen!

Instead, I pressed the Windows key, typed "bash", hit enter.  Then I found the sample application directory in /mnt/c/Users/Kirkland/Downloads, and copied it using "cp -a".  I used find | xargs | rename to update a bunch of filenames.  And a quick grep | xargs | sed to comprehensively search and replace s/SampleApp/UbuntuOnWindows/. And Ubuntu's convert utility quickly resized a bunch of icons.   Then I let Visual Studio do its thing, compiling the package and uploading to the Windows Store.  Voila!

Did you catch that bit about /mnt/c...  That's pretty cool...  All of your Windows drives, like C: are mounted read/write directly under /mnt.  And, vice versa, you can see all of your Ubuntu filesystem from Windows Explorer in C:\Users\Kirkland\AppData\Local\Lxss\rootfs\


Meanwhile, I also needed to ssh over to some of my other Ubuntu systems to get some work done.  No need for Putty!  Just ssh directly from within the Ubuntu shell.



Of course apt install and upgrade as expected.



Is everything working exactly as expected?  No, not quite.  Not yet, at least.  The vast majority of the LTP passes and works well.  But there are some imperfections still, especially around tty's an the vt100.  My beloved byobu, screen, and tmux don't quite work yet, but they're getting close!

And while the current image is Ubuntu 14.04 LTS, we're expecting to see Ubuntu 16.04 LTS replacing Ubuntu 14.04 in the Windows Store very, very soon.

Finally, I imagine some of you -- long time Windows and Ubuntu users alike -- are still wondering, perhaps, "Why?!?"  Having dedicated most of the past two decades of my career to free and open source software, this is an almost surreal endorsement by Microsoft on the importance of open source to developers.  Indeed, what a fantastic opportunity to bridge the world of free and open source technology directly into any Windows 10 desktop on the planet.  And what a wonderful vector into learning and using more Ubuntu and Linux in public clouds like Azure.  From Microsoft's perspective, a variety of surveys and user studies have pointed to bash and Linux tools -- very specifically, Ubuntu -- be available in Windows, and without resource-heavy full virtualization.

So if you're a Windows Insider and have access to the early beta of this technology, we certainly hope you'll try it out!  Let us know what you think!

If you want to hear more, hopefully you'll tune into the Channel 9 Panel discussion at 16:30 PDT on March 30, 2016.

Cheers,
Dustin

Read more
liam zheng

Ubuntu手机OTA-10已发布,比起OTA-9,本次更新不仅仅在UI上有所改善,修复了已知bug,还迎来诸多新功能,新增了更多预装应用。

Ubuntu手机和常见的IOS和安卓系统使用方式有很大的区别,它采用手势滑动操作完全不需要使用手机按钮。对于首次使用Ubuntu手机的用户来说,会需要经过简单的学习来熟悉这个系统界面,OTA-10对首次开机使用教程进行了重新设计,上手Ubuntu手机更加容易。虽然和传统智能手机器的操作方式有很大区别,但实际操作更加合理,新用户上手也极快。

这是Ubuntu手机从去年上市以来, 第10次系统更新。这次OTA-10版本更新中有以下几项重大新特征。

 

新增3个预装应用

OTA-10新增加了3个预装应用,分别是邮件(Dekko)、日历、和导航应用(uNav),这些都是是日常工作、生活中会重度使用的应用,现在无需再单独进行安装。

 

新增VPN功能

智能手机的功能早已不是仅仅局限于拨打电话和发送短信了,上网功能的使用需求越来越频繁、重要。尤其是对网络有特殊要求的用户。以往可在Ubuntu桌面端上使用VPN,现在在OTA-10上也可以使用VPN服务了。使用方法和Ubuntu桌面端一致,在设置——网络,点击开启即可。

 

浏览器——针对桌面融合模式优化

谈到网络,OTA-10另一项改进就是对默认浏览器应用的优化。在手机或平板触控模式下,可使用长按操作呼出选择器功能,选择网页内容进行复制/粘贴。在桌面融合模式下,终端打开的某个网页链接,系统会自动开启浏览器应用并打开一个新的页面, 而不是另外再打开一个浏览器应用。不仅如此,当手机、平板连接到鼠标后,浏览器底部提示自动变成可点击的侧边栏。除了上面的功能,还针对内存占用进行了优化。

 

Web应用功能丰富

Ubuntu手机支持三类原生app、Scope、Webapp应用,作为现在普遍使用HTML5语言的Webapp,OTA-10增加相机(可通过开启webrtc视频参数实现)、麦克风、震动、加速器等接口系统功能调用,Webapp的功能、体验将变得更好。SoundCloud用户可在Web应用登陆自己的账户,查看歌手信息,查看、发表歌曲评论,获取精心制作的精选集,欣赏喜欢的音乐。

 

中文输入法

在OTA-10中,拼音输入法更新libpinyin7了,进一步改善中文输入体验。如果你喜欢日语,本次更新也加入了对日语键盘布局支持。

 

桌面融合模式

OTA-10修复了在融合模式下已知bug,并提供更多设置的选择。例如,新增显示器设置,可选的语言输入方式,桌面融合模式开关按钮等。

其他

手机系统更新除了可在WiFi模式下载,亦可使用手机3G/4G网络进行下载更新。还改善对外置麦克风及音量控制的识别、支持。

以上为Ubuntu手机OTA-10更新信息,如果你还没有更新的话,请打开手机,点击设置—软件更新进行更新。详细的更新日志见:链接 

 

 

Read more
Stéphane Graber

LXD logo

Introduction

Today I’m very pleased to announce the release of LXC 2.0, our second Long Term Support Release! LXC 2.0 is the result of a year of work by the LXC community with over 700 commits done by over 90 contributors!

It joins LXCFS 2.0 which was released last week and will very soon be joined by LXD 2.0 to complete our collection of 2.0 container management tools!

What’s new?

The complete changelog is linked below but the main highlights for me are:

  • More consistent user experience between the various LXC tools.
  • Improved checkpoint/restore support.
  • Complete rework of our CGroup handling code, including support for the CGroup namespace.
  • Cleaned up storage backend subsystem, including the addition of a new Ceph RBD backend.
  • A massive amount of bugfixes.
  • And lastly, we managed to get all that done without breaking our API, so LXC 2.0 is fully API compatible with LXC 1.0.

The focus with this release was stability and maintaining support for all the environments in which LXC shines. We still support all kernels from 2.6.32 though the exact feature set does obviously vary based on kernel features. We also improved support for a bunch of architectures and fixed a lot of bugs and other rough edges.

This is the release you want to run in production for the next few years!

Support length

As mentioned, LXC 2.0 is a Long Term Support release.
This is the second time we do such a release with the first being LXC 1.0.

Long Term Support releases come with a 5 years commitment from upstream to do bugfixes and security updates and release new point releases when enough fixes have accumulated.

The end of life date for the various LXC versions is as follow:

  • LXC 1.0, released February 2014 will EOL on the 1st of June 2019
  • LXC 1.1, released February 2015 will EOL on the 1st of September 2016
  • LXC 2.0, released April 2016 will EOL on the 1st of June 2021

We therefore very strongly recommend LXC 1.1 users to update to LXC 2.0 as we will not be supporting this release for very much longer.

We also recommend production deployments stick to our Long Term Support release.

Project information

Upstream website: https://linuxcontainers.org/lxc/
Release announcement: https://linuxcontainers.org/lxc/news/
Code: https://github.com/lxc/lxc
IRC channel: #lxcontainers on irc.freenode.net
Mailing-lists: https://lists.linuxcontainers.org

Try it online

Want to see what a container with LXC 2.0 installed feels like?
You can get one online to play with here.

Read more
Prakash

From a numbers standpoint, Google is actually a distant fourth in the $23 billion cloud infrastructure services market, according to Synergy Research Group. AWS ranks first with 31 percent, followed by Microsoft Azure at 9 percent, IBM at 7 percent and Google Cloud Platform at 4 percent, Synergy data show. That means of Google parent Alphabet’s $75 billion in revenue, less than $1 billion came from cloud infrastructure.

Read More: http://www.cnbc.com/2016/03/23/google-aims-to-catch-amazon-microsoft-in-cloud.html

Read more
Dustin Kirkland

Still have questions about Ubuntu on Windows?
Watch this Channel 9 session, recorded live at Build this week, hosted by Scott Hanselman, with questions answered by Windows kernel developers Russ Alexander, Ben Hillis, and myself representing Canonical and Ubuntu!

For fun, watch the crowd develop in the background over the 30 minute session!

And here's another recorded session with a demo by Rich Turner and Russ Alexander.  The real light bulb goes off at about 8:01.


Cheers,
:-Dustin

Read more
UbuntuTouch

利用CrossFadeImage能够在我们切换它的source时生产我们所需要的特效.除此之外,它本身就像我们通常所使用的一个QML Image元件.

我们还是可以通过一个先前的例程来展示如何利用这个API来做一些动画效果.首先大家可以查看我先前的文章"利用SwipeArea来识别手势操作".我们可以把它其中的Image换成我们所需要的CrossFadeImage.整个代码如下:


import QtQuick 2.4
import Ubuntu.Components 1.3

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "swipearea.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    property int index: 1

    Page {
        title: "SwipeArea sample"

        CrossFadeImage {
            id: img
            anchors.fill: parent
            source: "images/image1.jpg"
            fadeDuration: 2000
            fadeStyle: "cross"
        }

        SwipeArea {
            id: swipeleft
            anchors {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
                top: parent.top
            }

            // SwipeArea.Rightwards
            direction:  SwipeArea.Leftwards

            onDraggingChanged: {
                console.log("dragging: " + dragging)

                if ( dragging ) {
                    index ++;

                    if ( index >= 5) {
                        index = 5
                    }

                    var image = "images/image" + index + ".jpg"
                    console.log("image source: " + image)
                    img.source = image
                }
            }
        }

        SwipeArea {
            id: swiperight
            anchors {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
                top: parent.top
            }

            // SwipeArea.Rightwards
            direction: SwipeArea.Rightwards

            onDraggingChanged: {
                console.log("dragging1: " + dragging)

                if ( dragging ) {
                    index--

                    if ( index <= 1 ) {
                        index = 1
                    }

                    var image = "images/image" + index + ".jpg"
                    console.log("image source1: " + image)
                    img.source = image
                }
            }
        }
    }
}

运行我们的应用:


  


在我们尝试改变CrossFadeImage的source,我们可以发现我们所需要的动画的效果.当然,我们也可以修改其中的fadeStyle属性来得到我们所需要的另外一种效果.下图是fadeStyle为"overlay"时的效果.




整个项目的源码在: https://github.com/liu-xiao-guo/crossfadeimage



作者:UbuntuTouch 发表于2016/3/15 8:05:48 原文链接
阅读:199 评论:0 查看评论

Read more
UbuntuTouch

[原]利用SwipeArea来识别手势操作

在Ubuntu.Components 1.3中,有一个新增加的API叫做SwipeArea.我们可以通过这个API来识别我们的手势.这对一些需要手势进行操作的应用来说无疑是一个非常必要的接口.


我们还是先来看一个简单的代码吧:

Main.qml


import QtQuick 2.4
import Ubuntu.Components 1.3

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "swipearea.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    property int index: 1

    Page {
        title: "SwipeArea sample"

        Image {
            id: img
            anchors.fill: parent
            source: "images/image1.jpg"
        }

        SwipeArea {
            id: swipeleft
            anchors {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
                top: parent.top
            }

            // SwipeArea.Rightwards
            direction:  SwipeArea.Leftwards

            onDraggingChanged: {
                console.log("dragging: " + dragging)

                if ( dragging ) {
                    index ++;

                    if ( index >= 5) {
                        index = 5
                    }

                    var image = "images/image" + index + ".jpg"
                    console.log("image source: " + image)
                    img.source = image
                }
            }
        }

        SwipeArea {
            id: swiperight
            anchors {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
                top: parent.top
            }

            // SwipeArea.Rightwards
            direction: SwipeArea.Rightwards

            onDraggingChanged: {
                console.log("dragging1: " + dragging)

                if ( dragging ) {
                    index--

                    if ( index <= 1 ) {
                        index = 1
                    }

                    var image = "images/image" + index + ".jpg"
                    console.log("image source1: " + image)
                    img.source = image
                }
            }
        }
    }
}



在上面的应用中,我们通过一个识别向左划和向右划的两个手势识别来切换我们的照片.整个设计非常简单明了.

 

整个项目的源码在:https://github.com/liu-xiao-guo/swipeare


作者:UbuntuTouch 发表于2016/3/10 15:01:41 原文链接
阅读:190 评论:0 查看评论

Read more
UbuntuTouch

在其它的很多平台上我们可以使用ComboButton来实现我们一个下拉(drop-down)的选项.在Ubuntu.Components 1.3版本中,我们也有类似的东西,虽然在我之前的例程中,我们也实现了一个自己的ComboBox.


我们还是先来看一下一个简单的例子:


Main.qml


import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.ListItems 1.3

/*!
    \brief MainView with a Label and Button elements.
*/

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "combobutton.liu-xiao-guo"

    /*
     This property enables the application to change orientation
     when the device is rotated. The default is false.
    */
    //automaticOrientation: true


    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("combobutton")

        Column {
            anchors.fill: parent
            spacing: units.gu(2)

            ComboButton {
                text: "smaller content"
                Rectangle {
                    height: units.gu(5) // smaller than the default expandedHeight
                    color: "blue"
                }
            }

            ComboButton {
                id: combo
                text: "long scrolled content"

                ListView {
                    model: 10
                    delegate: Standard {
                        text: "Item #" + modelData

                        onClicked: {
                            console.log("item: " + index + " clicked")
                            combo.expanded = false;
                        }

                    }
                }
            }
        }
    }
}

运行我们的例程:

  
从上面可以看出来我们可以在一个drop-down的列表中选择我们所需要的选项.当然,我们也可以更新我们的ComboButton的text的内容.


作者:UbuntuTouch 发表于2016/3/14 15:29:21 原文链接
阅读:180 评论:0 查看评论

Read more
UbuntuTouch

当我们的视窗不能完全显示一个大的显示区域的时候,我们希望能够使用ScrollBar来方便地移动我们的视窗并展示不同部分的内容.对于触屏的设备来说,我们可以在我们的设计中加入Flickable来通过触碰的操作来完成我们视窗的移动.但是对于我们没有触碰的设备来说,我们智能通过ScrollBar或一些方向的热键来移动我们的视窗的位置.在今天的例程中,我们来使用Ubuntu SDK中提供的ScrollView来完成我们所需要的功能.


大家知道,目前Ubuntu目前正在朝convergence的方向前进.也就是说,将来我们的同一个应用不需要做任何的修改就可以部署到不同屏幕尺寸的设备上,无论这个设备是手机,平板及桌面电脑.在我们的设计中,我们需要紧紧记住这一点.对于以前使用ScrollBar的应用来说,建议一知道最新的ScrollView以保证最终的应用能够部署到所有的设备上.


我们还是先来看一看我们例程:


Main.qml

import QtQuick 2.4
import Ubuntu.Components 1.3

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "scrollview.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("scrollview")

        ScrollView {
            id: scrollview
            anchors.fill: parent

            Image {
                source: "images/bigpic.jpg"
                width: sourceSize.width
                height: sourceSize.height
            }

           Component.onCompleted: {
               var keys = Object.keys(scrollview);
               for( var i = 0; i < keys.length; i++ ) {
                   var key = keys[ i ];
                   var data = key + ' : ' + scrollview[ key ];
                   console.log(data )
               }
           }
        }
    }
}


从上面的代码中可以看出来,我们使用了一个ScrollView.在它的里面是一个比ScrollView视窗还要大很多的图片.图片的大小,我们通过Image中的sourceSize得到.为了能够看清整幅图,我们设计了一个ScrollView.运行我们的应用:

    

从上面的显示中可以看出来,当图片的宽度比我们的视窗的宽度还要大的时候,它显示了一个scrollbar供我们进行拖动.
从我们的调试的信息中可以看出来:

qml: contentItem : QQuickImage(0x121a828)
qml: flickableItem : QQuickFlickable(0x121a330)

ScrollView为我们创建了一个QQuickFlickable的元件,并为我们所使用.QQuickFlickable对应于我们QML中Flickable.


我们下面来创建另外一个项目:

Main.qml


import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.ListItems 1.3

/*!
    \brief MainView with a Label and Button elements.
*/

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "scrollview1.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("scrollview1")

        ScrollView {
            id: scrollview
            anchors.fill: parent

            ListView {
                model: 100
                delegate: Standard {
                    Label {
                        text: "Item + " + index
                    }
                }
            }

            Component.onCompleted: {
                var keys = Object.keys(scrollview);
                for( var i = 0; i < keys.length; i++ ) {
                    var key = keys[ i ];
                    var data = key + ' : ' + scrollview[ key ];
                    console.log(data )
                }
            }
        }
    }
}

在这里我们使用了一个ListView.运行我们的应用:

 


从上面可以看出来,当我们的ListView中的内容大于时间的窗口的时候,在视窗的外面显示了一个垂直的ScrollBar供我们来移动我们的视窗.
从我们的调试的信息中可以看出来:

qml: contentItem : QQuickListView(0xba2c30)
qml: flickableItem : QQuickListView(0xba2c30)

ScrollView没有为我们创建一个新的Flickable,它利用了现有的ListView(也是继承于一个Flickable)提供的Flickable.

作者:UbuntuTouch 发表于2016/3/15 11:27:34 原文链接
阅读:198 评论:0 查看评论

Read more
UbuntuTouch

相信大家对Ubuntu平台的融合演进非常感兴趣.我非常荣幸地参加了2016年在巴塞罗那的MWC会议.看见了我们公司最新的科技展示.


Ubuntu Unity 8 及 Convergence 演示

http://v.youku.com/v_show/id_XMTUwMDU2OTg2OA==.html



Ubuntu平台融合演进


http://v.youku.com/v_show/id_XMTUwMDU2NzA2MA==.html


作者:UbuntuTouch 发表于2016/3/15 12:08:47 原文链接
阅读:222 评论:0 查看评论

Read more
UbuntuTouch

[原]有那些UbuntuColors?

在我们设计我们的Ubuntu应用中,如果我们想把我们的应用设计成为最符合Ubuntu的颜色的话,我们需要使用UbuntuColors来作为我们设计的参考.在今天的练习中,我们来显示我们的Ubuntu系统中到底有那些颜色.


我设计了一个简单的应用来显示我们所有的Ubuntu颜色.

Main.qml

import QtQuick 2.4
import Ubuntu.Components 1.3

/*!
    \brief MainView with a Label and Button elements.
*/

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "ubuntucolors.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("ubuntucolors")

        ListModel {
            id: mymodel;
        }

        ListView {
            anchors.fill: parent
            model: mymodel
            delegate: ListItem {
                Rectangle {
                    anchors.fill: parent
                    color: value
                }
                Label {
                    anchors.centerIn: parent
                    text: name
                    fontSize: "large"
                    color: "white"
                }
            }
        }

        Component.onCompleted: {
            var keys = Object.keys(UbuntuColors);
            for(var i = 0; i < keys.length; i++) {
                var key = keys[i];
                // prints all properties, signals, functions from object
                var type = typeof UbuntuColors[key];
                if ( type !== 'function' &&
                     key.indexOf("Gradient") === -1 &&
                     key !== "objectName") {
                    //                    console.log("type: " + type)
                    console.log(key + ' : ' + UbuntuColors[key]);
                    var color = "" + UbuntuColors[key];
                    console.log("color: " + color)
                    mymodel.append({"name": key, "value": color});
                }
            }
        }
    }
}



运行我们的应用:



在上面的应用中,我们可以看到UbuntuColor中所定义的所有的颜色及其显示.
作者:UbuntuTouch 发表于2016/3/15 15:48:50 原文链接
阅读:209 评论:0 查看评论

Read more
UbuntuTouch

我们知道在利用Ubuntu Toolkit的时候,我们总希望能够得到我们手机的Toolkit的版本.这样我们可以知道那些API是可以用的,那些是不可以在我们的手机版本中运用的.在我们的API网址中,有许多的API有如下的描述:



它表明该API所能够支持的Ubuntu.Components的版本.那么我们怎么能够发现我们的手机的Ubuntu.Components的版本呢?


方法一:


在手机中我们通过命令行的方法来寻找,比如:



通过上面的命令,我们可以看到在手机中有如下的文件目录存在:

/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/1.3

表明"1.3"版本是在我们的手机中被支持的.

方法二


通过Ubuntu API的方法得到:

Main.qml


import QtQuick 2.4
import Ubuntu.Components 1.3

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "ubuntutoolkitversion.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("ubuntutoolkitversion")

        Column {
            anchors.centerIn: parent
            Label { text: "Toolkit ver: " + Ubuntu.toolkitVersion  }
            Label { text: "Major: " + Ubuntu.toolkitVersionMajor  }
            Label { text: "Minor: " + Ubuntu.toolkitVersionMinor  }
            Label { text: "Toolkit ver: " + Ubuntu.version(Ubuntu.toolkitVersionMajor,
                                         Ubuntu.toolkitVersionMinor)  }
        }
    }
}

就像API的描述一样,这个API是从Ubuntu.Components 1.2版本中开始支持的.运行该应用:



我们从上面的输出可以看出来,手机中的Ubuntu Toolkit的版本是1.3.


作者:UbuntuTouch 发表于2016/3/16 8:30:21 原文链接
阅读:214 评论:0 查看评论

Read more
UbuntuTouch

我们可以通过利用Ubuntu.Components.ListItems 中的Expandable来创建一个可以扩展的List列表.在有些列表应用中这个是非常有用的.它可以让我们展示更多的内容.在先前的例程"如何在QML中设计一个expandable ListView"中,我有一个类似的设计.开发者也可以参阅那个例程来做自己的设计.


我们还是来看一个简单的例程:


Main.qml


import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.ListItems 1.3 as ListItem

/*!
    \brief MainView with a Label and Button elements.
*/

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

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "expandablescolumn.liu-xiao-guo"

    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("expandablescolumn")

        ListModel {
            id: mymodel
            ListElement { name: "image1.jpg" }
            ListElement { name: "image2.jpg" }
            ListElement { name: "image3.jpg" }
            ListElement { name: "image4.jpg" }
            ListElement { name: "image5.jpg" }
            ListElement { name: "image6.jpg" }
            ListElement { name: "image7.jpg" }
            ListElement { name: "image8.jpg" }
            ListElement { name: "image9.jpg" }
            ListElement { name: "image10.jpg" }
            ListElement { name: "image11.jpg" }
        }

        ListItem.ExpandablesColumn {
            anchors.fill: parent
            Repeater {
                model: mymodel
                ListItem.Expandable {
                    id: exp
                    expandedHeight: units.gu(30)
                    collapsedHeight: units.gu(12)

                    Image {
                        height: exp.height
                        width: height
                        source: "images/" + name
                    }

                    Label {
                        anchors.horizontalCenter: parent.horizontalCenter
                        text: index
                    }

                    onClicked: {
                        expanded = true;
                    }
                }
            }
        }
    }
}

在这里,我们使用了一个而ExpandablesColumn来设计我们的一个类似ListView的列表.在我们的设计中,我们也可以采用UbuntuListView来完成我们的设计.具体代码可以参阅UbuntuListView中的设计.

如上面的ListItem.Expandable显示的那样,我们可以把它看成一个容器.在它里面我们可以画我们任何喜欢的界面.当点击的时候,我们可以通过如下的方法:

                    onClicked: {
                        expanded = true;
                    }

把该项打开,当然,我们也可以参考在UbuntuListView中的设计:

        delegate: ListItem.Expandable {
            id: expandingItem
            expandedHeight: units.gu(30)
            onClicked: {
                ubuntuListView.expandedIndex = index;
            }
        }

在上面的设计中,我们把UbuntuListView中的expandedIndex设为当前的index从而达到expand当前项的目的.

运行我们的例程:

   

当我们打开我们的列表中的项的时候,该项被自动expand.当然我们也可以加入一些自己喜欢的动画效果.点击任何其它的区域将使得该项又回到以前的位置.

作者:UbuntuTouch 发表于2016/3/16 15:52:20 原文链接
阅读:208 评论:0 查看评论

Read more