Friday, April 23, 2021

Is the United States really capable of convincing the rest of the world to cut carbon dioxide emissions?


The Biden administration's target of cutting U.S. carbon dioxide emissions to 50-52% that of its 2005 level by 2030 sounds ambitious. But will it really convince other countries to reduce their emissions?

Carbon dioxide is a by-product of human activity, and the United States likes to draw attention to total emissions as a country. This is because the amount of carbon dioxide emitted by each country is the sum of the carbon footprint of every person in its population. In general, countries with large populations end up emitting more carbon dioxide than those with smaller populations, if they are engaged in the same level of human activity.

 
Using total emissions at the country level thus allows the United States to call on countries like China to reduce their carbon dioxide emissions. China as a country emits about twice as much carbon dioxide as the United States. If the United States halves its emissions, it will be emitting a quarter of which China is emitting.

The caveat, though, is that China has more than four times the population of the United States.

Population by country (Source: World Bank)
 
So when you look at the carbon footprint (per capita carbon dioxide emissions) of each person in the United States versus a person in China, you see that the carbon footprint of a person in China is actually less than half that of someone in the United States. If the United States reduces its emissions by 50%, it won't even be on par, at the per capita level, with China.
 
So while it sounds like the United States is setting an example in environmental consciousness, it still falls short of where China is right now. For the United States to really be convincing in taking the lead on climate change, it will need to do better. It will need to reduce its per capita carbon dioxide emissions to below those of other major developing and developed countries. Otherwise, it is just conveniently choosing the statistics that suits its purpose while ignoring those that don't.

Thursday, April 15, 2021

Flutter, Python, and which to use for what

Recently, I have started learning how to program user interfaces in Flutter (which is based on the Dart language). It is different from other programming languages and GUI frameworks which I have used in the past. In this post, I am going to talk a bit about my thoughts on Flutter/Dart and Python (with frameworks like PySimpleGUI and Kivy).

A bit of background. I am new to Flutter and Dart. I have been using Python for several years (since 2016) with some experience in the GUI frameworks wxPython, Kivy and PySimpleGUI. I have also done programming in Java before (back in the early 2000s, as well as in recent years). I have tried to learn wxWidgets in C++. In the 1990s, I have used C to program text-based applications and for micromouse. I learnt Turbo Pascal in school, and before that, I picked up C on my own, and even before that, I have programmed in GW-BASIC and Quick BASIC. When I was working in data science, I picked up R too.
 
I like Python for its ease of use. It is a high level programming language with a lot of libraries that can make life very easy for the programmer. You can probably find a library that does what you want to do without having to do everything from scratch. And it is easy to use these libraries too, since they are usually available via a central repository. Flutter/Dart also has a good central repository of packages too, and the selection covers a broad scope. But still, compared to Python, Flutter/Dart does not have that extensive a selection.
 
This makes Python very attractive when I need a quick solution. Find the libraries I need, piece them together to achieve the solution I want, and voila! While Kivy is not an easy GUI framework to use, PySimpleGUI allows me to easily clobber together a GUI for the underlying application. And if I am doing something related to data science, Python is really convenient because many of the needed data manipulations are available in easy-to-use libraries.

The issue is deployment. I have written about two methods: using PyInstaller, and using Cython. (These are for deployment to Windows, which is still what the majority of consumers use.) While both methods are not exactly rocket science, it still requires some effort on the programmer to write configuration files (for PyInstaller) or figure out which are the DLLs you need if using Cython.
 
Flutter makes deployment much easier. There is still the need to edit the build configurations, but I find it to be much less complicated (okay, this is subjective). You can easily package for Linux using snapcraft. Packaging on Windows is easy if you use Inno Setup. And packaging for Android is easy too, just use flutter build android. And Flutter's UI consistency across different platforms makes it truly attractive when building cross-platform applications. Kivy tries to achieve the same for Python, but I found it hard to change the default Kivy theme.

In summary, I prefer Python when I need something to be done without having to worry about deployment. So I use Python when I am working on applications that I intend for my own personal use. For applications that will likely be useful to more people, I intend to use Flutter/Dart going forward due to its consistency cross-platform look and well-documented steps for platform deployment.

----------------
Side note: I continue to use C/C++ for microcontroller programming since that is usually the language that most microcontrollers' frameworks support. MicroPython is up and coming too. Given that Python and Flutter/Dart both can run on different platforms, I no longer find Java, which I once preferred for its cross-platform features, attractive. I still have fond memories of BASIC but that is more for nostalgia than practical use. I was never fond of Pascal and only used it because school assignments required me to do so. I haven't touched R ever since I left my full-time data science job.

Tuesday, April 13, 2021

A trip to Tsuchiura, hometown of Miura Haruma

A few days ago, the family being fans of Miura Haruma (三浦春馬), some more, some less, we took a trip to Tsuchiura, the town where he was born and raised. Given the current pandemic, we decided not to take the train and risk having to go through the crowds of Tokyo. Instead, we drove ourselves to Tsuchiura, which took slightly more than 2 hours each way.

The main purpose of the trip was to catch a movie at Tsuchiura Central Cinemas (土浦セントラルシネマズ; official Twitter account here).
 
As the local cinema of his birthplace, the cinema has been showing Mori no Gakkou (森の学校) and Tengaramon (天外者), the first and last movies where he played the leading roles.


The cinema is practically a shrine to Miura Haruma, where fans can leave messages.
 
After filling up one wall, messages are being left on another wall.

There is also a small exhibition area where the cinema's owner puts up items related to Miura Haruma, like behind-the-scenes photos. The exhibits on display are rotated from time to time.

We were a bit early for the next show, so we decided to grab a quick lunch nearby. We walked through MALL505 (モール505) and only realized that this was where Miura Haruma's mother used to run a shop. After a ramen lunch, we headed back to the cinema.

This time, we watched Tengaramon. It was my second time catching this movie. At the end of the movie, the cinema's owner went to the front and talked to the audience about his impression of Miura Haruma, who participated in movie launch events at this cinema. The first was for Mori no Gakkou, when he was still a boy. Several years later, he was back for another movie launch event. The owner said he was very impressed by this well-mannered young man. I think we all mourn his early departure.

After the movie, we went to take a look at Manabe Elementary School and Tsuchiura Second Junior High School. These were the schools that Miura Haruma attended. They are still being used today, so while we took some photos from outside the schools, I won't be posting them here.

By then, it was getting a bit late. We dropped by a nearby Starbucks for some coffee before embarking on the two-hour drive home.

It was a long day and I was a bit tired from the drive, but I think it was a fruitful trip. Miura Haruma was really a good actor, and his portrayal of characters with a melancholic side was especially impressive. He had an extremely wide repertoire of expressions which brought to life the characters he portrayed. Every time he appears on screen, I feel that he steals the attention of viewers with his presence. Which makes it all the more sad to know that we will never be able to see any more new portrayals by him, since he passed away on Jul 18, 2020. I think our visit this time happened to be 100 days before the first anniversary of his death.

Anyway, the cinema's owner said he will be showing Miura Haruma's films for the time being. So fans who wish to see him can always drop by Tsuchiura Central Cinemas. I think we will be back again.

Side note: Tsuchiura Central Cinemas was also the venue for events which featured the directors of Mori no Gakkou and Tengaramon who made their way down there for Miura Haruma's birthday on April 5. The string of events took place from April 4 to 6, 2021.

Sunday, April 11, 2021

Two-way poem by Li Yu from the Song Dynasty 李禺《兩相思》 (《思妻詩》《​思夫詩》)

李禺《兩相思》
 
正讀《思妻詩》:
枯眼望遙山隔水,往來曾見幾心知?
壺空怕酌一杯酒,筆下難成和韻詩。
途路陽人離別久,訊音無雁寄回遲。
孤燈夜守長寥寂,夫憶妻兮父憶兒。
 
倒讀為《思夫詩》:
兒憶父兮妻憶夫,寂寥長守夜燈孤。
遲回寄雁無音訊,久別離人陽路途。
詩韻和成難下筆,酒杯一酌怕空壺。
知心幾見曾往來,水隔山遙望眼枯




Thursday, April 08, 2021

Anime-original or stay true to the source?

Many anime works are based on manga, light novels, or some other form of source material. For example, Sword Art Online, Violet Evergarden, and Mushoku Tensei are based on a light novel. The Quintessential Quintuplets, The Promised Neverland, Horimiya, and Demon Slayer are based on manga. Being published before the anime adaptation, these source materials usually have their own fan base. Any deviation from the source materials will be noticed by those who have read the source materials before.

Producers of anime adaptations are thus faced with the options of staying true to the source material, or developing anime-original content. In this post, I shall explore four examples. A disclaimer: I have only read the source materials for three of them (Violet Evergarden, The Quintessential Quintuplets, and Horimiya) so my comments on The Promised Neverland are more based on online reviews by those how have read the source material and watched the anime.
 
Let me start with Horimiya. Horimiya is a manga that is based on a web comic called Hori-san and Miyamura-kun. As of now, the manga series just ended, with 15 volumes already published and the 16th (and final) volume should be out sometime soon. The anime adaptation runs a single season with 13 episodes, which is really short for a 16-volume manga. Usually, a single season can adapt about four volumes, so you can imagine the amount of stuff that was cut to squeeze everything within 13 episodes.
 
But Horimiya is a slice-of-life manga with a strong romance theme. It is really a collection of small episodes, which actually makes it easy for the anime producers to choose which episodes they want to make into anime. The manga actually covers stories about more characters, but by focusing on a handful of core characters and their stories, the anime was able to string together a series of stories that flowed chronologically without having to do much, if any, anime-original changes.
 
In contrast, Violet Evergarden is a light novel, and when it was being adapted into anime, there were only two volumes and the source material just did not have enough content for a 13-episode season. The light novel also started with the characters already established, and readers slowly discover the background as they read the book. This can make it difficult for anime viewers to understand. This was one of the reasons for making anime-original content for this series. The anime brought one of the background stories to the start, threw in a couple of anime-original characters to help build the background, but otherwise stayed true to those stories which it adapted (except for the ending).
 
The ending was probably rewritten because they wanted to make a sequel movie for the reunion between Violet and Gilbert. So we ended up with an anime-original twist to the "train hijack" story which was the reunion (and final story of the original two-volume light novel), turning it into an "open" ending allowing for a sequel. The final reunion in the sequel movie actually reused a lot of the light novel's dialogue, just in a different setting. Fans of the light novel (including the anime director himself) would say that the light novel was great as it is. But I think that the anime-original content and changes help to make the anime as strong a story as the light novel. Each is great in its own way, and the anime ultimately remained true to the core themes, concepts, and style of the source material.

The Quintessential Quintuplets started out as a faithful adaptation of the manga series during its first season, but the second season was a lot more ambitious. The first season covered four volumes; the second season covered six. Many scenes were actually cut in the second season in order to bring the season's conclusion at the end of the school trip. And we know that the sequel (either a third season or a movie) will adapt the final four volumes to conclude the entire series.
 
Like Horimiya, this series has no lack of source material. But what it has is time. With two seasons plus a final season/movie, it can adapt a lot more material. But unlike Horimiya, the stories in The Quintessential Quintuplets are not standalone episodes but more intertwined with each other. Yes, there are occasionally some short side-episodes with no real impact on the story's final outcome. But most of the manga is about the core story. So the second season became quite a hectic rush as it tried to adapt too much of the story in a short period of time, removing every side-episode not fully related to the core story, and even some of those episodes that are. But the anime series has not ended yet, so those related episodes that were cut may still end up being adapted in the final season/movie as a flashback.

As for The Promised Neverland, the reaction of people who have read the manga says it all. The manga has quite a few story arcs, and with the first arc taken an entire season to adapt, this manga series can be a long-running anime adaptation. Except that the people in higher management probably thought otherwise, and the anime was made to end with the second season. Entire arcs were skipped, or compressed in what can best be described as a series of PowerPoint slides. I don't think we can even use the concept of anime-original here.
 
Back to the topic of this post, which is about anime-original versus staying true to the source. I think the real question is, does it make the anime story as good or better than the source? If so, I don't really see any issue with make changes to the source as part of the anime adaptation process. 

In fact, anime, like light novels and manga, is a medium. What works for one medium may not work for another. Anime and manga are close enough that it is easy to have a faithful anime adaptation of a manga. But even then, manga allows the same episode to be told from the perspectives of several characters. For example, the final exam episode of The Quintessential Quintuplets could be told from each quintuplet's view. But this can be confusing and even onerous in anime, which is why a chronological telling of that same episode combining all five quintuplets' perspectives worked better for anime.

Light novels are less straightforward for anime adaptations, since they have less visual source materials to start with. Not having a visual element can limit the expressiveness of a story, but it can also free up that limitations since the author can play on the readers' imagination. A lot more work needs to be done for anime adaptation since anime is a visual media, while novels are word-based. Part of this work may entail making anime-original changes or additions to better adapt the source into a visual form. Like those for Violet Evergarden.

So when I see anime-original changes/additions in an anime adaptation of a light novel, I tend to be more forgiving and accepting as long as it makes the anime a better story. As for anime adaptations of manga, I think the question I still ask is, does it make the anime a better story? If so, I think we can always view it as an alternative route.

Bottom line: if it makes the anime adaptation a better story (compared to not making the changes/additions, and not compared to the source material), I think we should accept those changes/additions since anime is a different medium.

AI development and what it means for our future: Prologue

Originally, I had wanted to write about the implications that AI development has on the future of humankind, specifically in the areas of self-driving cars and language learning. For example, the development in machine translation has led to something like this.


But after giving it some thought, a single article is unlikely to capture the entire scope of implications. I myself don't think, as a single person, I can cover that entire scope, but the ideas I have already seem to overflow beyond a single article. So I am going to take more time to consolidate my thoughts, and spend more time on each idea by having each post cover only one idea.

Personally, I have no idea how long this series will last, but I am going to tag all posts in the series with "AI and the future" and we shall see how it goes.

Update 18 July 2022: An article on AI development and its implications


Wednesday, April 07, 2021

Violet Evergarden the Movie: Blu-ray/DVD announced

Just a quick post because I am so excited! KyoAni just announced that the Blu-ray and DVD for Violet Evergarden the Movie will be released on August 4, 2021. The Blu-ray will come in two versions: a normal one, and a UHD one which has the Dolby Vision® & Dolby Atmos® version that was shown in Dolby Cinemas.

Here is the official page.
It will come with its special case, all-colour booklet, two letters from Violet Evergarden (in Tellsis and Japanese), a set of storyboard drafts by Director Ishidate, the illustrations used on the four booklets handed out, and a card printed with the movie's poster.

Also, depending on the retailer you choose, there will be some other promotional items.

Here is the Twitter post.

I can't wait!
 
Update: The release of the DVD and Blu-ray has been delayed till October 13, 2021, due to overwhelming orders plus the issues with production under the state of emergency (because of COVID-19).

Sunday, April 04, 2021

Saturday, April 03, 2021

Tellsis language ("Nunkish") translator with Flutter UI


Update February 20, 2023:
Great news! The Tellsis translator app is now available through Flathub (link to Github packaging repo; this is not the actual app). More details in the main post below.
Update February 19, 2023:
I finally managed to package this app as a Flatpak bundle. It has been uploaded to the release page and instructions for installation have also been added. I am also applying for the app to be hosted on flathub.org and once that is approved, it will be much easier to install the app.
Update October 1, 2022:
Released version 0.2.1 today. The main change is to use SelectableText for the output so that it can be copied and pasted elsewhere. I also did a refresh install of Ubuntu MATE 22.04 and it works on that, so I guess there was something wrong with my previous install.
Update September 3, 2022:
Released version 0.2.0 today. Changed to version 0.2.0 since the use of dropdown_search, which required some code changes. Main fix was to rectify the poor handling of backslashes used to denote names. Sometimes, the names would not be properly replaced during the translation process, ending in "XXX1" "XXX2" being shown. Now it works.

 
Update (2) September 1, 2022:
Wow! Two updates in a day. Anyway, version 0.1.6 has been released. The major change is to replace flutter_form_builder with dropdown_search.
 
Update (1) September 1, 2022:
Version 0.1.5 released. Click here for Windows 10 installer and here for Android APK. For Linux users, it is available through snap. I was able to run it on Linux Mint 21 but not Ubuntu MATE 22.04. Main changes are to update the libraries used to the latest versions and add null checks and such due to null safety in Flutter.
 
Update July 9, 2021:
I have also created an account on Snapcraft, and Linux users should eventually be able to install it by
sudo snap install telsis-translator-flutter
on the command line. It seems to work on the snap that I previously built locally for amd64 architecture, but I have yet to figure out how to configure autobuild to work (it keeps failing).
Next is to add OCR capabilities, probably with the tesseract_ocr package, if I can figure out how to train it to recognise a custom font...
 
Update April 4, 2021: Binaries for Linux, Windows, and Android are available here.

I previously made a Python 3 script that translates to and from the Tellsis language (aka Nunkish), the language used in the Violet Evergarden world. I wanted to learn to create Android apps (I have done it previously in Java and Kivy, but I wanted to try something else), so I decided to learn how to program using the Flutter framework, which means I have to learn the Dart programming language. As part of learning Dart and Flutter programming, I decided to port my Tellsis language translator from Python 3 to Dart, then create a Flutter UI.

Using my spare time, I have finally managed to come up with a working version.

The advantage of using Flutter is that it is cross-platform. I can write the same code, and it will run on Linux, Windows, MacOS, Android, and iOS. Of course, I don't own an iPhone or iMac, so I can't test if the application works on those platforms, but so far, I have gotten the app to work on Linux and Android (my Samsung Galaxy S7).

Here is how it looks in Linux Mint 20.1. (Update 28 August 2023: I just found official sources that state "Tellsis" and have made changes to the text used in this blog from "Tellsis" to "Tellsis" but the software will not be updated as it may impact others who have already downloaded the software.)


And here is version 0.2.0 on Linux Mint 21.

 
And here is an example of it running in an Android phone (Samsung Galaxy S7) and Android emulator.
 

I have built them into binaries (as a snap package for Linux, and APK for Android) which can be downloaded here. The source code can be found in the Github repository given below. This app is just for demonstration and learning. It is not for commercial use.


The repo has instructions on building the source code as well as how to install the binary releases.

By the way, my review of the 2020 Violet Evergarden movie (VIOLET EVERGARDEN the Movie) can be found here.
 
Github repo: telsis_translator
 
All posts related to Violet Evergarden.

Okay, for more information about the programming part. I am quite new to Dart, so the code may not be written in the most "Dart-like" manner, such as expressions and coding conventions. For the main input form, I used the package "flutter_form_builder" which provides many readymade input widgets. The problem is that, being readymade, it is harder to customize without reading the source code. For example, I use a searchable dropdown menu for selecting the source and target languages. Right now, after tapping on the button, the user needs to tap again in the text field to type in the language. I really hope to be able to switch the input context to the text field when those buttons are tapped/clicked.
 
"flutter_launcher_icons" was used to create the icons for Android, using the previous icon from the Python 3 version. It was relatively easy; just following the instructions for the package.
 
I also had quite a hard time packaging the app for Android. If you leave everything as the default, it should be easy. But I tried to use my own Android package name, and the app would refuse to build (because I forgot to make sure that the package name was the same in the AndroidManifest.xml file for both debug and main folders) or launch (because the package name was not correctly reflected in the MainActivity.kt file). But I finally managed to iron all that stuff out.

Packaging for Linux (creating a snap package) was a bit problematic too. In the end, I settled on a workflow of snapcraft clean telsis-translator-flutter and snapcraft build. (Note: Will try to package as flatpak and publish on Flathub, see "To do" at end of post.)


Update April 4, 2021: Packaged for Windows using Inno Setup, which creates a self-extracting installer that will copy the required files into the "Program Files" directory and add a menu entry.
At first, I tried using the msix package as mentioned here, but it requires a signed certificate to create the installer, and the end user will also need to install that certificate on his or her computer in order to install the app. This was really a lot more hassle than what I expect most people want to go through. Still, I spent a couple of hours learning how to go about signing my own certificate and packaging a MSIX installer.
 
In the end, I just went with the "Building your own zip file for Windows" option to gather all the required files (after building for Windows using flutter build windows) and then Inno Setup to create an installer. There is no need to deal with certificates. The installer just works.

As of now, Flutter does not have a good way to set the title of the window on desktop systems (like Linux and Windows). There is a plugin that allows this, and a Stackoverflow issue and this article that gives a simple example on how to use the plugin. I thought about using this plugin but it seems that this functionality will eventually be added to the Flutter framework itself. So I guess, in the meantime, for hobby projects, I would just live without a fancy window title.

Get it from the Snap Store 

Note: Autobuild for arm64 architecture seems to be available, and you can try installing it by:
sudo snap install telsis-translator-flutter --channel=latest/edge
For amd64 platforms,
sudo snap install telsis-translator-flutter
should get you the latest stable release.
 
To do:
- Package as flatpak for Flathub using the following as example (DONE!):
 
Get the Tellsis translator app from Flathub here!
Or install it from the command line using the following command.
flatpak install flathub com.maplerain.telsis_translator_flutter

The app should also show up on Linux software manager apps that are integrated with Snap Store or Flathub, such as the one found in Linux Mint.

Related links
My overall thoughts on Violet Evergarden The Movie

Events:
 
Translations of short stories:
Gilbert Bougainvillea and the Fleeting Dream (unofficial translation of "ギルベルト・ブーゲンビリアと儚い夢")
The Starry Night and the Lonely Two (unofficial translation of 星降りの夜とさみしいふたり)
Diethard Bougainvillea's If (unofficial translation of ディートフリート・ブーゲンビリアIf) 
The Tailor and the Auto-Memories Doll (unofficial translation of 仕立て屋と自動手記人形)
 
Tellsis (Nunkish) translation:
Last line of Violet's final letter to Gilbert
 
Insights on the movie:
 
Audio commentary notes:


 
All posts related to Violet Evergarden.

Friday, April 02, 2021

Lotte and Aeon collaborate to give out Violet Evergarden the Movie A4 clear files

Seems like there are more Violet Evergarden gifts in the collaboration between Lotte and Aeon.

A few weeks ago, it was A5 notebooks.

Then, about 2 weeks back, it was A4 clear files. First, these two designs.


Then, this design came out a week ago.



The promotion is the same. Buy any 3 Lotte products from Aeon supermarket, and you get one promotion item free.

I need to visit Aeon more often...