Sunday, January 16, 2022

Install swoole on window

 

Not directly, but with Docker and WSL (Windows Subsystem for Linux).

  1. Install Docker (https://www.docker.com/products/docker-desktop)
  2. Setup WSL

Open PowerShell as Administrator and run

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Updating/Install the WSL 2 Linux kernel (https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel)

  1. Enable "Enable the experimental WSL 2 based engine" in Docker (General)
  2. Build the Docker container

IMPORTANT! Don't use a path with spacebars like:

  • C:\Users\ {FIRSTNAME}[SPACEBAR]{LASTNAME}\Desktop\docker)

Create a folder (D:\docker) and create with an Editor the Dockerfile (D:\docker\Dockerfile)

FROM php:7.4.2-cli

RUN apt-get update && apt-get install vim -y && \
    apt-get install openssl -y && \
    apt-get install libssl-dev -y && \
    apt-get install wget -y && \
    apt-get install git -y && \
    apt-get install procps -y && \
    apt-get install htop -y

RUN cd /tmp && git clone https://github.com/swoole/swoole-src.git && \
    cd swoole-src && \
    git checkout v4.4.15 && \
    phpize  && \
    ./configure  --enable-openssl && \
    make && make install

RUN touch /usr/local/etc/php/conf.d/swoole.ini && \
    echo 'extension=swoole.so' > /usr/local/etc/php/conf.d/swoole.ini

RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64
RUN chmod +x /usr/local/bin/dumb-init

RUN apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/usr/local/bin/dumb-init", "--", "php"]

Open PowerShell navigate to your folder (D:\docker) to build the DockerImage

docker build -f ./Dockerfile -t swoole-php .
  1. Add your swoole source code

As an example (D:\docker\server.php)

<?php
$http = new Swoole\HTTP\Server("0.0.0.0", 9501);

$http->on('start', function ($server) {
    echo "Swoole http server is started at http://127.0.0.1:9501\n";
});

$http->on('request', function ($request, $response) {
    $response->header("Content-Type", "text/plain");
    $response->end("Hello World\n");
});

$http->start();
?>
  1. Start your swoole http server with the PowerShell
docker run --rm -p 9501:9501 -v D:/docker/:/app -w /app swoole-php server.php

Monday, March 02, 2020

Gradle does not have execution permission.

How to solve the problem

run this command in flutter android directory

chmod a+rx gradlew

Monday, June 10, 2019

Farmer Application

The idea is farmer advertise their vegetable online.. the customer get the vegetables directly form them without any retailers...




Thursday, May 23, 2019

Configure Relay Postfix to send email via Gmail SMTP


1.     Create a file to store our credentials:
sudo vi /etc/postfix/sasl_passwd

2.     Add something like this:
smtp.gmail.com:587 sysnotify@umt.edu.my:00umt00

3.     Now run:
sudo postmap /etc/postfix/sasl_passwd

4.     Prepare the postfix main config file:
sudo vi /etc/postfix/main.cf

5.     Add/update these lines
relayhost=smtp.gmail.com:587
smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
smtp_sasl_security_options = noanonymous
smtp_always_send_ehlo = yes
smtp_sasl_mechanism_filter = plain

6.     Stop/Start the service
sudo postfix reload

7.     Run command nim utk test
date | mail -s "Test Email" abdul.rahim@umt.edu.my

8.     Check the queue for any errors

mailq

Wednesday, February 28, 2018

Cannot start virtual machine on Virtualbox

If u get  this  error while booting virtual machine on Virtuabox
Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT).

Try to resolve by disable Hyper-V in Window 10

Wednesday, May 10, 2017

HP LaserJet P1006 is in error state

Try this to resolve :

1. Click Start.
2. In the Search field type :   cmd
3. Right click on the Command Prompt icon at the top of the Start Bar and choose Run as Administrator.
4. Type the following below in succession:
               net stop spooler
               del %systemroot%\system32\spool\printers\*.*
               y
               net start spooler
5. If it still doesn't work you might try different printer drivers, PCL drivers usually offer better printer support than Universal drivers, especially PCL5 drivers which are made for compatibility.

Hope so...

Saturday, December 12, 2015

How to broadcast email using mail merge in Mozilla Thunderbird

Download Mozilla Thunderbird and install it


Install Mozilla Thunderbird
For first time users, you need to set up your default email account in Thunderbird. Here are expanded tutorials on Automatic Account Configuration and Manual Account Configuration on Mozilla support.
If you’re using Thunderbird as your default e-mail client, proceed to the Mail Merge download and installation.
1. After downloading the Mail Merge file “mail_merge-3.10.1-sm+tb.xpi,” launch Thunderbird. You may set it as your default email client or skip the integration.
Set Thunderbird as default.
2. Click Tools and choose “Add-ons,” and it will direct you to the “Add-ons Manager” tab. See the gear icon adjacent the Search bar, and click the drop-down menu.
Thunderbird Add-ons Manager
3. Choose “Install Add-on from File,” and open the Mail Merge file that you previously downloaded; restart the email client for the changes to take effect.
Restart Thunderbird for the changes to take effect.
Mail Merge is beneficial for those who have been building their e-mail contacts in a spreadsheet. In this tutorial, here’s what it looks like.
1. Create a spreadsheet and save it as a .csv file (e.g. mtelist.csv based on screenshot) if you don’t have one.
Create a spreadsheet and save it as dot-csv file.
2. Make sure that the columns are filled up with names and email addresses. Choose “Save as” for the file and click OK. Never mind the warning in the dialog box; proceed to the next step.
Ignore the Compatibility check recommended warning.
1. Click the “Write text” icon and create a new message. You may also add more recipients manually in the “To” field.
2. When writing, always include the text you want to use from the CSV file you saved previously with double brackets, e.g. {{Name}}. See A1 on the spreadsheet above.
Include text from CSV file with double brackets.
3. Once you finish writing the draft, go to File and select Mail Merge. Set the Mail Source to CSV, the Delivery Mode (Send as Draft, Send Later, and Send Now), the Format (HTML or Plain) and if you have attachments.
Go to File and select Mail Merge.
4. Click Browse to upload the CSV file from the directory where you have saved it and click OK. Mail Merge will run, and it will send your message according to the Delivery Mode.
You can check if the messages are sent in the Sent folder. If you have set the Delivery Mode as Send Later, then they will be automatically saved in Outbox under Local Folders. Keep in mind that the text inside the double brackets should be the same text or name of the column labeled in the CSV file you have saved. See A1 on the spreadsheet above. The CSV option works well; however, when I tried to do it via Address Book, I keep on getting errors.
Let us know how it works on your side and feel free to share other ways to create mail merge.