UnAngelo blog

…se io fossi un angelo
Subscribe

Ubuntu 11.10 on ARM

October 18, 2011 By: Victor Tuson Palau Category: 1

I have been using Ubuntu 11.10 on ARM now for a couple of days and I have to say: It is great! Ubuntu has had a long history of supporting ARM Systems on a Chip (SoC) since 2008, but Ubuntu 11.10 is a significant milestone.

Introducing.. Ubuntu Server on ARM – Technology Preview

Canonical announced back in August that Ubuntu Server 11.10 would include the first ARM version of the product, and here it is. While this is just the first step on an exciting journey, it is worth to celebrate that the voyage has started. I look forward to see what 12.04 LTS brings us on this space!

Playing with Ubuntu on ARM (Toshiba AC100)

It is hard to really grasp the full experience of Ubuntu on ARM when you are playing with a development board. For this reason, we have released a demo image for the Tegra2-based (Nvidia) Toshiba AC100.

Running Unity 2D, it shows off  that Ubuntu on ARM is a great platform for computing, in a very compact design and with a very long battery life. For all these reasons, this is my system of choice to take to UDS-P.

If you have a Toshiba AC100, I encourage you to install Ubuntu 11.10 on it!

TI OMAP4 Panda Board

Powered by the Texas Instruments OMAP4430 processor, the Panda Board packs in “a dual-core 1 GHz ARM Cortex-A9 MPCore CPU, a PowerVR SGX540 GPU, a C64x DSP, and 1 GB of DDR2 SDRAM“.  Providing an affordable and competitive design tool for the embedded mobile space.

Ubuntu 11.10 on ARM is available in headless and full image for Panda. You can find download links and installation instructions here. You can also find there Ubuntu 11.10 for OMAP3 (Beagle Board).

Freescale IMX53 QuickStart Board

The IMX53 Family is oriented towards automotive solutions. Ubuntu 11.10 on ARM is the first release of Ubuntu to provide support for the IMX53 QuickStart Board. You can find download links and installation instructions here.

Linaro and Ubuntu

Both the TI OMAP4 and Freescale images are based on the Linaro outputs for those SoCs. This has greatly our capacity to support ARM development boards.

Thinking Like a Web Designer

September 13, 2011 By: Tim Bray Category: 1

[This post is by Roman Nurik, who is passionate about icons, with input from me and a bunch of the Framework engineers. —Tim Bray]

The number of people working on mobile apps, and specifically Android, is growing fast. Since modern mobile software-development is a relatively new profession, the community is growing by sucking in experts from related domains, one being web design and development.

It turns out that familiarity with web UI development, particularly using modern HTML5 techniques, can be a great primer for Android UI development. The Android framework and SDK have many analogues to tools and techniques in the Web repertoire of HTML, CSS, and JavaScript.

In this blog post, we’ll walk through a few web development features and look for matches in the world of Android UI development.

Device resolutions and physical sizes

One of the most important aspects of both Android UI design and web design is support for multiple screen resolutions and physical sizes. Just as your web app needs to work on any physical display and inside any size browser window, your native app needs to run on a variety of form factors, ranging from 2.5” phones to 10” tablets to (possibly) 50” TVs.

Let’s look at some ways in which CSS and Android allow for flexible and adaptive layouts.

Providing custom layouts for different resolutions

CSS3 media queries allow developers to include additional stylesheets to target different viewport and screen configurations. For example, developers can provide additional style rules or override existing styles for mobile devices. Although the markup (layout hierarchy) remains the same, CSS3 has several sophisticated techniques for completely transforming the placement of elements with different stylesheets.

Android has long offered a similar mechanism in resource directory qualifiers. This extends to many different types of resources (layouts, images or ‘drawables’, styles, dimensions, etc). Thus you can customize the view hierarchy as well as styling depending on device form factor, A base set of layouts for handsets can be extended for tablets by placing additional layouts in res/layout-xlarge or res/layout-sw600dp (smallest width 600 density-independent pixels) directories. Note that the latter syntax requires Android 3.2 or later.

Below is a CSS3 example of how one could hide a ‘left pane’ on smaller devices and show it on screens at least 600 pixels wide:

#leftPane {
  display: none;
}

@media screen and (min-device-width:600px) {
  #leftPane {
    display: block;
  }
}

The same could be accomplished on Android using multiple layout directories:

res/layout/foo.xml:

<FrameLayout>
  <!-- a single pane -->
  <View android:id="main_pane">
</FrameLayout>

res/layout-sw600dp/foo.xml:

<LinearLayout android:orientation="horizontal">
  <!-- two panes -->
  <View android:id="left_pane">
  <View android:id="main_pane">
</LinearLayout>

As a side note, if you plan on creating multi-pane layouts, consider using fragments, which help break up your screens into modular chunks of both layout and code.

There are also other neat ways of using resource directory qualifiers. For example, you could create values/dimens.xml and values-sw600dp/dimens.xml files specifying different font sizes for body text, and reference those values in your layouts by setting android:textSize="@dimen/my_body_text_size". The same could be done for margins, line spacing, or other dimensions to help manage whitespace on larger devices.

‘Holy grail’ layouts

Web developers have long dreamt of an easy way to build a ‘holy grail’ 5-pane layout (header/footer + 3 vertical columns). There are a variety of pre-CSS3 tricks including position:fixed, float:left, negative margins, and so on, to build such layouts but CSS3 introduced the flexible box module, which simplifies this tremendously.

Figure: An archetypal “holy grail” layout

It turns out that grail is pretty holy for Android tablet apps, too, and in particular for tablets held sideways in landscape mode. A good approach involves the use of LinearLayout, one of the simplest and most popular of the Android layouts.

LinearLayout has this neat way to stretch its children to fit the remaining space, or to distribute available space to certain children, using the android:layout_weight attribute. If a LinearLayout has two children with a fixed size, and another child with a nonzero layout_weight, that other child view will stretch to fill the remaining available space. For more on layout_weight and other ways to make layouts more efficient (like switching from nested LinearLayouts to RelativeLayout), check out Layout Tricks: Creating Efficient Layouts.

Let’s take a look at some example code for implementing such a ‘holy grail’ layout on Android and on the web:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- top pane -->
    <View android:id="@+id/top_pane"
        android:layout_width="match_parent"
        android:layout_height="50dp" />

    <LinearLayout android:id="@+id/middle_container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">

        <!-- left pane -->
        <View id="@+id/left_pane"
            android:layout_width="300dp"
            android:layout_height="match_parent" />

        <!-- center pane -->
        <View id="@+id/center_pane"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <!-- right pane -->
        <View id="@+id/right_pane"
            android:layout_width="300dp"
            android:layout_height="match_parent" />

    </LinearLayout>

    <!-- bottom pane -->
    <View android:id="@+id/bottom_pane"
        android:layout_width="match_parent"
        android:layout_height="50dp" />

</LinearLayout>

Note: Android tablet apps in landscape will generally show an action bar as the top pane and will usually have neither a right nor bottom pane. Also note that the action bar layout is automatically provided by the framework as of Android 3.0, and thus you don’t need to worry about positioning it.

And here’s an example implementation using the CSS3 flexible box model; notice the similarities:

<style>
  html, body { margin: 0; height: 100%; }

  #container {
    height: 100%;
    display: -webkit-box; /* like LinearLayout */
    display:    -moz-box;
    -webkit-box-orient: vertical; /* like android:orientation */
       -moz-box-orient: vertical;
  }

  #top, #bottom { height: 50px; }

  #middle {
    -webkit-box-flex: 1; /* like android:layout_weight */
       -moz-box-flex: 1;
    display: -webkit-box;
    -webkit-box-orient: horizontal;
       -moz-box-orient: horizontal;
  }

  #left, #right { width: 300px; }

  #center {
    -webkit-box-flex: 1;
       -moz-box-flex: 1;
  }
</style>

<div id="container">
  <div id="top"></div>
  <div id="middle">
    <div id="left"></div>
    <div id="center"></div>
    <div id="right"></div>
  </div>
  <div id="bottom"></div>
</div>

Layered content

In CSS, with position:absolute, you can overlay your UI elements. On Android, you can use FrameLayout to achieve this. The child views in a frame layout are laid out on top of each other, with optional layout_gravity attributes indicating alignment with the parent frame layout.

Below is a contrived example of a FrameLayout with three children.

Figure: Example FrameLayout with three children (2 with top-left and 1 bottom-right alignment)

Figure: Isometric view of the example FrameLayout and its children.

The code for this example is as follows:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="300dp"
    android:layout_height="200dp">

    <!-- bottom-most child, with bottom-right alignment -->
    <View android:layout_gravity="bottom|right"
        android:layout_width="100dp"
        android:layout_height="150dp" />

    <!-- middle child, with top-left alignment -->
    <View android:layout_gravity="top|left"
        android:layout_width="200dp"
        android:layout_height="175dp" />

    <!-- top-most child, with top-left alignment →
    <!-- also stretched to fill vertically -->
    <View android:layout_gravity="top|left"
        android:layout_width="100dp"
        android:layout_height="match_parent" />

</FrameLayout>

Scrollable content

HTML, by default, flows in reading order and scrolls vertically. When content extends beyond the bottom of the browser, scrollbars automatically appear. Content panes can also be made individually scrollable using overflow:scroll or overflow:auto.

Android screen content isn’t scrollable by default. However, many content Views such as ListView and EditText offer scrolling, and any layout can be made scrollable by wrapping it in a ScrollView or HorizontalScrollView.

It’s also possible to add custom scrolling to views by using methods like View.scrollTo and helpers like Scroller in response to touch events. And for horizontal, snap-to-page-bounds scrolling, one can use the excellent new ViewPager class in the support library.

Below is an example of a ScrollView containing a single TextView child and the code needed to implement something like this.

Figure: A TextView inside a ScrollView, scrolled about half way.


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- the scrollable content -->
    <TextView android:layout_gravity="bottom|right"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="32dp"
        android:textSize="48sp"
        android:text="The\nquick\nbrown\nfox\njumps\nover..." />

</ScrollView>

Custom layouts

Sometimes the positioning and layout behaviors you can achieve with CSS aren’t enough to achieve your desired layout. In those cases, developers fall back on JavaScript coupled with absolute positioning to place and size elements as needed.

Programmatically defined layouts are also possible on Android. In fact, they’re sometimes the most elegant and/or performant way of implementing a unique or otherwise tricky layout. Not happy with nesting LinearLayouts for implementing a 2x3 grid of navigation icons? Just extend ViewGroup and implement your own layout logic! (see an example DashboardLayout here). All the built-in layouts such as LinearLayout, FrameLayout, and RelativeLayout are implemented this way, so there generally aren’t the same performance implications with custom layouts as there are with scripted layout on the web.

Device densities

Web designers have long dealt with the reality that display densities vary, and that there wasn’t much they could do about it. This meant that for a long time web page graphics and UI elements had different physical sizes across different displays. Your 100px wide logo could be 1” wide on a desktop monitor or ¾” on a netbook. This was mostly OK, given that (a) pointing devices such as mice offered generally good precision in interacting with such elements and (b) browsers allowed visually-impaired users to zoom pages arbitrarily.

However, on touch-enabled mobile devices, designers really need to begin thinking about physical screen size, rather than resolution in pixels. A 100px wide button on a 120dpi (low density) device is ~0.9” wide while on a 320dpi (extra-high density) screen it’s only ~0.3” wide. You need to avoid the fat-finger problem, where a crowded space of small touch targets coupled with an imprecise pointing tool (your finger) leads to accidental touches. The Android framework tries really hard to take your layout and scale elements up or down as necessary to work around device-density differences and get a usable result on a wide range of them. This includes the browser, which scales a 160px <img> at 100% browser zoom up to 240px on a 240dpi screen, such that its physical width is always 1”.

Developers can achieve finer-grained control over this browser scaling by providing custom stylesheets and images for different densities, using CSS3 media query filters such as -webkit-max-device-pixel-ratio and <meta> viewport arguments such as target-densitydpi=device-dpi. For an in-depth discussion on how to tame this mobile browser behavior see this blog post: Pixel-perfect Android web UIs.

For native Android apps, developers can use resource directory qualifiers to provide different images per density (such as drawable-hdpi and drawable-mdpi). In addition, Android offers a special dimension unit called ‘density independent pixels’ (dp) which can (and should!) be used in layout definitions to offset the density factors and create UI elements that have consistent physical sizes across screens with different densities.

Features you don’t have out of the box

There are a few features that web designers and developers rely on that aren’t currently available in the Android UI toolkit.

Developers can defer to user-driven browser zooming and two-dimensional panning for content that is too small or too large for its viewport, respectively. Android doesn’t currently provide an out-of-the-box mechanism for two-dimensional layout zooming and panning, but with some extra legwork using existing APIs, these interactions are possible. However, zooming and panning an entire UI is not a good experience on mobile, and is generally more appropriate for individual content views such as lists, photos, and maps.

Additionally, vector graphics (generally implemented with SVG) are gaining in popularity on the Web for a number of reasons: the need for resolution independence, accessibility and ‘indexability’ for text-heavy graphics, tooling for programmatic graphic generation, etc. Although you can’t currently drop an SVG into an Android app and have the framework render it for you, Android’s version of WebKit supports SVG as of Android 3.0. As an alternative, you can use the very robust Canvas drawing methods, similar to HTML5’s canvas APIs, to render vector graphics. There are also community projects such as svg-android that support rendering a subset of the SVG spec.

Conclusion

Web developers have a number of different tools for frontend layout and styling at their disposal, and there are analogues for almost all of these in the world of Android UI engineering. If you’re wondering about analogues to other web- or CSS-isms, start a conversation out there in the Android community; you’ll find you’re not alone.

Así afectará a los blogs la Ley Mordaza que prepara Leire Pajín

June 06, 2011 By: orion Category: 1, absurdo, linux

Este viernes el gobierno aprobó el anteproyecto de la llamada “Ley de Igualdad de Trato”, que podría someter todos los ámbitos de la vida a los caprichos del gobierno. Cuando digo “todos” me refiero también a los blogs. La inclusión de las bitácoras en los ámbitos afectados por esta ley no es algo gratuito. El Art.1 de ese anteproyecto señala que dicha norma regulará los “derechos y obligaciones de las personas, físicas o jurídicas, públicas o privadas”. El Art.3 señala: “Esta Ley se aplicará en todos los ámbitos de la vida política, económica, cultural y social”. Y el Art.4, en un absurdo intento de ponerle puertas al campo, afirma que “queda prohibida toda conducta, acto, criterio o práctica” que atente contra los amplísimos e incluso contradictorios conceptos de discriminación que contempla dicha ley. Veamos algunos ejemplos:

    Moderación de comentarios: te puede caer una considerable multa si tienes un blog con los comentarios moderados y basas tu política de moderación en cualquier criterio que pueda considerarse discriminatorio por “razón de nacimiento, origen racial o étnico, sexo, religión, convicción u opinión, edad, discapacidad, orientación o identidad sexual, enfermedad, lengua o cualquier otra condición o circunstancia personal o social” (Art.2 de la ley). Por ejemplo: este blog podría ser multado porque las normas de participación indican que los idiomas del blog son el castellano y el gallego, y que cualquier comentario en otro idioma ha de ser traducido. Es un criterio de sentido común pero que incurre en la discriminación por razón de lengua según ese Art.2. Así pues, para cumplir la ley tendría que aceptar cualquier comentario en cualquier idioma, aunque no entendiese su contenido (con el consiguiente riesgo de admitir contenidos ilegales): el colmo del absurdo. Si no lo hago, según los Arts.43 y 44 de esa ley podría estar incurriendo en una infracción grave y podría caerme una multa de entre 10.001 y 60.000 euros (entre 1.644.000 y 9.983.000 pesetas, una auténtica burrada).
    Si tienes un blog dedicado a Linux y en los comentarios tienes a un troll dando la matraca cada día diciendo que quiere hablar de Windows en los comentarios, no podrías banearle pues incurrirías en una discriminación por razón de opinión, según ese Art.2. De la misma forma, si tienes un blog de izquierdas no podrás borrar un comentario por defender ideas opuestas, y viceversa. De lo contrario, podrían acusarte de una infracción grave con una sanción de entre 10.001 y 60.000 euros. Gusten más o menos esas políticas de moderación, es un derecho del propietario de un blog establecer los criterios de moderación que desee. Ese derecho desaparecerá con la Ley Pajín, al aplicarse al ámbito privado criterios de no discriminación que hasta ahora y por sentido común sólo eran aplicables al ámbito de las administraciones públicas. Esto es violar nuestras libertades en nombre de la llamada “igualdad de trato”, un concepto que nada tiene que ver con la verdadera igualdad de toda democracia, que es la igualdad ante la ley.
    Si en tu blog no discriminas a nadie por razón de lengua u opinión, también podrías vulnerar la ley, pues su Art.5 proclama un nuevo concepto: la “discriminación indirecta”, que según la ley “se produce cuando una disposición, criterio o práctica aparentemente neutros ocasiona o puede ocasionar a una o varias personas una desventaja particular con respecto a otras”. Esto entra en contradicción con el concepto de discriminación directa que establece la propia ley, revelando el enorme tamaño del disparate jurídico que está promoviendo Leire Pajín. Y es que lo que esto quiere decir es que tendrás que discriminar para no discriminar: a modo de ejemplo, como en este blog la mayoría de comentarios se publican en castellano, se me podría multar porque las normas de moderación del blog no incluyen criterios para obligar al uso de idiomas minoritarios como el gallego, el vascuence o el catalán en un determinado número de comentarios, por ejemplo. Nuevamente, estaría incurriendo en una infracción grave con una sanción de entre 10.001 y 60.000 euros
    Para colmo de esperpento, si por ejemplo impidieses comentar en tu blog a alguien que te haya denunciado al amparo de esta ley podrías estar incurriendo en lo que el Art.10 de dicha ley define como represalia: “cualquier trato adverso o consecuencia negativa que pueda sufrir una persona por intervenir, participar o colaborar en un procedimiento administrativo o proceso judicial destinado a impedir o hacer cesar una situación discriminatoria”. Nuevamente podrían acusarte de una infracción grave con otra sanción más de entre 10.001 y 60.000 euros.

Una ‘ley comodín’ para tener la llave de la libertad de cualquiera

Como podéis observar, esta ley considera discriminación casi cualquier decisión que podamos tomar en nuestros blogs, o en cualquier ámbito de nuestra vida social. No es algo hecho por capricho, de forma accidental o fruto de la casualidad. Antes bien, estamos ante una “ley comodín” con la que el poder político podrá perseguir y castigar a cualquier ciudadano cuando le dé la gana, por casi cualquier causa: una eficaz herramienta legal para reprimir al discrepante, sobre todo teniendo en cuenta lo que vamos a ver a continuación.

Aplicará la ley un ‘inquisidor’ designado por el gobierno

Hay que tener en cuenta que el Art.37 crea la llamada “Autoridad para la Igualdad de Trato y la No Discriminación”, definiéndola cínicamente como una “autoridad independiente” que se encargará de aplicar esta ley. La curiosa “independencia” de esa autoridad queda en evidencia en el punto 4 del Art.38: “El nombramiento de la persona titular de la Autoridad para la Igualdad de Trato y la No Discriminación corresponderá al Gobierno mediante Real Decreto”. Al parlamento se le reserva un papel de mero florero en este nombramiento. ¿Cómo puede considerarse independiente un cargo así?

El acusado deberá probar su inocencia, como en la Inquisición

Para colmo, como señala el Art.28 de la ley y como comenté aquí en enero, el acusado de discriminación deberá probar su inocencia, lo cual viola el derecho a la presunción de inocencia que ampara el Art.24 de la Constitución Española. Esta inversión de la carga de la prueba supone una vuelta a los métodos de la Inquisición, cuando existía la llamada “prueba diabólica”, que dejaba a acusado en una total indefensión. Si tenemos en cuenta que, además, esto será competencia de un “inquisidor” designado por el gobierno, podemos hacernos una clara idea de para qué quiere aprobar el gobierno con tanta prisa una ley tan radicalmente antidemocrática como ésta.

Podrán censurar tu blog para proteger a la víctima de “discriminación”

Pero aún hay más: la disposición adicional primera de la ley modifica la LSSI, la Ley de Servicios de la Sociedad de la Información, aprobada en 2002 durante el mandato de Aznar. En concreto se modifica el Artículo 11 de esa ley, relativo al “Deber de colaboración de los prestadores de servicios de intermediación”. La modificación consiste en añadir un segundo párrafo en el que se establece que los tribunales podrán ordenar “medidas de restricción o interrupción de la prestación de servicios o de retirada de datos de páginas de Internet que contempla la presente ley” con el fin de “proteger los derechos de la víctima”. O dicho sea de otra forma: podrán bloquear el acceso a tu web o censurar parte de sus contenidos para dar satisfacción a la víctima de una “discriminación”.

Una ley mucho peor que la Ley Sinde para la libertad de expresión

Viendo los innumerables y hasta contradictorios conceptos de discriminación que establece este anteproyecto, la ya de por sí cercenada libertad en la red va a sufrir un recorte enorme con esta nueva ley. Para seros sincero, no entiendo que toda la movilización que hubo en su momento contra la LSSI y más recientemente contra la Ley Sinde no se esté produciendo ahora contra la Ley Pajín. Estamos ante una ley mucho peor que la Ley Sinde en lo que respecta a la libertad de los internautas. Al fin y al cabo, se trata de una ley que reinstaura los delitos de opinión, y para colmo encomienda su persecución a un cargo político designado a dedo por el gobierno, violando el derecho a la presunción de inocencia de todo acusado. Ni la Ley Sinde había llegado tan lejos en la agresión a nuestras libertades

A Bright Idea: Android Open Accessories

May 19, 2011 By: Tim Bray Category: 1, google

[This post is by Justin Mattson, an Android Developer Advocate, and Erik Gilling, an engineer on the Android systems team. — Tim Bray]

Android’s USB port has in the past been curiously inaccessible to programmers. Last week at Google I/O we announced the Android Open Accessory APIs for Android. These APIs allow USB accessories to connect to Android devices running Android 3.1 or Android 2.3.4 without special licensing or fees. The new “accessory mode” does not require the Android device to support USB Host mode. This post will concentrate on accessory mode, but we also announced USB Host mode APIs for devices with hardware capable of supporting it.

To understand why having a USB port is not sufficient to support accessories let’s quickly look at how USB works. USB is an asymmetric protocol in that one participant acts as a USB Host and all other participants are USB Devices. In the PC world, a laptop or desktop acts as Host and your printer, mouse, webcam, etc., is the USB Device. The USB Host has two important tasks. The first is to be the bus master and control which device sends data at what times. The second key task is to provide power, since USB is a powered bus.

The problem with supporting accessories on Android in the traditional way is that relatively few devices support Host mode. Android’s answer is to turn the normal USB relationship on its head. In accessory mode the Android phone or tablet acts as the USB Device and the accessory acts as the USB Host. This means that the accessory is the bus master and provides power.

Establishing the Connection

Building an Open Accessory is simple as long as you include a USB host and can provide power to the Android device. The accessory needs to implement a simple handshake to establish a bi-directional connection with an app running on the Android device.

The handshake starts when the accessory detects that a device has been connected to it. The Android device will identify itself with the VID/PID that is appropriate based on the manufacturer and model of the device. The accessory then sends a control transaction to the Android device asking if it supports accessory mode.

Once the accessory confirms the Android device supports accessory mode, it sends a series of strings to the Android device using control transactions. These strings allow the Android device to identify compatible applications as well as provide a URL that Android will use if a suitable app is not found. Next the accessory sends a control transaction to the Android device telling it to enter accessory mode.

The Android device then drops off the bus and reappears with a new VID/PID combination. The new VID/PID corresponds to a device in accessory mode, which is Google’s VID 0x18D1, and PID 0x2D01 or 0x2D00. Once an appropriate application is started on the Android side, the accessory can now communicate with it using the first Bulk IN and Bulk OUT endpoints.

The protocol is easy to implement on your accessory. If you’re using the ADK or other USB Host Shield compatible Arduino you can use the AndroidAccessory library to implement the protocol. The ADK is one easy way to get started with accessory mode, but any accessory that has the required hardware and speaks the protocol described here and laid out in detail in the documentation can function as an Android Open Accessory.

Communicating with the Accessory

After the low-level USB connection is negotiated between the Android device and the accessory, control is handed over to an Android application. Any Android application can register to handle communication with any USB accessory. Here is how that would be declared in your AndroidManifest.xml:

<activity android:name=".UsbAccessoryActivity" android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
    </intent-filter>

    <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
               android:resource="@xml/accessory_filter" />
</activity>

Here's how you define the accessories the Activity supports:

<resources>
    <usb-accessory manufacturer="Acme, Inc" model="Whiz Banger" version="7.0" />
</resources>

The Android system signals that an accessory is available by issuing an Intent and then the user is presented with a dialog asking what application should be opened. The accessory-mode protocol allows the accessory to specify a URL to present to the user if no application is found which knows how communicate with it. This URL could point to an application in Android Market designed for use with the accessory.

After the application opens it uses the Android Open Accessory APIs in the SDK to communicate with the accessory. This allows the opening of a single FileInputStream and single FileOutputStream to send and receive arbitrary data. The protocol that the application and accessory use is then up to them to define.

Here’s some basic example code you could use to open streams connected to the accessory:

public class UsbAccessoryActivity extends Activity {
    private FileInputStream mInput;
    private FileOutputStream mOutput;

    private void openAccessory() {
        UsbManager manager = UsbManager.getInstance(this);
        UsbAccessory accessory = UsbManager.getAccessory(getIntent());

        ParcelFileDescriptor fd = manager.openAccessory(accessory);

        if (fd != null) {
            mInput = new FileInputStream(fd);
            mOutput = new FileOutputStream(fd);
        } else {
            // Oh noes, the accessory didn’t open!
        }
    }
}

Future Directions

There are a few ideas we have for the future. One issue we would like to address is the “power problem”. It’s a bit odd for something like a pedometer to provide power to your Nexus S while it’s downloading today’s walking data. We’re investigating ways that we could have the USB Host provide just the bus mastering capabilities, but not power. Storing and listening to music on a phone seems like a popular thing to do so naturally we’d like to support audio over USB. Finally, figuring out a way for phones to support common input devices would allow for users to be more productive. All of these features are exciting and we hope will be supported by a future version of Android.

Accessory mode opens up Android to a world of new possibilities filled with lots of new friends to talk to. We can’t wait to see what people come up with. The docs and samples are online; have at it!

[Android/USB graphic by Roman Nurik.]

Chromebook: Are You Really Ready to Marry Google?

May 17, 2011 By: (author unknown) Category: 1, google

Shared by ianus
Thanks to: http://www.networkworld.com/news/2011/051611-chromebook-are-you-really-ready.html
Additional information: http://www.google.com/chromebook/#chromebooks

A Chromebook is sort of a netbook based on Google's Chrome operating system. Like any laptop-like device, it has a screen, a keyboard and a trackpad. But that's where the similarities to the laptops or netbooks you've seen end.

The Chromebook could be named the Cloudbook, because it's designed to work exclusively online, with storage and applications on Google's servers in the cloud. Indeed, it has no local storage (unless you count a small solid state drive used to cache work in progress), no optical drives and few connectors for peripherals.

Because the Chromebook has a small operating system, and few, if any, drivers to load, it boots in less than 10 seconds and wakes up almost immediately if you've put it to sleep. And like a netbook, the first two commercial versions of the Chromebook are light (between three and four pounds), claim excellent battery life--six to eight hours-- and are priced well below $500.

Variations of “Europe” Expressed in a Venn Diagram

March 21, 2011 By: Minnesotastan Category: Uncategorized

I’m glad that someone has done this, though I wish they had used names rather than flags; I would never be able to identify three of the entities on the outer part of the orange circle as Andorra, San Marino and Monaco.  Fortunately some of the names and additional explanation is available at the Strange Maps blog at Big Think.*

This diagram is a particularly instructive map, too: it neatly visualises the gaps and overlaps between all kinds of supranational institutions in Europe – differences which for the most part are too subtle for any but the most attentive observer. All will be aware of the ‘Europe’ that is a less than homogenous conglomerate of nation states, with an unwieldy Brussels bureaucracy at its centre. This European Union, which consists of 27 member states, is merely the most visible of several European unions, all committed to different versions of the same goal: European integration.

The diagram also includes one statelet whose euros are much sought after by collectors.

Previously on Neatorama:  The Great British Venn Diagram.

Link.

*Addendum:  A hat tip to Feodor for noting that Strange Maps got the diagram from Wikipedia’s “Supranational European Bodies,” where the flags are clickable to the corresponding country entries. (It is also described there as a Euler diagram, not a Venn diagram).

Google Search app for iPhone—a new name and a new look

March 15, 2011 By: Julie Z Category: google

If you need to do a Google search on your iPhone or iPod touch it's now faster and easier when you use our redesigned Google Search app, formerly Google Mobile App. If you've been using Google Mobile App for a while, you'll notice that things look different.

The redesigned home screen of Google Search app.


First, you’ll see that there are now more ways to interact with the app. When browsing through search results or looking at a webpage, you can swipe down to see the search bar or change your settings. For those who use other Google apps, there’s an Apps button at the bottom of the screen for rapid access to the mobile versions of our products.

We also included a new toolbar that will make it easier for you to filter your results. You can open this toolbar by swiping from left to right — either before you search or once you’ve got your results. If you only want images, just tap “Images,” and the results will update as shown:


The toolbar helps you to get to the right kind of results.

Second, we’ve made it easier to pick up searching where you left off. If you leave the app and come back later, you’ll be able either to start a new search right away (just tap in the search box to type, hit the microphone button to do a voice search or tap on the camera icon to use Google Goggles) or get back to exactly where you were by tapping on the lower part of the page.

Finally, there are a number of improvements we’ve made to everything else you love in the app, including Google Goggles, Voice Search, Search with My Location, Gmail unread counts and more. There's a lot in the app, so we've added a simple help feature to let you explore it. Access this by tapping the question mark above the Google logo.

The help screen can be accessed from anywhere in Google Search app.




Download and try Google Search app today; it’s available free from the iTunes App Store. You can also scan the QR code below.


Posted by Alastair Tse, Software Engineer and Robert Hamilton, Product Manager

Astrónomos designan un nuevo signo zodiacal; astrólogos discrepan – Wikinoticias

February 11, 2011 By: (author unknown) Category: 1

Shared by ianus
http://es.wikipedia.org/wiki/Ofiuco_(astrolog%C3%ADa)
....YA NO SOY LEO!!!
NOOOOOOOO

15 de enero de 2011

Un revuelo se está causando entre los astrónomos, astrólogos y gentes aficionadas al horóscopo, luego de que recientes declaraciones de parte del emisario de la Minnesota Planetarium Society, Park Kunkle, asegurara la designación de Ofiuco como parte del Zodíaco.

Esto es debido a los cambios en la posición del planeta respecto de la ubicación de las constelaciones en los últimos dos mil años.

Tags: , , , ,

LEGO Mystery Box… – a set on Flickr

February 08, 2011 By: (author unknown) Category: 1

Shared by ianus
Increíble!
Lo que se puede llegar a hacer con piezas de Lego (y mucho tiempo libre!).
...yo quiero una...

DSCF0365-2

...or, "6 Months of Insanity." The ideas for this box came to me a little bit at a time, after my 22-year-old nephew had seen my other boxes on MOCpages (http://www.mocpages.com/folder.php/9861 ) and asked me to make a box for him. He wanted me to make another one like my Black Box, but I wanted to do something different. This is the only one of my boxes that is complicated enough for me to have actually built a prototype from parts in my "pile." For the final design, Lego Digital Designer was an indispensable tool, and I also couldn't have done this without bricklink.com (and my credit cards!). The six main compartments have to be opened in the order shown. The "key" can be helpful to open the other main compartments, in addition to the center one. In the last photo you can see my initials (TCW) in question marks.

33 photos | 20,696 views

items are from between 29 Jan 2011 & 05 Feb 2011.

DSCF0365-2 by Todd Wilder
DSCF0297-2 by Todd Wilder
DSCF0298-2 by Todd Wilder
DSCF0300-2 by Todd Wilder
DSCF0302-2 by Todd Wilder
DSCF0303-2 by Todd Wilder
DSCF0306-2 by Todd Wilder
DSCF0308-2 by Todd Wilder
DSCF0311-2 by Todd Wilder
DSCF0315-2 by Todd Wilder
DSCF0319-2 by Todd Wilder
P1050075-2 by Todd Wilder
DSCF0320-2 by Todd Wilder
DSCF0321-2 by Todd Wilder
DSCF0323-2 by Todd Wilder
DSCF0325-2 by Todd Wilder
DSCF0326-2 by Todd Wilder
DSCF0331-2 by Todd Wilder
DSCF0329-2 by Todd Wilder
DSCF0332-2 by Todd Wilder
DSCF0333-2 by Todd Wilder
DSCF0336-2 by Todd Wilder
DSCF0337-2 by Todd Wilder
DSCF0340-2 by Todd Wilder
DSCF0341-2 by Todd Wilder
DSCF0342-2 by Todd Wilder
DSCF0345-2 by Todd Wilder
DSCF0346-2 by Todd Wilder
DSCF0347-2 by Todd Wilder
DSCF0349-2 by Todd Wilder
DSCF0351-2 by Todd Wilder
Lego Mystery Box by Todd Wilder
DSCF0361-2 by Todd Wilder
Tags: , , , , , ,

Android 3.0 Platform Preview and Updated SDK Tools

January 26, 2011 By: Xavier Ducrohet, Android SDK Tech Lead Category: Uncategorized

Android 3.0 (Honeycomb) is a new version of the Android platform that is designed from the ground up for devices with larger screen sizes, particularly tablets. It introduces a new “holographic” UI theme and an interaction model that builds on the things people love about Android — multitasking, notifications, widgets, and others — and adds many new features as well.

Besides the user-facing features it offers, Android 3.0 is also specifically designed to give developers the tools and capabilities they need to create great applications for tablets and similar devices, together with the flexibility to adapt existing apps to the new UI while maintaining compatibility with earlier platform versions and other form-factors.

Today, we are releasing a preview of the Android 3.0 SDK, with non-final APIs and system image, to allow developers to start testing their existing applications on the tablet form-factor and begin getting familiar with the new UI patterns, APIs, and capabilties that will be available in Android 3.0.

Here are some of the highlights:

UI framework for creating great apps for larger screen devices: Developers can use a new UI components, new themes, richer widgets and notifications, drag and drop, and other new features to create rich and engaging apps for users on larger screen devices.

High-performance 2D and 3D graphics: A new property-based animation framework lets developers add great visual effects to their apps. A built-in GL renderer lets developers request hardware-acceleration of common 2D rendering operations in their apps, across the entire app or only in specific activities or views. For adding rich 3D scenes, developers take advantage of a new 3D graphics engine called Renderscript.

Support for multicore processor architectures: Android 3.0 is optimized to run on either single- or dual-core processors, so that applications run with the best possible performance.

Rich multimedia: New multimedia features such as HTTP Live streaming support, a pluggable DRM framework, and easy media file transfer through MTP/PTP, give developers new ways to bring rich content to users.

New types of connectivity: New APIs for Bluetooth A2DP and HSP let applications offer audio streaming and headset control. Support for Bluetooth insecure socket connection lets applications connect to simple devices that may not have a user interface.

Enhancements for enterprise: New administrative policies, such as for encrypted storage and password expiration, help enterprise administrators manage devices more effectively.

For an complete overview of the new user and developer features, see the Android 3.0 Platform Highlights.

Additionally, we are releasing updates to our SDK Tools (r9), NDK (r5b), and ADT Plugin for Eclipse (9.0.0). Key features include:

  • UI Builder improvements in the ADT Plugin:
    • Improved drag-and-drop in the editor, with better support for included layouts.
    • In-editor preview of objects animated with the new animation framework.
    • Visualization of UI based on any version of the platform. independent of project target. Improved rendering, with better support for custom views.

To find out how to get started developing or testing applications using the Android 3.0 Preview SDK, see the Preview SDK Introduction. Details about the changes in the latest versions of the tools are available on the SDK Tools, the ADT Plugin, and NDK pages on the site.

Note that applications developed with the Android 3.0 Platform Preview cannot be published on Android Market. We’ll be releasing a final SDK in the weeks ahead that you can use to build and publish applications for Android 3.0.