Monday, November 30, 2020

What's running in my windows port 8000?

 Tried to start my django, but not able to start it at port 8000.



 Then I run command line netstat -aob | find "8000"

The process was 8252.

Then, went to task manage to find the process ID.


After a little research of what was IP Help. I found that's for IPv6.

So, I decided to kill this process.

Finally, I could restart django again.





Friday, November 13, 2020

SQLite lock

 Looking at the node.js sequelize sample : https://github.com/mirkojotic/node-sequelize-article/blob/master/index.js

In this code, I use sqlite for just simple playing around.

const sequelize = new Sequelize({
  dialect: 'sqlite',
  storage: './database.sqlite'
}); 

 

Unfortunately,  data table will be locked when continue insert data in the same table.

    const tags = body.tags.map(
        tag =>
            Tag.findOrCreate({
                where: { name: tag.name },
                defaults: { name: tag.name }
            }).spread(
                (tagcreated=> tag
            )

    );


The error could be one of the two following messages:

Unhandled rejection SequelizeDatabaseError: SQLITE_ERROR: cannot start a transaction within a transaction


Unhandled rejection SequelizeTimeoutError: SQLITE_BUSY: database is locked

The sqlite is in memory database, so it has fast transaction.

I don't face this kind of issue, when I was working on python django.

So, mostly I realize think this is node.js sqlite module implementation issue.


Tuesday, October 27, 2020

Envoy in WSL

 First, go to ubuntu in wsl.

I have ubuntu-20.04 installed in wsl.

Following this installation instruction, it's pretty straight forward.

There is another instruction. I haven't try it yet.  

Download a demo configuration to try it.

Find the envoy-demo.yaml in here. This sample link to google site.

$envoy -c envoy-demo.yaml

Now, try to use proxy in the windows.

For a simple web page proxy :

listeners:

    - name: listener_page
      address:
        socket_address: { address: 0.0.0.0, port_value: 8102 }
      filter_chains:
        - filters:
            - name: envoy.filters.network.http_connection_manager
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
                stat_prefix: ingress_http
                codec_type: AUTO
                route_config:
                  name: local_route
                  virtual_hosts:
                    - name: local_service3
                      domains: ["*"]
                      routes:
                        - match: { prefix: "/" }
                          route:
                            cluster: service_page
                http_filters:
                  - name: envoy.filters.http.router

clusters:

    - name: service_page
      connect_timeout: 0.25s
      type: LOGICAL_DNS
      # Comment out the following line to test on v6 networks
      dns_lookup_family: V4_ONLY
      lb_policy: ROUND_ROBIN
      load_assignment:
        cluster_name: service_page
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: 172.29.144.1
                      port_value: 5000


 To look up the web server in the windows, the IP address is in /etc/resolv.conf

alex@alex-win:~/envoy$ ls -l
total 40
-rw-r--r-- 1 alex alex 7593 Oct 27 17:51 envoy-all.yaml
-rw-r--r-- 1 alex alex 1740 Oct 26 19:18 envoy-demo.yaml
-rw-r--r-- 1 alex alex  214 Oct 26 19:18 envoy-demo.yaml:Zone.Identifier
-rw-r--r-- 1 alex alex 1481 Oct 26 19:37 envoy-local-good.yaml
-rw-r--r-- 1 alex alex 1500 Oct 26 20:24 envoy-local.yaml
-rw-r--r-- 1 alex alex 2273 Oct 26 20:25 envoy-node.yaml
-rw-r--r-- 1 alex alex 6424 Oct 26 15:57 envoy.yaml
-rwxr-xr-x 1 alex alex   20 Oct 26 09:41 run.sh
alex@alex-win:~/envoy$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.29.144.1

 

 

 



Tuesday, September 01, 2020

Duck Typing

 This is the answer that easy understood for python developers.

Saturday, August 22, 2020

Markdown in Notepad++

Markdown is just great syntax to have quick document. It's easy and able to transfer to html.

I can use Notepad++ to edit it. I use dark mode theme; unfortunately, the text background is white.

The line I am working on is dark text with even darker background, that is total inaccessible in my eyes.


So, I need to adjust global style "current line background" constantly, but that just break the other languages' syntax highlight.

 

Today, just further research this issue. I am glad to find out Markdown Syntax for Notepad++.

To be simple, just manually to set it up, but not really got it work. To further look at it, I need to adjust language.  Now, perfectly.