Showing posts with label macOS. Show all posts
Showing posts with label macOS. Show all posts

Thursday, July 11, 2024

Easy Install Docker On Debian 64 bit

Easy Install Docker On Debian 64 bit

This is using command line.

Easy way (Debian)

I found an easy way to install Docker on Debian 64 bit (arm64 and amd64). I just tested on Debian 12 Bookworm, didn't try on Arm platform. If you fail, may be Docker didn't provide the binary of your platform, for example Debian 32 bit.

$ apt update
$ apt upgrade
## need curl and apt-utils
$ curl -fsSL test.docker.com -o get-docker.sh && sh get-docker.sh
$ docker -v
⇒ version 27

Test Docker
$ sudo docker run hello-world ## docker need root
⇒ Hello from Docker!
If you see the Hello message, it is working.

macOS (Homebrew + Docker Desktop)

Homebrew only install the docker (client), you need a Docker daemon). Docker Desktop can start the Docker daemon. Docker Desktop is available for download, available in macOS, Windows and Linux platform.

$ brew install docker docker-compose
$ sudo docker run hello-world ## to test

You can use Colima (lima) + qemu to replace the Docker Desktop, it works.

Wednesday, July 01, 2020

macOS Switch Input Method With Splash Display

macOS Switch Input Method With Splash Display



This has been bodering me for awhile after I upgraded to macOS Mojave 10.14. The splash display to show different input method is not there anymore.

I like the the splash display to show all the input methods at the center of the display, is large and clear. I don't have to move my eyes to see which input method that I am using now on the menubar, and I can switch between English and Chinese input method easily.

I keep thinking it was a feature included in the third party Chinese Input method that I installed previously, but I can't remember what is the name of the Chinese Input software. Finally I found it, it is Open Vanilla (https://openvanilla.org).

I am still unable to get the splash display to change the input method, even after I installed the Open Vanilla.

Seems like the feature is not from the Open Vanilla. Just enable "Select the previous input source" from Keyboard Shortcut:

macOS > System Preferences > Keyboard > Shortcuts (tab) > Input Sources > (x) "Select the previous input source"


Not I can switch between English and Chinese Input easily.

Wednesday, June 03, 2020

Add to iTunes as Spoken Track (OSStatus error -1743.)

Add to iTunes as Spoken Track (OSStatus error -1743.)




Add spoken track to iTunes (macOS Mojave)


macOS text to speech


You can highlight a text in macOS application (eg. Safari, Text Edit), convert the text to audio and add it to iTunes:

Safari > Services > Add to iTunes as a Spoken Track
or
Right click > Services > Add to iTunes as a Spoken Track

If you don't get the services, enable it in System Preferences:



Enable add to iTunes as a Spoken Track

System Preferences > Keyboard > Shortcuts > Services > Text (x) Add to iTunes as a Spoken Track

“Import Audio Files” error: (OSStatus error -1743.)


I am getting an error, every time I try to convert the text to speech in preview application:

The action “Import Audio Files” encountered an error: “The operation couldn’t be completed. (OSStatus error -1743.)”

I know why I am getting this, because I choose "Don't Allow" when I choose text to iTunes audio track when I first use the function.



I choose "Don't Allow", but I want to change it later.

Now I want to use the text to iTunes audio track, I need to enable it. It takes me some time to get it back. It is here:



Allow Preview application to access iTunes

System Preferences > Security & Privacy > Privacy tab > Automation > Preview (x) iTunes.

Now I can add audio track to iTunes from Preview application, without the error.

Wednesday, May 27, 2020

Compile libgrowl Java 2020

Compile libgrowl Java version




Introduction


Notification is an important software system.

libgrowl is a Java library to send notifications to Growl, there is a C implement libgrowl as well. libgrowl is an open source library.

If you do not have a Growl installed, you can install Growl for Windows, Growl 1.3.x for Mac OS. Growl 2.x is not free anymore, it was selling USD3.99 on macOS App Store.(Is now available free on App Store again). If you don't want to pay for it, you can install the binary from third party (check here), or try to compile one for yourself.

Refer to this blog to download the pre-compile binary http://blogs.umb.edu/michaelbazzinott001/2014/09/21/growl/

libgrowl on Sourceforge and Github


libgrowl sends notification to Growl through network connection, the GNTP network protocol. libgrowl was first hosted on sourceforge.net (by bananewazen) https://sourceforge.net/projects/libgrowl/, later it was mirrored to different Github repositories.

https://github.com/feilimb/libgrowl some said this is the original mirror.
https://github.com/sbower/libgrowl this was modified with maven build.

To compile the libgrowl is a very good practice for Java beginners.

Compile


libgrowl (feilimb)



$ git clone https://github.com/feilimb/libgrowl
$ tree libgrowl
libgrowl
├── build
│ ├── build.xml
│ └── libgrowl.jar
└── src
└── net
└── sf
└── libgrowl
├── Application.java
├── GrowlConnector.java

$ cd build


ant compile and ant jar will do the job

What if you don't have ant and want to do it manually?


$ cd libgrowl/build
$ javac ../src/net/sf/libgrowl/internal/*.java ../src/net/sf/libgrowl/*.java
⇒ no class files?


No class files? class files were generated in the source directory.

$ cd ../src/net/sf/libgrowl
$ java GrowlConnector
Error: Could not find or load main class GrowlConnector

$ java net.sf.libgrowl.GrowlConnector
Error: Could not find or load main class net.sf.libgrowl.GrowlConnector

What happen???

There are many ways to solve the above issue. This is how I do it.
$ cd libgrowl/build
$ javac -d . ../src/net/sf/libgrowl/*.java ../src/net/sf/libgrowl/internal/*.java
⇒ net/sf/libgrowl net/sf/libgrowl/internal
$ java net.sf.libgrowl.GrowlConnector localhost "libgrowl" "libgrowl" "Test" "Hello, world."
(Show Growl notification)

libgrowl (maven)


Maven is a software to build software lifecycle, it will download the necessary dependency from the Internet. It is supposed to make it easier to compile a bigger project, might not be in this case.

Note: The maven software lifecycle $ mvn clean compile test package

I am compiling on macOS Mojave.

$ git clone https://github.com/sbower/libgrowl
$ cd libgrowl
$ mvn compile
⇒ error

I am using Java 8. Compile with deprecated warning, but still able to generate 1.5 binary
$ javac -source 1.5 -target 1.5 HelloWorld.java
⇒ with warning.

But the maven 3.6.3 doesn't support 1.5 binary. My lazy quick fix, change the version in the pom file.

$ edit pom.xml
Change compiler source and target from 1.5 to 1.8

<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>

$ maven package
⇒ error, test not pass.

I just remove all the test cases. After successfully compile, try test the new compiled software following the testing session below.

Testing


Test Growl


You must have the Growl software installed to test. Optional: you can use the command line growlnotify to send notification to Growl.

If you are on macOS, you can install the growlnotify using homebrew.

$ brew install growlnotify

Test libgrowl


$ java -cp ./target/libgrowl.jar net.sf.libgrowl.GrowlConnector "host" "app name" "notification name" "title" "message"

$ java -cp ./target/libgrowl.jar net.sf.libgrowl.GrowlConnector localhost "libgrowl" "libgrowl" "Test" "Hello, world."
or
$ java -cp libgrowl.jar net.sf.libgrowl.GrowlConnector localhost "libgrowl" "libgrowl" "Test" "Hello, world."


Wednesday, May 20, 2020

Hardware Growler Fork Notification Software 2020

Hardware Growler Fork Notification Software 2020




Introduction


Growl is a notification software for macOS (Mac OS X), it looks nice and configurable eg. display location, duration stay on the screen. Growl is available on Windows systems as well. With Growl, you can have a universal notification system for application.

Growl started when there was no good notification system on Mac OS systems. Notification Center was included in Mac OS X 10.8 Mountain Lion in 2012. Growl can send notifications to macOS Notification Center.

Early days of Growl. A few Mac OS software bundle Growl with their software, eg. Adium, Dropbox, Adobe CS5 etc. Some users are angry because these software just install Growl on their system without them knowing it. Later Adobe made an announcement about it, here, https://blogs.adobe.com/deployment/2010/05/growl_installation_with_adobe.html.

Hardware Growler



Hardware Growler is a software that sends notifications (to Growler) when users plug in or unplug a device in the system.

Growl 2.0


Growl started as a free, open source notification software, but it started to charge USD3.99 on macOS App Store with version 2.0. Growl is licensed under BSD, so it can be used for commercial and close source.

Growl and Hardware Growler fork


Since Growl (and Hardware Growler) is open source, someone has mirror and fok the software. Now it can be found here:

https://github.com/pranav-prakash/HardwareGrowler-NC

I am not sure how to compile the above software. When I load it with Xcode (10.13.1), it warn me about 32 bit, so it may not works with macOS 10.5 Catalina.

This following Hardware Growler has been modified to send notification direct to macOS Notification Center. This software is small and easy to compile. https://github.com/cirrusj/HardwareGrowler. I have tried it on Mojave + Xcode 10.13.1.


$ git clone https://github.com/cirrusj/HardwareGrowler
$ cd HardwareGrowler
$ make
⇒ build/Debug/HardwareGrowler.app


Then run the HardwareGrowler.app, you can move/copy to /Application[/Utilities] folder.
I tried this on macOS 10.14 Mojave, it works.

If you just want the binary for Growl 2.0, you can check the blog here http://blogs.umb.edu/michaelbazzinott001/2014/09/21/growl/