Skip to main content

a silhouette of a person's head and shoulders, used as a default avatar

Java 16 Pattern Matching Fun

Java 16 brings Pattern Matching for instanceof. It’s a feature with exciting possibilities, though quite limited in its initial incarnation. 

Basic Pattern Matching

We can now do things like 

Object o = "hello";
if (o instanceof String s) {
    System.out.println(s.toUpperCase());
}

Note the variable “s”, which is then used without any casting needed.

Deconstructing Optionals

It would be even nicer if we could deconstruct structured types at the same time. I think it’s coming in a future version, but I’m impatient. Let’s see how close we can get with the current tools.

One thing we can do is use a function on the left hand side of this expression.

Let’s consider the example of dealing with unknown values in Java. There’s a fair amount of legacy to deal with. Sometimes you’ll get a value, sometimes you’ll get a null. Sometimes you’ll get an Optional<T> , sometimes you’ll get an Optional<Optional<T>> etc.

How can we make unknowns nicer to deal with?

We could create a little utility function that lets us convert all of these forms of unknown into either a value or not. Then match with an instanceof test.

Object unknown = Optional.of("Hello World");
assertEquals(
       "hello world",
       unwrap(unknown) instanceof String s
               ? s.toLowerCase()
               : "absent"
);

Thanks to instanceof pattern matching we can just use the string directly, without having to resort to passing method references i.e optional.map(String::toLowercase) 

The unwrap utility itself uses pattern matching against Optional to recursively unwrap values from nested optionals. It also converts nulls and Optional.empty() to a non-instantiatable type for the purposes of ensuring they can never match the above pattern.

static Object unwrap(Object o) {
   if (o instanceof Optional> opt) {
       return opt.isPresent() ? unwrap(opt.get()) : None;
   } else if (o != null) {
       return o;
   } else {
       return None;
   }
}
static class None {
   private None() {}
   public static final None None = new None();
}

Here’s several more examples, if you’d like to explore further.

Deconstructing Records

What about more complex structures? Now that we have record types, wouldn’t it be great if we can deconstruct them to work with individual components more easily. I think until more powerful type patterns exist in the language we’ll have to diverge from the instanceof approach. 

I previously showed how we could do this for records we control, by having them implement an interface. What about records we do not control? How can we deconstruct those? 

This is about the closest I can get to what I’d hope would be possible as a first class citizen in the language in future.

record Name(String first, String last) {}
Object name = new Name("Benji", "Weber");
If.instance(name, (String first, String last) -> {
   System.out.println(first.toLowerCase() + last.toLowerCase()); // prints benjiweber
});

It takes a record (Name) and a lambda where the method parameters are of the same types as the component types in the record. It deconstructs the record component parts and passes them to the lambda to use (assuming the record really matches).

We could also use as an expression to return a value, as long as we provide a fallback for the case when the pattern does not match.

Object zoo = new Zoo(new Duck("Quack"), new Dog("Woof"));

String result = withFallback("Fail").
    If.instance(zoo, (Duck duck, Dog dog) ->
       duck.quack() + dog.woof()
    ); // result is QuackWoof

So how does this work? 

If.instance is a static method which takes an Object of unknown type (we hope it will be a Record), and a lambda function that we want to pattern match against the provided object.

How can we use a lambda as a type pattern? We can use the technique from my lambda type references article—have the lambda type be a SerializableLambda which will allow us to use reflection to read the types of each parameter. 

static  void instance(Object o, MethodAwareTriConsumer action) { 

}

So we start with something like the above, a method taking an object and a reflectable lambda function.

Next we can make use of pattern matching again to check if it’s a record.

static  void instance(Object o, MethodAwareTriConsumer action) {
   if (o instanceof Record r) {
	// now we know it's a record
   }
}

Records allow reflection on their component parts. Let’s check whether we have enough component parts to match the pattern.

static  void instance(Object o, MethodAwareTriConsumer action) {
   if (o instanceof Record r) {
       if (r.getClass().getRecordComponents().length < 3) {
           return;
       }
       
	 // at this point we have a record with enough components and can use them.
   }
}

Now we can invoke the passed action itself 

action.tryAccept((T) nthComponent(0, r), (U) nthComponent(1, r), (V) nthComponent(2, r));

Where nthComponent uses reflection to access the relevant component property of the record.

private static Object nthComponent(int n, Record r)  {
   try {
       return r.getClass().getRecordComponents()[n].getAccessor().invoke(r);
   } catch (Exception e) {
       throw new RuntimeException(e);
   }
}

tryAccept is a helper default method I've added in MethodAwareTriConsumer. It checks whether the types of the provided values match the method signature before trying to pass them. Avoiding ClassCastException

interface MethodAwareTriConsumer extends TriConsumer, ParamTypeAware {
   default void tryAccept(T one, U two, V three) {
       if (acceptsTypes(one, two, three)) {
           accept(one, two, three);
       }
   }
   default boolean acceptsTypes(Object one, Object two, Object three) {
       return paramType(0).isAssignableFrom(one.getClass())
               && paramType(1).isAssignableFrom(two.getClass())
               && paramType(2).isAssignableFrom(three.getClass());
   }
  
   default Class> paramType(int n) {
       int actualParameters = method().getParameters().length; // captured final variables may be prepended
       int expectedParameters = 3;
       return method().getParameters()[(actualParameters - expectedParameters) + n].getType();
   }
}

Then put all this together and we can pattern match against Objects of unknown type, and deconstruct them if they're records matching the provided lambda type-pattern.

record Colour(Integer r, Integer g, Integer b) {}

Object unknown = new Colour(5,6,7); // note the Object type

int result = withFallback(-1).
    If.instance(unknown, (Integer r, Integer g, Integer b) ->
       r + g + b
    );

assertEquals(18, result);

Degrading safely if the pattern does not match

Object unknown = new Name("benji", "weber");

int result = withFallback(-1).
    If.instance(unknown, (Integer r, Integer g, Integer b) ->
       r + g + b
    );

assertEquals(-1, result);

Code for the record deconstruction and several more examples all in this test on github. Hopefully all this will be made redundant by future enhancements to Java's type patterns :)

The post Java 16 Pattern Matching Fun appeared first on Benji's Blog.

a silhouette of a person's head and shoulders, used as a default avatar

Actualización de marzo del 2021 de KDE Frameworks

En este tercer mes del año siguen las entradas recurrentes de las actualizaciones mensuales de rigor que demuestra que los desarrolladores de KDE no dejan de trabajar. Así que se congratulan en anunciar la actualización de marzo del 2021 de KDE Frameworks.  Con esta se llega a la versión 5.80, un suma y sigue de compromiso y constancia que no parece que tenga un final cercano.

Actualización de marzo del 2021 de KDE Frameworks

A pesar de que para los usuarios corrientes esta noticia sea algo confusa ya que no se trata de realzar una nueva aplicación ni de una nueva gran funcionalidad del escritorio, el desarrollo de KDE Frameworks tiene repercusiones directas en él a medio y largo plazo.

La razón de esta afirmación es que KDE Frameworks es básicamente la base de trabajo de los desarrolladores para realizar sus aplicaciones, es como el papel y las herramientas de dibujo para un artista: cuanto mejor sea el papel y mejores pinceles tenga, la creación de una artista será mejor.

De esta forma, las mejoras en KDE Frameworks facilitan el desarrollo del Software de la Comunidad KDE, haciendo que su funcionamiento, su estabilidad y su integración sea la mejor posible.

El pasado sábado 14 de marzo de 2021 ha sido lanzado KDE Frameworks 5.80, la nueva revisión del entorno de programación sobre el que se asienta Plasma 5, el escritorio GNU/Linux de la Comunidad KDE, y las aplicaciones que se crean con para él.

Hay que recordar que los desarrolladores de KDE decidieron lanzar actualizaciones mensuales de este proyecto y lo están cumpliendo con puntualmente. La idea es ofrecer pocas pero consolidadas novedades, a la vez que se mantiene el proyecto evolucionando y siempre adaptándose al vertiginoso mundo del Software Libre.

Una gran noticia para la Comunidad KDE que demuestra la evolución continua del proyecto que continua ganando prestigio en el mundo de los entornos de trabajo Libres.

Más información: KDE

¿Qué es KDE Frameworks?

Para los que no lo sepan, KDE Frameworks añade más de 70 librerías a Qt que proporcionan una gran variedad de funcionalidades necesarias y comunes, precisadas por los desarrolladores, testeadas por aplicaciones especí­ficas y publicadas bajo licencias flexibles. Como he comentado, este entorno de programación es la base para el desarrollo tanto de las nuevas aplicaciones KDE y del escritorio Plasma 5.

Actualización de marzo del 2021 de KDE Frameworks

Aquí podéis encontrar un listado con todos estos frameworks y la serie de artículos que dedico a KDE Frameworks en el blog,

Recuerda que puedes ver una introducción a Frameworks 5.0 en su anuncio de lanzamiento.

a silhouette of a person's head and shoulders, used as a default avatar

Syslog-ng & Pi day

Today is March 14th, or as many geeks refer to it: Pi day. On this occasion, I would like to show you a syslog-ng configuration, which prints a huge π on the screen, and two recent articles that feature syslog-ng on the Raspberry Pi.

Printing π

The following configuration – that I got from my colleagues – prints a huge π sign on screen. Create a new configuration, copy and paste the configuration below and save it on your host running syslog-ng with the name pi.conf:

@version: 3.31
@include "scl.conf"

template-function "pi-art" "

      3.141592653589793238462643383279
    5028841971693993751058209749445923
   07816406286208998628034825342117067
   9821    48086         5132
  823      06647        09384
 46        09550        58223
 17        25359        4081
           2848         1117
           4502         8410
           2701         9385
          21105        55964
          46229        48954
          9303         81964
          4288         10975
         66593         34461
        284756         48233
        78678          31652        71
       2019091         456485       66
      9234603           48610454326648
     2133936            0726024914127
     3724587             00660631558
     817488               152092096

";

block source pi-art(...) {

example-msg-generator(template("$(pi-art)") `__VARARGS__`);

};

log {
  source { pi-art(); };

   destination { file("/dev/stdout"); };
};

What happens in this configuration?

  • As usual, the syslog-ng configuration starts with a version number declaration. The current version is 3.31, but I also tested this config with syslog-ng version 3.26.

  • We include scl.conf (SCL is the syslog-ng configuration library). It contains many useful configuration snippets. None of them is used here, but we are too much used to including it :-)

  • We define a custom template function, called “pi-art” that shows a huge π sign.

  • The source block is also named “pi-art” and calls example-msg-generator() to print the π character once each second, using the previously defined template function.

  • Finally, the log statement connects the pi-art() source with the standard output (our screen).

How to test it? Start syslog-ng in the foreground with the freshly saved configuration:

syslog-ng -F -f pi.conf

syslog-ng on the Raspberry Pi

Recently, Pi day is not just about physics and mathematics (and eating pies), but also about the Raspberry Pi. Syslog-ng runs on these tiny machines and I contributed two articles to the Pi day article series on https://opensource.com/:

  • Containers became widely popular because of Docker on Linux, but there are much earlier implementations, including the jail system on FreeBSD. A container is called a `jail` in the FreeBSD terminology. The jail system was first released in FreeBSD 4.0, way back in 2000, and it has been continuously improved since then. While 20 years ago it was used mostly on large servers, now you can run it on your Raspberry Pi.
    From this article, you can learn the major differences between containers on Linux and FreeBSD, getting started with FreeBSD on the Raspberry Pi, and creating your first two containers using Bastille, a jail management application for FreeBSD: https://opensource.com/article/21/3/bastille-raspberry-pi

  • I have lived in 100-plus-year-old brick houses for most of my life. They look nice, they are comfortable, and usually, they are not too expensive. However, humidity is high in winter in my climate, and mold is a recurring problem. A desktop thermometer that displays relative humidity is useful for measuring it, but it does not provide continuous monitoring.
    In comes the Raspberry Pi: it is small, inexpensive, and has many sensor options, including temperature and relative humidity. It can collect data around the clock, do some alerting, and forward data for analysis.
    From this article, you can learn not just about how to forward sensor data from your Raspberry Pi to Elasticsearch using syslog-ng, but also how relative humidity is changing when opening the windows for shorter or longer periods of time: https://opensource.com/article/21/3/sensor-data-raspberry-pi

If you have questions or comments related to syslog-ng, do not hesitate to contact us. You can reach us by email or even chat with us. For a list of possibilities, check our GitHub page under the “Community” section at https://github.com/syslog-ng/syslog-ng. On Twitter, I am available as @Pczanik.


a silhouette of a person's head and shoulders, used as a default avatar

packagesの説明文書を訳しつつ、使えるものを探してみました(I編)

前回 は W でしたが、今回は I です。

パッケージ名 i18nspector
バージョン i18nspector-0.26-1.2
結果◎
詳細
.po ファイルのエラーチェックをするプログラムです。.POT なども処理できます。試しに、linux jm project で翻訳しているファイルを処理してみたところ、結構エラーが出ました。

% i18nspector ./jm/jm/manual/util-linux/po4a/man8/lsblk.po
I: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: boilerplate-in-initial-comments 'Copyright (C) YEAR Free Software Foundation, Inc.'
I: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: boilerplate-in-initial-comments 'This file is distributed under the same license as the PACKAGE package.'
I: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: boilerplate-in-initial-comments 'FIRST AUTHOR &lt;EMAIL@ADDRESS&gt;, YEAR.'
P: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: no-language-header-field
I: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: unable-to-determine-language
W: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: boilerplate-in-project-id-version 'PACKAGE VERSION'
W: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: no-report-msgid-bugs-to-header-field
W: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: boilerplate-in-last-translator 'FULL NAME &lt;EMAIL@ADDRESS&gt;'
E: ./jm/jm/manual/util-linux/po4a/man8/lsblk.po: inconsistent-trailing-newlines msgid 'B&lt;lsblk&gt; lists information about all available or the specified block devices.  The B&lt;lsblk&gt; command reads the B&lt;sysfs&gt; filesystem and B&lt;udev db&gt; to gather information. If the udev db is not available or lsblk is compiled without udev support than it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary.'

ちなみにファイルの最初の所は

# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR &lt;EMAIL@ADDRESS&gt;, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-09-20 15:12+0900\n"
"PO-Revision-Date: 2020-10-10 18:04+0900\n"
"Last-Translator: FULL NAME &lt;EMAIL@ADDRESS&gt;\n"
"Language-Team: Linux JM project &lt;linuxjm-discuss@lists.osdn.me&gt;\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

となっているので、言語の指定が無いなどを指摘しています。
Qt の linguist などでもエラー表示を出しますが、マニュアルを見る限りかなり色々なチェックをしているようですので、翻訳終了後にこのプログラムを使って見るのも良いかもしれません。

パッケージ名 icmpinfo
バージョン icmpinfo-1.11-715.11
結果 ◎
詳細
icmp の受信状況を表示するだけのプログラムです。同等のことは tcpdump でも出来ますが、このプログラムはicmp の受信に特化しています。その分簡単に使えて見やすい、という利点はあります。
結果はこんな感じになります。

# icmpinfo -vv
icmpinfo: Icmp monitoring in progress...
Mar  2 11:38:44 ICMP_Echo &lt; 192.168.3.11 sz=2008(+20)
Mar  2 11:38:45 ICMP_Echo &lt; 192.168.3.11 sz=2008(+20)
Mar  2 11:38:46 ICMP_Echo &lt; 192.168.3.11 sz=2008(+20)
Mar  2 11:38:47 ICMP_Echo &lt; 192.168.3.11 sz=2008(+20)
Mar  2 11:38:48 ICMP_Echo &lt; 192.168.3.11 sz=2008(+20)
Mar  2 11:38:50 ICMP_Echo &lt; 192.168.3.11 sz=2008(+20)

パッケージ名 input-pad
バージョン input-pad-1.0.99.20140916-4.6
結果 ○
詳細
画面上に仮想キーボードを表示して、それをマウスでクリックしてテキストベースのアプリケーションに入力するツールです。細かくカテゴリが選べるなど、結構良く出来ています。


起動時にはカスタム文字表示になっていますが、ユニコードでのすべての文字を表示するモードや、キーボードレイアウトを表示することも出来ます。


コードポイントで入力することも出来ます。


ただ、インプットメソッドの一部として提供されているわけではないので、GUIなアプリケーションとのレン回は出来ないようです。ターミナルからinput-pad を起動し、そのターミナルで動作するアプリケーションに入力することになります。ターミナルから GUI なプログラム (たとえば Libre Office)を起動してもそちらには文字を入力できません。ですので、利用範囲は少し限定されてしまうかもしれません。

a silhouette of a person's head and shoulders, used as a default avatar

packagesの説明文書を訳しつつ、使えるものを探してみました(W編)

openSUSE のパッケージを YaST からインストールするとき、そのパッケージの説明が表示されます。ただ、残念ながら、その多くは英文のままです。パッケージの多くは OS インストール時に自動的にインストールされてしまいますので、説明文を読むことはないのですが、後から個別にインストールする場合には、日本語の説明文があるとわかりやすいですね。
そこで、まだ訳されていないパッケージの説明文を訳してみることにしました。
また、訳していると結構おなじみなソフトウェアにお目にかかることもありますが、今まで聞いたことがないような、かつ、何か面白そうなソフトウェアに出くわすこともあります。そこで、そのようなソフトウェアを試しに動かしてみて、使えそうかどうか調べて見ることにしました。

パッケージ名 wkhtmltopdf
バージョン wkhtmltopdf-0.12.6-1.3
結果 △
詳細
これは、html を pdf に変換するためのツールです。が、残念ながらうまく変換してくれませんでした。情報がごっそり落ちてしまいます。

パッケージ名 w3c-markup-validator
バージョン w3c-markup-validator-1.3-10.4
結果 △
詳細
htmlファイルが w3c のマークアップ定義に準拠しているかどうかを調べるソフトウェアです。これは apache2 のcgiとして提供され、perl で書かれています。が、すんなりと動いてくれませんでした。起動時にエラーとなります。これは、
/etc/apach2/conf.d/w3c-markup-validator.conf の46行目に、
Order Deny,Allow と言う記述があり、Apache2.4では非推奨なためです。そのため、
https://www.adminweb.jp/apache/allow/index10.html
にあるように、 access_compat_module の導入が必要となります。
そこで、/etc/apache2/loadmodule.conf に下記の行を追加しました。

LoadModule access_compat_module /usr/lib64/apache2/mod_access_compat.so

が、やっぱりエラーとなります。原因は簡単で、/etc/sysconfig/apache2 の中にロードするモジュール一覧を記述するところがあり、そこに、access_compat という文字列を追加しなければならないのでした。
調べて見ると、まず最初に見るファイル、/etc/apache2/httpd.conf の内容から、openSUSEでは、apache の設定が、機能単位毎にファイルが分かれていることがわかりました。その中に、/etc/sysconfig/apache2 でモジュール設定をすることが書いてありました。動かなかったのはこういうことだったわけです。

次に、データの準備をします。w3c-markup-validation は /srv/www/w3c-markup-validation と言うディレクトリにデータをおいてくれます。今回はサクッとテストするので、これを /srv/www と置き換え(ディレクトリを1つ下げてディレクトリ名を入れ替え)てみました。これでブラウザを使ってアクセスしてみると動きました。

が、テストしてみるとやはり駄目です。

もう少し apache の設定ファイルに調整が必要なようです。
今回は、openSUSE の apacheの設定ファイルが、他のものとはかなり異なっていることが分かったというのが幸いでした。

パッケージ名 watchman
バージョン watchman-4.9.0-5.4
結果 △
詳細
ファイル変更を監視するプログラムらしいです。一応。コマンドを叩いて、サーバモードで動作することまでは動作確認が出来ました。しかし、ドキュメントを軽く読んで限りでは、使い方がよく分かりませんでした。一応試してみた方はいらっしゃるようです。

https://kore1server.com/260/ファイル監視のwatchman

パッケージ名 wcd
バージョン wcd-6.0.3-1.5
結果 ×
norton utility の wcd クローンです。最初にディレクトリをスキャンして、すべてのサブディレクトリを内部的に保持。次回からは、ずっとずっとしたのディレクトリ名を指定すれば一気に cd ができるというもののようです。
パッケージのバイナリは、 /usr/libexec/wcd.exe 。当然のことながら、パスが通ってないので直接指定しないと動きません。オプションで -g を付けると curses ベースのグラフィック表示になります。

ここまではいい感じでした。
が、実際にやってみると cd しないのです。元のまま。というわけで使えませんでした。

パッケージ名 wdiff
バージョン wdiff-1.2.2-6.8
結果 ◎
詳細
単語レベルでの比較をする diff です。たとえば


% wdiff COPYING COPYING2 | head
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, [-1991-] {+2021+} Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this [-license document,-] {+license-documents,+} but changing it is not allowed.

のように、差分を表示してくれます。
英単語では当然のことながらちゃんと動きます。が、やはり日本語での単語切り分けは無理のようです。
….と思ったのですが、なんと、jwdiff という日本語対応の wdiff があったのでした。

https://fumiyas.github.io/2013/12/12/jwdiff.sh-advent-calendar.html

https://github.com/fumiyas/home-commands/blob/master/jwdiff

mecab を使うところがポイントですね。
そのほかに docdiff というのもあるそうです。

https://github.com/hisashim/docdiff

パッケージ名 whohas
バージョン whohas-0.29.1-1.10
結果 ◎
詳細
これは、あるパッケージが、複数のディストリビューションに含まれているかを調べるコマンドです。たとえば、このコマンド自身を検索すると

Couldn't fetch "http://dl.fedoraproject.org/pub/fedora/linux/releases/26/Everything/x86_64/os/Packages/w/". Giving up.
AUR 0.29.1-1 5 http://aur.archlinux.org 0.29.1-1
Ubuntu whohas 0.29.1-1 179K all http://packages.ubuntu.com/xenial/whohas
Ubuntu whohas 0.29.1-1 179K all http://packages.ubuntu.com/bionic/whohas
Ubuntu whohas 0.29.1-1 179K all http://packages.ubuntu.com/focal/whohas
Ubuntu whohas 0.29.1-1 179K all http://packages.ubuntu.com/groovy/whohas
Ubuntu whohas 0.29.1-1.1 179K all http://packages.ubuntu.com/hirsute/whohas
NetBSD whohas 0.29.1nb2 192K 2020-09-01 misc https://pkgsrc.se/misc/whohas
Couldn't fetch "http://ftp.openbsd.org/pub/OpenBSD/6.0/packages/i386/". Giving up.
Source Mage whohas 0.29.1 test
Source Mage whohas 0.29 stable
Debian whohas 0.29-0.3 189K all http://packages.debian.org/jessie/whohas
Debian whohas 0.29.1-1 180K all http://packages.debian.org/stretch/whohas
Debian whohas 0.29.1-1 180K all http://packages.debian.org/buster/whohas
Debian whohas 0.29.1-1.1 180K all http://packages.debian.org/bullseye/whohas
Debian whohas 0.29.1-1.1 180K all http://packages.debian.org/sid/whohas

という感じで表示されます。検索は、各ディストリビューションの検索サイトを使って行い、その結果を表示するということをやっています。そのため、似たようなパッケージなども表示されるときがあります。複数のバージョンが表示されるときもあります。
対象となるディストリビューションはArch, Debian, Fedora, Gentoo, Mandriva, openSUSE, Slackware (と linuxpackages.net), Source Mage, Ubuntu, FreeBSD, NetBSD, OpenBSD, Fink, MacPorts, Cygwin and OpenMoko です。ただ、openSUSE については、うまく検索ができないようです。ソースコードが期待している結果が返ってきてないのかもしれません。
あるパッケージの移植状況などを調べるときには重宝しそうです。

パッケージ名 wmutils
バージョン wmutils-1.4-1.9
結果 ◎
詳細
X のウィンドウに対して情報を得たり種々の操作をするコマンドラインツールです。たとえば、現在のウィンドウのサイズを調べるには、pfw コマンドを使ってウィンドウの ID を取得し、wattr コマンドでサイズを取得します。

以下の機能が用意されています。

  • chwb - change window's border
  • chwso - change window's stacking order
  • ignw - ignore/unignore window
  • killw - kill windows
  • lsw - list windows
  • mapw - map/unmap windows
  • pfw - print focused window
  • wattr - show window's attributes
  • wmp - move the mouse pointer
  • wmv - move a window
  • wm_wtf - focus a window
  • wrs - resize a window
  • wtp - teleport a window

スクリプトなどでウィンドウの制御をするときには便利に使えそうです。

a silhouette of a person's head and shoulders, used as a default avatar

Actualización de las aplicaciones de KDE de marzo de 2021

Me complace anunciar, un poco tarde, la actualización de las aplicaciones de KDE de marzo de 2021, una actualización que no nos ofrece novedades, simplemente soluciona errores y mejora traducciones, que tampoco está mal.

Actualización de las aplicaciones de KDE de marzo de 2021

Es complicado llevar al unísono todo el ecosistema que representa el proyecto KDE. No obstante creo que la Comunidad lo lleva bastante bien al dividir su trabajo en tres ramas diferenciadas: entorno de desarrollo KDE Frameworks, escritorio Plasma y aplicaciones KDE.

Actualización de las aplicaciones de KDE de marzo de 2021
El ritmo de lanzamiento del Proyecto KDE se merece una agenda para él solo.

Esta estructura de trabajo parece funcionar bastante bien desde hace mucho tiempo (concretamente desde el lanzamiento de Plasma 5) siendo la última rama de ellas, el de las aplicaciones KDE, la que más problemas puede dar ya que es complicado que todas los programas sigan el mismo ritmo de desarrollo. No obstante hay que destacar que la mayor parte de ellas siguen el paso que se espera de ellas.

De esta forma, mes a mes los desarrolladores lanzan una gran actualización de sus aplicaciones, os animo a seguir la de noviembre o meses anteriores para poder ver esta evolución constante.

Actualización de las aplicaciones de KDE de marzo de 2021
Decenas de aplicaciones pueblan el ecosistema del Proyecto KDE.

Hay que destacar que, a diferencia de meses anteriores, las actualizaciones destacadas de KDE de este marzo 2021 solo incluyen la tarea de corrección de errores realizada, la cual podéis consultar de forma completa en este enlace.

Más información: KDE

a silhouette of a person's head and shoulders, used as a default avatar

#openSUSE Tumbleweed revisión de la semana 10 de 2021

Tumbleweed es una distribución “Rolling Release” de actualización contínua. Aquí puedes estar al tanto de las últimas novedades.

Tumbleweed

openSUSE Tumbleweed es la versión “rolling release” o de actualización continua de la distribución de GNU/Linux openSUSE.

Hagamos un repaso a las novedades que han llegado hasta los repositorios estas semanas.

El anuncio original lo puedes leer en el blog de Dominique Leuenberger, publicado bajo licencia CC-by-sa, en este enlace:

Esta semana finalmente han llegado unas soluciones a problemas para glibc/i586 que habían surgido hace un tiempo. Desafortunadamente también para quienes usan x86_64, esto significa que una vez más es necesario recompilar toda la distribución (como ya sucedió con la snapshot 0311). Pero las 4 snapshots publicadas durante esta semana (0305, 0306, 0307 y 0311) también incluyen muchas otras cosas interesantes para todo el mundo.

Los cambios más importantes que han traído estas snapshots son:

  • glibc
  • Linux kernel 5.11.2 y 5.11.4
  • gnutls 3.7.0
  • openssl 1.1.1j
  • Libvirt 7.1.0
  • KDE Applications 20.12.3
  • KDE Plasma 5.21.2
  • LibreOffice 7.1.1.2

Esto es casi todo lo que salía en el listado de la semana anterior en lo que estaba previsto. Solo GCC 11 queda como tarea pendiente. Pero las cosas no se paran aquí, y todavía hay más actualizaciones pendientes de llegar a los repositorios, por ejemplo:

  • Linux kernel 5.11.6
  • Python 3.9 módulos para esta versión: Python 3.8 seguirá siendo el predeterminado por ahora.
  • GCC 11 como compilador predeterminado.

Si quieres estar a la última con software actualizado y probado utiliza openSUSE Tumbleweed la opción rolling release de la distribución de GNU/Linux openSUSE.

Mantente actualizado y ya sabes: Have a lot of fun!!

Enlaces de interés

Geeko_ascii

——————————–

the avatar of Nathan Wolf
a silhouette of a person's head and shoulders, used as a default avatar

openSUSE Tumbleweed – Review of the week 2021/10

Dear Tumbleweed users and hackers,

This week, we were finally getting some fixes together for the glibc/i586 issues that plagued us for a while. Unfortunately, also for the x86_64 users, this meant once again a full rebuild of the distribution (which was published just recently with snapshot 0311). But the 4 snapshots published during this week (0305, 0306, 0307, and 0311) also had something for everybody anyway.

The main changes in those 4 snapshots include:

  • glibc: Disable x86 ISA level for now
  • Linux kernel 5.11.2 & 5.11.4
  • gnutls 3.7.0
  • openssl 1.1.1j, based on a centralized crypto-policy package
  • Libvirt 7.1.0
  • KDE Applications 20.12.3
  • KDE Plasma 5.21.2
  • LibreOffice 7.1.1.2

That actually almost is everything I had listed last week as coming soon. Only GCC 11 as the default compiler remained, and that one is still going to be with us for a few weeks. But things did not stop there, and the stagings are already filled with other things again:

  • Linux kernel 5.11.6
  • Python 3.9 modules: besides python36-FOO and python38-FOO, we are testing to also shop python39-FOO modules; we already have the interpreter after all. Python 3.8 will remain the default for now.
  • UsrMerge is gaining some traction again, thanks to Ludwig for pushing for it
  • GCC 11 as default compiler
a silhouette of a person's head and shoulders, used as a default avatar

Richard M. Stallman presentará la reedición en español del libro «Software Libre para una Sociedad Libre» en la 1ª Edición de la Cumbre Software Libre y Educación

Esta semana se va a celebrar la 1ª Cumbre Software Libre y Educación y este blog está promocionándolo al máximo (supongo que tanto que los lectores estarán desertando). Hoy toca comentar que Richard M. Stallman presentará la reedición en español del libro «Software Libre para una Sociedad Libre» en la 1ª Edición de la Cumbre Software Libre y Educación. Una oportunidad única para conocer a fondo esta obra fundamental del conocimiento libre.

Richard M. Stallman presentará la reedición en español del libro «Software Libre para una Sociedad Libre» en la 1ª Edición de la Cumbre Software Libre y Educación

Ya he hablado de la Conferencia «La era de la digitalización en las aulas» de Javier Sepúlveda, de la mesa redonda «Software Libre y Educación en la Comunitat Valenciana» con Richard M. Stallman y la Conferencia «El Software Libre, la Libertad y la Educación» que realizará Richard M. Stallman el próximo domingo a las 17.00 horas.

Solo me queda comentar que con motivo de la presencia de Richard M. Stallman en los actos de la 1ª Cumbre Software Libre y Educación, por fin se puede hacer la presentación del libro, que fue aplazada en marzo de 2020 debido a la pandemia el próximo domingo a las 18:45 horas CET.

Richard M. Stallman presentará la reedición en español del libro «Software Libre para una Sociedad Libre» en la 1ª Edición de la Cumbre Software Libre y Educación

Según podemos leer en el anuncio de la asociación el año pasado se solicitó en una nueva reimpresión del libro de Richard Stallman «SOFTWARE LIBRE PARA UNA SOCIEDAD LIBRE». Esta fue la primera reimpresión desde el año 2004, de esta traducción al castellano del libro original «Free software Free Society«. La editorial Traficantes de Sueños  tuvo la cortesía de realizarnos una impresión especial de tirada aquella para la serie de conferencias de Richard Stallman que programaron y tuvieron que suspender por la pandemia del Covid-19.

Los precios del libro son:

Precio en mano (cuando sea posible) 10€

Con envío por correo ordinario 14€

Con envío por correo certificado 17€

¡¡¡Solo se cuenta con 150 ejemplares!!! ¡¡Daos prisa!!

Y para finalizar, os pongo el vídeo del presidente de GNU/Linux València promocionando el evento.

1ª Edición de la Cumbre Software Libre y Educación

Este viernes empieza la 1ª Edición de la Cumbre Software Libre y Educación organizando la Asociación de Software Libre GNU/Linux València y Las Naves es altamente recomendable para todos y todas ya que contará con

Además, cuenta con un invitado de máximo nivel: Richard M. Stallman, fundador del movimiento del software libre, del sistema operativo GNU, de la Free Software Foundation (Fundación para el Software Libre) y defensor acérrimo de la Cultura Libre.

Cumbre Software Libre y Educación, 1ª Edición

Más información: GNU/Linux València