Sunday, October 23, 2022

Second Physical Computer

I had been playing with Ubuntu on my old Dynabook N40, but the freezing phenomenon on it, even I am not so demanding as a thin client, did not stop (;-s). I am feeling that I have reached my limit. It is more fun to play with Cloud Computing nowadays than to investigate the cause of freezing.
At last I bought a mini PC that I had been considering before (:-), a model called MINISUFORUM UM350 with Ryzen5 3550H, 16G memory, 256G SSD, which is quite an exuberant spec for a Linux person. It is a good time because I could buy it for around $400. It was Windows 10 that was installed on the PC, but did I immediately switch to Linux? No, I am going to use it as it is for a while at least (:-o).

MINISFORUM UM350

Labels: , , ,

Sunday, September 25, 2022

Notification from RPA by LINE

Notification from RPA by LINE

My Cloud Computer has recently become an RPA dedicated execution machine called Sikulix, and it runs more comfortably and crisply than my home computer (my personal opinion). After all, it is physically located in a data center, which is (probably) closer network-wise to the target access server, and best of all, it is not affected by the congestion and failures of service providers. Even I don't do stock or crypto assetes at all, but I imagine that the popularity of cloud use among those people is partly because they are playing a more serious game in this area.
I used to use Gmail to notify when RPA was being executed or finished, but I decided that nowadays it is not necessary to use e-mail, so I decided to use LINE, which is popular mainly in Japan and some other Asian countries.
Although we use LINE casually, various APIs are available to application developers. In this case, I just want to send a message, so I'll use LINE Notify to make it as easy as possible. From the LINE Notify page, create a token, which is very popular nowadays. Token is a new word, but it is not so wrong to think of it as just a long password. Copy and paste this into a file on your Cloud Computer and save it. After that, all you have to do is access the dedicated LINE Notify page with your message. It's that easy. You can also send the message by typing in the URL in your browser, but it would be better to use a script since it would take a lot of time. In this example, we put the following contents in the file sendline.sh, and then type

#! /bin/bash -f
curl -X POST -H 'Authorization: Bearer '`cat linetoken` -F 'message="'$1'"'' https://notify-api.line.me/api/notify
#! /bin/bash -f
curl -X POST -H 'Authorization: Bearer '`cat linetoken` -F 'message="'$1'"'' https://notify-api.line.me/api/notify

Add execution rights.

$ chmod +x sendline.sh
$ chmod +x sendline.sh

Note that in the above example, the tokens are stored in a file called linetoken. The cat linetoken` is a symbol to tell you to extract the contents of the file linetoken on the command line. The $1 means to set the value written at the back (called argument) when executing. When you run the command, it looks like this.

$ . /sendline.sh "line message from Cloud PC"
$ . /sendline.sh "line message from Cloud PC"

It seems that the destination of the line is not written, but that information is contained in the token issued. I wrote above that it is just a long password, but the token seems to have a slightly different role. Sikulix, which is an RPA tool, uses python, so when you call it from there, it looks like this

# Send a message from Sikulix Python to LINE
m = "Message from Sikulix"
subprocess.call(['linesend.sh', m])
```

As a result, I received a message from **LINE Notify** without any problems (:-). This could be used in many ways.
# Send a message from Sikulix Python to LINE
m = "Message from Sikulix"
subprocess.call(['linesend.sh', m])
```

As a result, I received a message from **LINE Notify** without any problems (:-). This could be used in many ways.

Labels: , , ,

Sunday, September 18, 2022

Notification from RPA by GMail

971 Notification from RPA #1 GMail
Notification from RPA #1 GMail

I have Sikullix in my Cloud Computer and I am playing with RPA and other things, but I can't watch it all the time after it starts because I let it run for a good long time, but I don't know when it finishes or it may have ended up with an error for some reason in the middle of the process. So, even very simple idea, but I'm going to use Gmail to notify me when the process is finished or when there is an error.
Of course, since I am dealing with RPA so far, we could use that to send it via webmail from a browser, but it would be a lot of work to start a browser, access the Gmail page, go to .... and as anyone who has ever made RPA knows, it doesn't work quite as well as I'd like (;-s). Especially this time, I want to send an email even when an error occurs while letting the user surf the web using a browser, but it is not a good idea to send an email through the browser because the error may be caused by the browser. Also, since I am a command line lover (:-), I will make this part with a script. However, my current theme is a Cloud Computer, so I don't mean to make it a mail server. It is just a normal Computer that can be used to send mail.
In the case of Ubuntu, it is under /etc/postfix. However, since security is getting stricter these days, you need to issue an application password on the Gmail side and set it up on your cloud computer as well.

On the Gmail side, go to Account ⇒ Security ⇒ Application Password.

Write this password in a file named sasl_passwd, excluding spaces. When ready, create transport.db and sasl_passwd.db and restart postfix. It looks like this.

$ sudo postmap /etc/postfix/transport
$ sudo postmap /etc/postfix/sasl_passwd
$ sudo systemctl restart postfix
$ sudo postmap /etc/postfix/transport
$ sudo postmap /etc/postfix/sasl_passwd
$ sudo systemctl restart postfix

Now all you have to do is send mail as usual.

$ echo "body of mail" | mail -s "subject of mail" mail to (xxxxx@xxx.com)
$ echo "body of mail" | mail -s "subject of mail" mail to (xxxxx@xxx.com)

The command line world is easier to understand than RPA after all (:-), and there are many cases where it is better to use scripts to do things that can be done with RPA. If you try to do everything with RPA, you will see a tough world a bit (:-).

Labels: , , , ,

Sunday, September 4, 2022

RPA on Cloud Computer #2

I started using Cloud Computer, a local but NTT-affiliated service in Japan, with 2 CPUs and 2 gigabytes of memory for a reasonable (I think) maximum of 700 yen/month. The Dynabook N40 at home has taken on a second life (lol) as a Thin Client.
There is one thing I would like to confirm before using RPA with Cloud Computer this time. What is the resolution of the screen when not connected to Cloud Computer via VNC? ** I don't know what you are talking about. I know you don't know what I'm talking about, but I don't know much either (lol)... When I was still an active engineer about 20 years ago, most of my work and geeky activities were done on the command line. Of course, I used X-Window and Windows, but I used them only as it is, with no customization. So I am not good at this area at all. By the way, command line is what is called CUI or shell, and it is the world of computers without using a mouse. For some person, it is more understandable, let's say , it is just like MS-DOS.
RPA is a part of the mouse-using culture. In a world without a mouse, there are only commands, so there is no need to bring in the concept of RPA, and all you have to do is to write a list of commands and execute them in order from the top (with some logic, of course). Before the advent of RPA, I remember that even when surfing the Internet, I had to acquire information from scripts and programs via http and then analyze the tags. However, with the development of CSS and other technologies in addition to images and videos, information processing by tag analysis is complicated and difficult, so it has become simpler and quicker to automate the world as it is, which is what RPA is. I think this is what RPA is all about.
In RPA, of course, if the resolution changes, the images of buttons and input fields may not match the images prepared in advance, so it is necessary to know the resolution. Therefore, it is necessary to know the resolution of the screen. However, while RPA is being executed on a cloud Computer, it is left unconnected from the home PC, so the screen is not physically output anywhere during that time. However, the RPA is working by properly understanding the location and contents of the Window of the application, which is not visible to humans. What is the screen resolution at that time? is my question.
At the result , I understand that, when the RPA is running on a Cloud Computer, the monitor is connected even if the screen is not physically output anywhere. When I ran it with no VNC connection and only an ssh connection, I got the following message

$ xrandr
Screen 0: minimum 32 x 32, current 1920 x 1200, maximum 32768 x 32768
VNC-0 connected primary 1920x1200+0+0 0mm x 0mm
$ xrandr
Screen 0: minimum 32 x 32, current 1920 x 1200, maximum 32768 x 32768
VNC-0 connected primary 1920x1200+0+0 0mm x 0mm

On the Cloud Computer side, the VNC application (vncserver) is launched, so it is the monitor. In other words, when the vncserver was started, the monitor was already connected from the OS point of view, and whether or not the VNC app was viewing it from the home computer was not important to either the OS or the RPA. So if you want to run RPA from your home PC on a Cloud Computer, you don't necessarily need to connect via VNC, just an ssh connection.

$ xrandr --output VNC-0 mode=1920x1080
java sikulix ...
$ xrandr --output VNC-0 mode=1920x1080
java sikulix ...

I found no problem if I specify the resolution first and then run the program. To be honest, it was getting a little hard to start up an application for mouse (so-called desktop) on my Dynabook N40, which is my home thin client, but now that I know I can run RPA from just the command line, I'll let it work a little longer (lol).

Labels: , , ,

Sunday, August 28, 2022

Thin Client

I was initially using AWS Workspaces as my Cloud Computer, but for some reason the RPA tool, Sikulix I got stuck (;-o). So I used an NTT-affiliated service called WebARENA Indigo as a second Cloud Cloud, with an OS of [Dynabook N40 from Home PC](https://batasanblog.hateblo.jp/entry/2022/06/ 08/093429) and basically the same configuration. dynabook N40 runs crisply after installing Linux, but [sometimes freezes](https://batasanblog.hateblo.jp/entry/2022/ 06/27/180000), a fatal phenomenon that has not yet been resolved. However, with this configuration, even if the home PC freezes, the Cloud Computer keeps the work status as it is, and if RPA is running.
If you feel it means Thin Client? You've got good sense, I think (:-). Yes, that's right. It has already been a common IT concept in this industry for 15 years, meaning a thin computer. In this case thin means not refer to a phisically thin computer like a Mac Book, but rather to a computer a with few functions. In other words, in this case, it means that the home computer side only displays the screen of the Cloud Computer and performs a few functions. Therefore, a relatively old and slow computer is considered sufficient, and the fact that my dynabook N40 has settled into this position is a natural consequence of the natural flow of things (:-).

Labels: , ,