kandi background
Explore Kits

lumen | The Laravel Lumen Framework | Web Framework library

 by   laravel PHP Version: Current License: No License

 by   laravel PHP Version: Current License: No License

Download this library from

kandi X-RAY | lumen Summary

lumen is a PHP library typically used in Server, Web Framework, Framework applications. lumen has no bugs, it has no vulnerabilities and it has medium support. You can download it from GitHub.
Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • lumen has a medium active ecosystem.
  • It has 7505 star(s) with 999 fork(s). There are 341 watchers for this library.
  • It had no major release in the last 12 months.
  • lumen has no issues reported. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of lumen is current.
lumen Support
Best in #Web Framework
Average in #Web Framework
lumen Support
Best in #Web Framework
Average in #Web Framework

quality kandi Quality

  • lumen has 0 bugs and 0 code smells.
lumen Quality
Best in #Web Framework
Average in #Web Framework
lumen Quality
Best in #Web Framework
Average in #Web Framework

securitySecurity

  • lumen has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • lumen code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
lumen Security
Best in #Web Framework
Average in #Web Framework
lumen Security
Best in #Web Framework
Average in #Web Framework

license License

  • lumen does not have a standard license declared.
  • Check the repository for any license declaration and review the terms closely.
  • Without a license, all rights are reserved, and you cannot use the library in your applications.
lumen License
Best in #Web Framework
Average in #Web Framework
lumen License
Best in #Web Framework
Average in #Web Framework

buildReuse

  • lumen releases are not available. You will need to build from source code and install.
lumen Reuse
Best in #Web Framework
Average in #Web Framework
lumen Reuse
Best in #Web Framework
Average in #Web Framework
Top functions reviewed by kandi - BETA

kandi has reviewed lumen and discovered the below as its top functions. This is intended to give you an instant insight into lumen implemented functionality, and help decide if they suit your requirements.

  • Boot the application .
    • Handle the authenticated user .
      • Define the generator .
        • Render the response .
          • Schedule a schedule .
            • Report an exception .
              • Run seeders .
                • Register plugin .

                  Get all kandi verified functions for this library.

                  Get all kandi verified functions for this library.

                  lumen Key Features

                  The Laravel Lumen Framework.

                  lumen Examples and Code Snippets

                  See all related Code Snippets

                  Unable to detect multiple Rect Collisions in Pygame

                  copy iconCopydownload iconDownload
                  driver.rect.x = round(self.y)
                  driver.rect.y = round(self.y)
                  for rectangle in rects:
                      rectangle.rect.x = round(rectangle.x)
                      rectangle.rect.y = round(rectangle.y)
                      if rectangle.rect.colliderect(driver.rect): 
                          rectangle.x_speed *= -1 
                          rectangle.y_speed *= -1 
                  

                  jmespath extract a key from a list which is not json

                  copy iconCopydownload iconDownload
                  [*].texts[?language.isoCode == 'en'].text[] | [0]
                  
                  "CENTRAL I.V. MULTI-LUMEN CATHETERS, PERIPHERAL ACCESS"
                  
                  [*].texts[?language.isoCode == 'en'].text[] | [0]
                  
                  "CENTRAL I.V. MULTI-LUMEN CATHETERS, PERIPHERAL ACCESS"
                  

                  Lumen migration - Foreign Id with a table name that isn't the plural of the local key

                  copy iconCopydownload iconDownload
                  $table->foreign('user_destination')->references('id')->on('locations');
                  
                  $table->foreignId('user_id')->constrained('users');
                  
                  $table->foreign('user_destination')->references('id')->on('locations');
                  
                  $table->foreignId('user_id')->constrained('users');
                  

                  Laravel (Lumen) connect to database on another server on same network

                  copy iconCopydownload iconDownload
                  DB_HOST=[my ipv6]
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  
                  PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
                  64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.399 ms
                  64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.412 ms
                  64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.352 ms
                  64 bytes from 192.168.1.2: icmp_seq=4 ttl=64 time=0.409 ms
                  
                  --- 192.168.1.2 ping statistics ---
                  4 packets transmitted, 4 received, 0% packet loss, time 3057ms
                  rtt min/avg/max/mdev = 0.352/0.393/0.412/0.024 ms
                  
                  PING abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd(abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd) 56 data bytes
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=1 ttl=61 time=0.421 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=2 ttl=61 time=0.333 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=3 ttl=61 time=0.388 ms
                  64 bytes from abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd: icmp_seq=4 ttl=61 time=0.324 ms
                  
                  --- 2001:19f0:5:241:a315:602c:64ce:d6c1 ping statistics ---
                  5 packets transmitted, 5 received, 0% packet loss, time 4096ms
                  rtt min/avg/max/mdev = 0.324/0.368/0.421/0.035 ms
                  
                  ssh user@192.168.1.2
                  ssh user@[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]
                  
                  nmap -sT -O 192.168.1.2
                  
                  nmap -sT -O -6 abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-11 10:04 EST
                  Nmap scan report for 192.168.1.2
                  Host is up (0.00036s latency).
                  Not shown: 998 closed tcp ports (conn-refused)
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  MAC Address: AA:BB:CC:DD:EE:FF (Unknown)
                  Device type: general purpose
                  Running: Linux 4.X|5.X
                  OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
                  OS details: Linux 4.15 - 5.6
                  Network Distance: 1 hop
                  
                  OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
                  Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds
                  
                  PORT     STATE SERVICE
                  3306/tcp open  mysql
                  
                  port          = 3306
                  #ipv4
                  bind-address  = 192.168.1.2
                  #ipv6
                  bind-address  = abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd
                  
                  mysql -h 192.168.1.2 -u root -p password
                  
                  #IPv4
                  DB_HOST=192.168.1.2
                  #IPv6
                  DB_HOST=[2001:19f0:5:241:a315:602c:64ce:d6c1]
                  DB_PORT=3306
                  

                  Select Parent where it has ALL requested children (Not just Any of them)

                  copy iconCopydownload iconDownload
                      SELECT people.id FROM `people` 
                      INNER JOIN `people_interests` on `people`.`id` = `people_interests`.`person_id` 
                      WHERE `department` = "something" 
                      AND `people_interests`.`interest_id` in ("interestABC","interestXYZ")
                      GROUP BY people.id
                      HAVING  COUNT(people.id)>=2;
                  

                  PHP Serial connection read timeout

                  copy iconCopydownload iconDownload
                  public function read($maxElapsed = 'infinite')
                  {
                      $this->ensureDeviceOpen();
                      
                      $chars = [];
                      $timeout = $maxElapsed == 'infinite' ? 1.7976931348623E+308 : (microtime(true) + $maxElapsed);
                      do {
                          $char = fread($this->fd, 1);
                          if ($char === '') {
                              if (microtime(true) > $timeout) return false;
                              usleep(100);    //Why waste CPU?
                              continue;
                          }
                          $chars[] = $char;
                      } while ($char !== $this->getParser()->getSeparator());
                  
                      return $this->getParser()->parse($chars);
                  }
                  
                  $data2 = $this->serialPort->read(15);
                  if ($data2 === false) {
                      //Timeout occurred
                  } elseif (Str::contains($data2, "Whatever I want to check for")) {
                      //String found
                  } else {
                      //Data received but string not found
                  }
                  
                  public function read($maxElapsed = 'infinite')
                  {
                      $this->ensureDeviceOpen();
                      
                      $chars = [];
                      $timeout = $maxElapsed == 'infinite' ? 1.7976931348623E+308 : (microtime(true) + $maxElapsed);
                      do {
                          $char = fread($this->fd, 1);
                          if ($char === '') {
                              if (microtime(true) > $timeout) return false;
                              usleep(100);    //Why waste CPU?
                              continue;
                          }
                          $chars[] = $char;
                      } while ($char !== $this->getParser()->getSeparator());
                  
                      return $this->getParser()->parse($chars);
                  }
                  
                  $data2 = $this->serialPort->read(15);
                  if ($data2 === false) {
                      //Timeout occurred
                  } elseif (Str::contains($data2, "Whatever I want to check for")) {
                      //String found
                  } else {
                      //Data received but string not found
                  }
                  
                  if (Str::contains($data2, "Whatever I want to check for"))
                  
                  $data2 = $this->serialPort->read();
                  
                  $data2 .= $this->serialPort->read();
                  
                  if (Str::contains($data2, "Whatever I want to check for"))
                  
                  $data2 = $this->serialPort->read();
                  
                  $data2 .= $this->serialPort->read();
                  
                  if (Str::contains($data2, "Whatever I want to check for"))
                  
                  $data2 = $this->serialPort->read();
                  
                  $data2 .= $this->serialPort->read();
                  

                  lumen array_key_exists() depreciated, then how to use the alternative like isset() or property_exists() to array?

                  copy iconCopydownload iconDownload
                  // Take note that the order of parameters is inverted from the array_key_exists() function
                  //                    |       |
                  //                    V       V
                  if(property_exists($object, $key))
                  {
                      $keyData = "true";
                  }
                  

                  Render products in shopping cart with the number of each product

                  copy iconCopydownload iconDownload
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  {
                    "2": 1,
                    "8": 3,
                    "9": 3,
                    "26": 1
                  }
                  
                  const cart = [
                    {
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  console.log(counts);
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  const cart = [{
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  console.log(cartWithQuantities);
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  {
                    "2": 1,
                    "8": 3,
                    "9": 3,
                    "26": 1
                  }
                  
                  const cart = [
                    {
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  console.log(counts);
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  const cart = [{
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  console.log(cartWithQuantities);
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  {
                    "2": 1,
                    "8": 3,
                    "9": 3,
                    "26": 1
                  }
                  
                  const cart = [
                    {
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  console.log(counts);
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  const cart = [{
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  console.log(cartWithQuantities);
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  {
                    "2": 1,
                    "8": 3,
                    "9": 3,
                    "26": 1
                  }
                  
                  const cart = [
                    {
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  console.log(counts);
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  const cart = [{
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  console.log(cartWithQuantities);
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  {
                    "2": 1,
                    "8": 3,
                    "9": 3,
                    "26": 1
                  }
                  
                  const cart = [
                    {
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const counts = cart.reduce((counts, { product_id }) => ({
                    ...counts,
                    [product_id]: (counts[product_id] || 0) + 1,
                  }), {});
                  
                  console.log(counts);
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  const cart = [{
                      id: 13,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 14,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 15,
                      user_id: 13,
                      product_id: 8,
                      product_name: 'Lenovo Ideapad Intel Celeron 1TB HDD 8GB RAM Win 1'
                    },
                    {
                      id: 27,
                      user_id: 13,
                      product_id: 2,
                      product_name: 'Canon 100% Genuine Original Pixma TS3140 AIO Wirel'
                    },
                    {
                      id: 29,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 30,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 31,
                      user_id: 13,
                      product_id: 9,
                      product_name: 'Lenovo Ideapad 14inch AMD Quad Core 1TB HDD 8GB RA'
                    },
                    {
                      id: 32,
                      user_id: 13,
                      product_id: 26,
                      product_name: 'Viewsonic Viewsonic 3600 Lumens HDMI VGA AV Projec'
                    }
                  ];
                  
                  const cartWithQuantities = Object.values(
                    cart.reduce((cart, item) => ({
                      ...cart,
                      [item.product_id]: {
                        ...item,
                        quantity: (cart[item.product_id]?.quantity || 0) + 1
                      },
                    }), {})
                  );
                  
                  console.log(cartWithQuantities);

                  Laravel Lumen Collection - Group By With Sum and preserve the values

                  copy iconCopydownload iconDownload
                  $newCollection = collect([]);
                  $collectctions = collect([
                      [
                          'name' => 'John Doe',
                          'department' => 'Sales',
                          'phone' => '99999-99999',
                          'value' => 25.0
                      ],
                      [
                          'name' => 'Mary Lisa',
                          'department' => 'Finance',
                          'phone' => '88888-88888',
                          'value' => 5.0
                      ],
                      [
                          'name' => 'Mary Lisa',
                          'department' => 'Finance',
                          'phone' => '88888-88888',
                          'value' => 58.0
                      ],
                      [
                          'name' => 'Lucas Rodrigues',
                          'department' => 'Marketing',
                          'phone' => '22222-22222',
                          'value' => 90.0
                      ]
                  ]);
                  
                  foreach ($collectctions as $item) {
                      if($newCollection->contains('name', $item['name'])){
                          $index = $newCollection->where('name', $item['name'])->keys()[0];
                  
                          $newCollection = $newCollection->map(function ($object, $i) use ($index, $item) {
                              if($i == $index){
                                  $object['value'] += $item['value'];
                              }
                  
                              return $object;
                          });
                  
                      }
                      else{
                          $newCollection->push($item);
                      }
                  }
                  
                  return $newCollection;
                  
                  $data = collect([
                      [
                          'name' => 'John Doe',
                          'department' => 'Sales',
                          'phone' => '99999-99999',
                          'value' => 25.0
                      ],
                      [
                          'name' => 'Mary Lisa',
                          'department' => 'Finance',
                          'phone' => '88888-88888',
                          'value' => 5.0
                      ],
                      [
                          'name' => 'Mary Lisa',
                          'department' => 'Finance',
                          'phone' => '88888-88888',
                          'value' => 58.0
                      ],
                      [
                          'name' => 'Lucas Rodrigues',
                          'department' => 'Marketing',
                          'phone' => '22222-22222',
                          'value' => 90.0
                      ]
                  ]);
                  
                  $data = $data->groupBy('name')->map(function ($item) {
                      if ($item->count() > 1) {
                          $item = $item->slice(0, 1)->map(function($subItem) use ($item) {
                              $subItem['value'] = $item->sum('value');
                  
                              return $subItem;
                          });
                      }
                  
                      return $item;
                  })
                  ->flatten(1);
                  
                  Array
                  (
                      [0] => Array
                          (
                              [name] => John Doe
                              [department] => Sales
                              [phone] => 99999-99999
                              [value] => 25
                          )
                  
                      [1] => Array
                          (
                              [name] => Mary Lisa
                              [department] => Finance
                              [phone] => 88888-88888
                              [value] => 63
                          )
                  
                      [2] => Array
                          (
                              [name] => Lucas Rodrigues
                              [department] => Marketing
                              [phone] => 22222-22222
                              [value] => 90
                          )
                  
                  )
                  
                  $data = collect([
                      [
                          'name' => 'John Doe',
                          'department' => 'Sales',
                          'phone' => '99999-99999',
                          'value' => 25.0
                      ],
                      [
                          'name' => 'Mary Lisa',
                          'department' => 'Finance',
                          'phone' => '88888-88888',
                          'value' => 5.0
                      ],
                      [
                          'name' => 'Mary Lisa',
                          'department' => 'Finance',
                          'phone' => '88888-88888',
                          'value' => 58.0
                      ],
                      [
                          'name' => 'Lucas Rodrigues',
                          'department' => 'Marketing',
                          'phone' => '22222-22222',
                          'value' => 90.0
                      ]
                  ]);
                  
                  $data = $data->groupBy('name')->map(function ($item) {
                      if ($item->count() > 1) {
                          $item = $item->slice(0, 1)->map(function($subItem) use ($item) {
                              $subItem['value'] = $item->sum('value');
                  
                              return $subItem;
                          });
                      }
                  
                      return $item;
                  })
                  ->flatten(1);
                  
                  Array
                  (
                      [0] => Array
                          (
                              [name] => John Doe
                              [department] => Sales
                              [phone] => 99999-99999
                              [value] => 25
                          )
                  
                      [1] => Array
                          (
                              [name] => Mary Lisa
                              [department] => Finance
                              [phone] => 88888-88888
                              [value] => 63
                          )
                  
                      [2] => Array
                          (
                              [name] => Lucas Rodrigues
                              [department] => Marketing
                              [phone] => 22222-22222
                              [value] => 90
                          )
                  
                  )
                  

                  rmarkdown user input to select from a list

                  copy iconCopydownload iconDownload
                  ---
                  title: "title"
                  author: Name
                  date: "`r format(Sys.time(), '%d %B, %Y')`"
                  output: 
                   html_document:
                     theme: flatly # default, cerulean, journal, flatly, darkly, readable, spacelab, united, cosmo, lumen, paper, sandstone, simplex, and yeti
                     highlight: tango # default, tango, pygments, kate, monochrome, espresso, zenburn, haddock, breezedark, and textmate
                     smart: true
                     toc: true
                     toc_depth: 2
                     toc_float:
                       collapsed: false
                       smooth_scroll: false
                     numbers_sections: true
                     fig_width: 7
                     fig_height: 6
                     fig_caption: true
                     df_print: paged
                     code_folding: hide
                  
                  runtime: shiny   
                     
                  #bibliography: bibliography.bib
                  ---
                  
                  ```{r setup, include=FALSE}
                  knitr::opts_chunk$set(echo = TRUE)
                  set.seed(1234)
                  library(knitr)
                  library(kableExtra)
                  library(ggplot2)
                  library(dplyr)
                  library(purrr)
                  freqsByYear <- list(LG1 = structure(list(YEAR = c(1L, 1L, 1L, 1L, 2L, 2L, 2L
                  ), LG1 = c(2L, 3L, 4L, 5L, 3L, 4L, 5L), n = c(1L, 26L, 64L, 25L, 
                  13L, 33L, 36L)), class = "data.frame", row.names = c(NA, -7L)), 
                      AA1 = structure(list(YEAR = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 
                      2L, 2L), AA1 = c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 5L), n = c(31L, 
                      44L, 30L, 11L, 28L, 30L, 15L, 8L, 1L)), class = "data.frame", row.names = c(NA, 
                      -9L)), FNB1 = structure(list(YEAR = c(1L, 1L, 1L, 1L, 2L, 
                      2L, 2L, 2L, 2L), FNB1 = c(2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 
                      5L), n = c(16L, 12L, 68L, 20L, 1L, 2L, 9L, 35L, 35L)), class = "data.frame", row.names = c(NA, 
                      -9L)), RE1 = structure(list(YEAR = c(1L, 1L, 1L, 1L, 1L, 
                      2L, 2L, 2L, 2L, 2L), RE1 = c(1L, 2L, 3L, 4L, 5L, 1L, 2L, 
                      3L, 4L, 5L), n = c(24L, 58L, 26L, 7L, 1L, 24L, 29L, 23L, 
                      5L, 1L)), class = "data.frame", row.names = c(NA, -10L)))
                  ```
                  ```{r}
                  selectInput("selector",label = "Selector",
                        choices = names(freqsByYear),
                        selected = 1)
                  
                  renderPlot(freqsByYear %>% 
                    pluck(., input$selector) %>% 
                    ggplot(aes(x = !!sym(input$selector), y = n, fill = n)) +
                    geom_col() +
                    facet_wrap(~YEAR))
                  ```
                  

                  See all related Code Snippets

                  Community Discussions

                  Trending Discussions on lumen
                  • Unable to detect multiple Rect Collisions in Pygame
                  • laravel/passport for laravel lumen support
                  • jmespath extract a key from a list which is not json
                  • Lumen migration - Foreign Id with a table name that isn't the plural of the local key
                  • Laravel (Lumen) connect to database on another server on same network
                  • Jwt verification fails by Envoy
                  • Select Parent where it has ALL requested children (Not just Any of them)
                  • PHP Serial connection read timeout
                  • JWT-Authentication of mulitple Laravel-APIs with the same token
                  • Codeigniter + Lumen Framework - htaccess redirect certain path to specific folder
                  Trending Discussions on lumen

                  QUESTION

                  Unable to detect multiple Rect Collisions in Pygame

                  Asked 2022-Apr-10 at 05:13

                  I'm been working on a simple Pygame project that involves simulating motion sensor lights in open areas, and have created multiple instances of delivery riders, smokers and civilians. When users are within a certain distance, the lights on the ground would light up. The problem I faced was, when objects came into collision with the drivers, colliderect did not trigger at all (tested with print statements). Ideally all the civilians should collide and reflect off one another except the driver and smokers.

                  Here is a recording of my virtual prototype: LUmen Simulator

                  Display setup and distance function

                  screen = width,height = 800,600
                  fps = 60 
                  cellsize = 50 
                  padding = 40 # create identations from the window 
                  rows = cols = (width - 50) // cellsize 
                  print(rows, cols) 
                  
                  def euclid_dist(mX, mY, x, y): # distance to grid 
                          dist = math.sqrt((mX - x)**2 + (mY - y)**2)
                  
                          if dist <= 80: 
                              return True
                          else: 
                              return False 
                  

                  Instantiation of objects

                  class Cell_1: # sample of user object 
                      def __init__(self):
                          self.x = random.randrange(20, width-20) #x position
                          self.y = random.randrange(20, height-20) #y position
                          self.x_speed = 2
                          self.y_speed = 2 
                  
                          self.image = char # pre-loaded img 
                          self.image = pygame.transform.scale(self.image, (cellsize, cellsize+20))
                          self.rect = pygame.Surface.get_rect(self.image, center= (self.x, self.y))
                  
                      def wander(self):
                          self.x += self.x_speed 
                          self.y += self.y_speed
                  
                          if self.x <= 30 or self.x >= width - 30:
                              self.x_speed *= -1 
                  
                          elif self.y <= 30 or self.y >= height - 30:
                              self.y_speed *= -1
                  
                      def draw(self): 
                          surface.blit(self.image, (self.x, self.y))
                  
                  class Cell_2: 
                      def __init__(self):
                          self.x = random.randrange(20, width-20) #x position
                          self.y = random.randrange(20, height-20) #y position
                          self.x_speed = 2
                          self.y_speed = 2 
                  
                          self.image = char # pre-loaded img 
                          self.image = pygame.transform.scale(self.image, (cellsize, cellsize+20))
                          self.rect = pygame.Surface.get_rect(self.image, center= (self.x, self.y))
                  
                      def wander(self):
                          self.x += self.x_speed 
                          self.y += self.y_speed
                  
                          if self.x <= 30 or self.x >= width - 30:
                              self.x_speed *= -1 
                  
                          elif self.y <= 30 or self.y >= height - 30:
                              self.y_speed *= -1
                  
                      def draw(self): 
                          surface.blit(self.image, (self.x, self.y))
                  
                  
                  class Driver: 
                      # make driving linear 
                      def __init__(self):
                          self.x = random.randrange(20, width-20) #x position
                          self.y = height - 20 #bottom of screen 
                          self.y_speed = 12
                          self.x_speed = 12
                  
                          self.image = char3
                          self.image = pygame.transform.scale(self.image, (cellsize+20, cellsize+20))
                          self.rect = pygame.Surface.get_rect(self.image, center = (self.x, self.y))
                  
                      def wander(self):
                          if self.y <= 20: # height 
                              self.y = height 
                              self.x = random.randrange(20, width-20)
                  
                          else: 
                              self.y -= self.y_speed
                  
                      def draw(self): 
                          surface.blit(self.image, (self.x, self.y))
                  
                  rects = [] 
                  cells_1 = []
                  for i in range(2): 
                      cell = Cell_1()
                      cells_1.append(cell)
                      rects.append(cell) # for collision detection 
                  
                  cells_2 = []
                  for i in range(2): 
                      cell = Cell_2()
                      cells_2.append(cell)
                      rects.append(cell)
                  
                  driver = Driver()
                  

                  Running the game

                  while running:
                      warm_col = (255, random.randint(0, 255), 0)
                      surface.fill(black)
                  
                      for event in pygame.event.get(): 
                          if event.type == pygame.QUIT: 
                              # upon closing the window with mouse 
                              running = False 
                  
                      driver.wander()
                      driver.draw() 
                          
                      for npc in cells_1: 
                          npc.wander()
                          npc.draw()
                  
                      for npc in cells_2: 
                          npc.wander()
                          npc.draw()
                  
                      for rectangle in rects:
                          if (rectangle.rect.colliderect(driver.rect)): 
                              rectangle.x_speed *= -1 
                              rectangle.y_speed *= -1 
                          
                      (mX, mY) = pygame.mouse.get_pos()
                      char1 = pygame.transform.scale(char1, (cellsize-10, cellsize+20)) 
                      surface.blit(char1, (mX, mY))
                  
                      for row in range(rows): 
                          for col in range(cols): 
                              for i in rects: 
                                      x = col * cellsize + padding
                                      y = row * cellsize + padding 
                                      within_dist = euclid_dist(mX, mY, x, y)
                                      npc_within = euclid_dist(i.x, i.y, x, y) 
                  
                                      if within_dist == True or npc_within == True:
                                          pygame.draw.circle(surface, warm_col, (x,y), 3) 
                  
                  
                  for row in range(rows): 
                          for col in range(cols): 
                              for i in cells_1: 
                                      x = col * cellsize + padding
                                      y = row * cellsize + padding 
                                      within_dist = euclid_dist(mX, mY, x, y)
                                      npc_within = euclid_dist(i.x, i.y, x, y) 
                  
                                      if within_dist == True or npc_within == True:
                                          pygame.draw.circle(surface, warm_col, (x,y), 3) 
                  
                      for row in range(rows): 
                          for col in range(cols): 
                              for i in cells_2: 
                                      x = col * cellsize + padding
                                      y = row * cellsize + padding 
                                      within_dist = euclid_dist(mX, mY, x, y)
                                      npc_within = euclid_dist(i.x, i.y, x, y) 
                  
                                      if within_dist == True or npc_within == True:
                                          pygame.draw.circle(surface, warm_col, (x,y), 3) 
                  
                      for row in range(rows): 
                          for col in range(cols):  
                                      x = col * cellsize + padding
                                      y = row * cellsize + padding 
                                      within_dist = euclid_dist(mX, mY, x, y)
                                      npc_within = euclid_dist(driver.x, driver.y, x, y) 
                  
                                      if within_dist == True or npc_within == True:
                                          pygame.draw.circle(surface, warm_col, (x,y), 3)   
                  
                                
                  
                      pygame.display.update() 
                      pygame.time.Clock().tick(fps) 
                      pygame.mouse.set_visible(False) 
                  
                  pygame.quit()
                  

                  I have tried euclidean distance but it only worked for the edges of the display (gif) I also tried implementing colliderect logic here https://youtu.be/1_H7InPMjaY, but to no avail

                  May I know if there is a more efficient way to go about this? I was thinking of using sprites instead of blit, but not sure if it would be any different. Also, I'm new to Pygame, so any help or suggestions would be appreciated!

                  ANSWER

                  Answered 2022-Apr-10 at 05:13

                  You have to update the position of the rectangle before the collision test:

                  driver.rect.x = round(self.y)
                  driver.rect.y = round(self.y)
                  for rectangle in rects:
                      rectangle.rect.x = round(rectangle.x)
                      rectangle.rect.y = round(rectangle.y)
                      if rectangle.rect.colliderect(driver.rect): 
                          rectangle.x_speed *= -1 
                          rectangle.y_speed *= -1 
                  

                  Source https://stackoverflow.com/questions/71813826

                  Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                  Vulnerabilities

                  No vulnerabilities reported

                  Install lumen

                  You can download it from GitHub.
                  PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.

                  Support

                  Documentation for the framework can be found on the Lumen website.

                  DOWNLOAD this Library from

                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                  over 430 million Knowledge Items
                  Find more libraries
                  Reuse Solution Kits and Libraries Curated by Popular Use Cases
                  Explore Kits

                  Save this library and start creating your kit

                  Explore Related Topics

                  Share this Page

                  share link
                  Consider Popular Web Framework Libraries
                  Try Top Libraries by laravel
                  Compare Web Framework Libraries with Highest Support
                  Compare Web Framework Libraries with Highest Quality
                  Compare Web Framework Libraries with Highest Security
                  Compare Web Framework Libraries with Permissive License
                  Compare Web Framework Libraries with Highest Reuse
                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                  over 430 million Knowledge Items
                  Find more libraries
                  Reuse Solution Kits and Libraries Curated by Popular Use Cases
                  Explore Kits

                  Save this library and start creating your kit

                  • © 2022 Open Weaver Inc.