问:
Why can't i get the content of an html table ?
I have this code that somehow scrapes a certain site. The problem is I can't proceed because I can't view the content of a table especially its . You can see when you print(table), it only shows the opening and closing tags if
 and doesn't include its content.

```<code>import requests
from bs4 import BeautifulSoup

url = 'http://www.scstac.org/pc.jsp'
page = requests.get(url)

soup = BeautifulSoup(page.text,'lxml')
table = soup.find('table', class_='table02')
print(table)
</code>```

答:
I was able to pull from the json response used to create the table:

```<code>import requests
from pandas.io.json import json_normalize
import pandas as pd

url = 'http://www.scstac.org/earthquake/now.do'

payload = {
        'dayCount': '1',
        'type': 'home'}

jsonData = requests.post(url, params=payload).json()
df = json_normalize(jsonData['earthHistory'])
df = df.dropna(axis=1)
df['timestamp'] = pd.to_datetime(df['dateStr'], unit = 'ms')
</code>```

Output:

```<code>print (df.to_string())
          dateStr     depth      dip         earthDateStr         earthId     earthStatus  earthquakeLevel earthquakePosImgPath      enEarthSendDate enEarthquakeInLand enEarthquakeInfoRevised enEarthquakePosImgPath        enMhtResPath enNum enPublisher               enReferencePlace     enSendDate enSended            enSourceArea enTsuinfoPath enTsunamiForecastsRevised enTsunamiLevel           enTsunamiType        enTxtResPath enWarterInfoRevised        enXmlResPath  feIndex    lat     lon magType                                  magType_magValues     rake         referencePlace   strike        type      upDateStr           timestamp
0   1585208284000   15000.0 -99999.9  2020/03/26 15:38:04  20200326233800   RELESED_ALARM              6.3   Earthquake_Pos.jpg  2020/03/26 15:44:54              false                   false     Earthquake_Pos.jpg  202003261538_1.mht  en_1         范婷婷          MINDANAO, PHILIPPINES  1585208694000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  202003261538_1.txt               false  202003261538_1.xml      259   5.63  125.22       M  Mw(mB)_6.375949859619141,Mwp_6.11729621887207,... -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1585208560000 2020-03-26 07:38:04
1   1579424301000   81000.0 -99999.9  2020/01/19 16:58:21  20200120005800  RELEASED_ALARM              6.3   Earthquake_Pos.jpg  2020/01/19 17:05:35              false                   false     Earthquake_Pos.jpg  202001191658_1.mht  en_1         赵联大  MINAHASSA PENINSULA, SULAWESI  1579424735000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  202001191658_1.txt               false  202001191658_1.xml      265  -0.22  123.94       M  Mw(mB)_6.259114742279053,Mwp_6.299142837524414... -99999.9               印尼米纳哈沙半岛 -99999.9  earthquake  1579424524000 2020-01-19 08:58:21
2   1576361512000   15000.0 -99999.9  2019/12/15 06:11:52  20191215141100   RELESED_ALARM              6.8   Earthquake_Pos.jpg  2019/12/15 06:19:35              false                   false     Earthquake_Pos.jpg  201912150611_1.mht  en_1         范婷婷          MINDANAO, PHILIPPINES  1576361975000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201912150611_1.txt               false  201912150611_1.xml      259   6.83  125.40       M  Mw(mB)_7.00132417678833,Mwp_6.967108726501465,... -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1576361787000 2019-12-14 22:11:52
3   1573719461000   45000.0     48.0  2019/11/14 16:17:41  20191115001700   RELESED_ALARM              7.1   Earthquake_Pos.jpg  2019/11/14 18:59:12              false                   false     Earthquake_Pos.jpg  201911141617_2.mht  en_2         王君成           NORTHERN MOLUCCA SEA  1573729152000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201911141617_2.txt               false  201911141617_2.xml      266   1.59  126.42       M  Mw(mB)_7.46810245513916,Mwp_7.501344680786133,...    107.0               印尼马鲁古海北部    219.0  earthquake  1573719694000 2019-11-14 08:17:41
4   1572455481000   15000.0 -99999.9  2019/10/31 01:11:21  20191031091100  RELEASED_ALARM              6.7   Earthquake_Pos.jpg  2019/10/31 01:19:42              false                   false     Earthquake_Pos.jpg  201910310111_1.mht  en_1         孙立宁          MINDANAO, PHILIPPINES  1572455982000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  201910310111_1.txt               false  201910310111_1.xml      259   6.93  125.28       M  Mw(mB)_6.769245624542236,Mwp_6.674487590789795... -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1572455820000 2019-10-30 17:11:21
5   1572282285000   15000.0 -99999.9  2019/10/29 01:04:45  20191029090400  REALESED_ALARM              6.8   Earthquake_Pos.jpg  2019/10/29 01:10:54              false                   false     Earthquake_Pos.jpg  201910290104_1.mht  en_1         王宗辰          MINDANAO, PHILIPPINES  1572282654000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201910290104_1.txt               false  201910290104_1.xml      259   6.97  125.21     Mwp  Mw(mB)_6.970869064331055,Mwp_6.800000190734863... -99999.9  Mindanao, Philippines -99999.9  earthquake  1572282575000 2019-10-28 17:04:45
6   1571197028000   15000.0 -99999.9  2019/10/16 11:37:08  20191016193700  REALESED_ALARM              6.5   Earthquake_Pos.jpg  2019/10/16 11:44:14              false                   false     Earthquake_Pos.jpg  201910161137_1.mht  en_1         李宏伟          MINDANAO, PHILIPPINES  1571197454000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201910161137_1.txt               false  201910161137_1.xml      259   6.83  125.14     Mwp  Mw(mB)_6.415266513824463,Mwp_6.5,mb_6.03484487... -99999.9  Mindanao, Philippines -99999.9  earthquake  1571197370000 2019-10-16 03:37:08
7   1562483319000   15000.0 -99999.9  2019/07/07 15:08:39  20190707230800  REALESED_ALARM              7.0   Earthquake_Pos.jpg  2019/07/07 15:21:34              false                   false     Earthquake_Pos.jpg  201907071508_1.mht  en_1         侯京明           NORTHERN MOLUCCA SEA  1562484094000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  201907071508_1.txt               false  201907071508_1.xml      266   0.57  126.31     Mwp  Mw(mB)_7.122064590454102,Mwp_7.0,mb_6.67208051... -99999.9   Northern Molucca Sea -99999.9  earthquake  1562483750000 2019-07-07 07:08:39
8   1555895485000   15000.0 -99999.9  2019/04/22 09:11:25  20190422171100  REALESED_ALARM              6.2   Earthquake_Pos.jpg  2019/04/22 09:21:15              false                   false     Earthquake_Pos.jpg  201904220911_1.mht  en_1          高义             LUZON, PHILIPPINES  1555896075000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  201904220911_1.txt               false  201904220911_1.xml      249  15.79  119.67     Mwp  Mw(mB)_5.8734540939331055,Mwp_6.19999980926513... -99999.9     Luzon, Philippines -99999.9  earthquake  1555895712000 2019-04-22 01:11:25
9   1553373452000   60000.0 -99999.9  2019/03/24 04:37:32  20190324123700  REALESED_ALARM              6.2   Earthquake_Pos.jpg  2019/03/24 04:48:04              false                   false     Earthquake_Pos.jpg  201903240437_1.mht  en_1         徐志国           NORTHERN MOLUCCA SEA  1553374084000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201903240437_1.txt               false  201903240437_1.xml      266   1.85  126.53     Mwp  Mw(mB)_6.164680480957031,Mwp_6.199999809265137... -99999.9   Northern Molucca Sea -99999.9  earthquake  1553373932000 2019-03-23 20:37:32
10  1546766840000   10000.0 -99999.9  2019/01/06 17:27:20  20190107012700  REALESED_ALARM              6.9   Earthquake_Pos.jpg  2019/01/06 17:34:36              false                   false     Earthquake_Pos.jpg  201901061727_1.mht  en_1         王宗辰           NORTHERN MOLUCCA SEA  1546767276000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201901061727_1.txt               false  201901061727_1.xml      266   2.26  126.77     Mwp  Mw(mB)_6.7626872062683105,Mwp_6.90000009536743... -99999.9   Northern Molucca Sea -99999.9  earthquake  1546767157000 2019-01-06 09:27:20
11  1502400505000  172000.0 -99999.9  2017/08/11 05:28:25  20170811132800  REALESED_ALARM              6.2   Earthquake_Pos.jpg  2017/08/11 05:48:14              false                   false     Earthquake_Pos.jpg  201708110528_1.mht  en_1          原野             LUZON, PHILIPPINES  1502401694000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201708110528_1.txt               false  201708110528_1.xml      249  14.00  120.74       M          Mw_6.199999809265137,M_6.199999809265137, -99999.9                 菲律宾吕宋岛 -99999.9  earthquake  1502401094000 2017-08-10 21:28:25
12  1495213578000  530000.0 -99999.9  2017/05/20 01:06:18  20170520090600  REALESED_ALARM              6.0   Earthquake_Pos.jpg  2017/05/20 01:15:04              false                   false     Earthquake_Pos.jpg  201705200106_1.mht  en_1          原野          MINDANAO, PHILIPPINES  1495214104000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201705200106_1.txt               false  201705200106_1.xml      259   9.38  123.95       M                                      Mw_6.0,M_6.0, -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1495213827000 2017-05-19 17:06:18
13  1493382198000   35000.0 -99999.9  2017/04/28 20:23:18  20170429042300       NEW_ALARM              6.9   Earthquake_Pos.jpg  2017/04/28 20:44:05              false                   false     Earthquake_Pos.jpg  201704282023_1.mht  en_1          原野          MINDANAO, PHILIPPINES  1493383445000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201704282023_1.txt               false  201704282023_1.xml      259   5.45  125.17      Mw          Mw_6.900000095367432,M_6.880000114440918, -99999.9  Mindanao, Philippines -99999.9  earthquake  1493383329000 2017-04-28 12:23:18
14  1484000028000  627000.0 -99999.9  2017/01/10 06:13:48  20170110141300  REALESED_ALARM              7.3   Earthquake_Pos.jpg  2017/01/10 06:27:13              false                   false     Earthquake_Pos.jpg  201701100613_1.mht  en_1          原野                    CELEBES SEA  1484000833000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201701100613_1.txt               false  201701100613_1.xml      262   4.48  122.62       M          Mw_7.300000190734863,M_7.300000190734863, -99999.9           苏拉威西海(西里伯斯海) -99999.9  earthquake  1513739142000 2017-01-09 22:13:48
15   209031067000   33000.0     35.0  1976/08/16 16:11:07  19760817001100  REALESED_ALARM              7.9   Earthquake_Pos.jpg  2017/12/22 06:28:20              false                   false     Earthquake_Pos.jpg  197608161611_3.mht  en_3          原野          MINDANAO, PHILIPPINES  1513895300000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  197608161611_3.txt               false  197608161611_3.xml      259   6.26  124.02       M          Mw_7.900000095367432,M_7.900000095367432,     92.0                菲律宾棉兰老岛    341.0  earthquake  1513893811000 1976-08-16 08:11:07
</code>```

Title: Why can't i get the content of an html table <td>?

Body:
I have this code that somehow scrapes a certain site. The problem is I can't proceed because I can't view the content of a table especially its . You can see when you print(table), it only shows the opening and closing tags if
 and doesn't include its content.

import requests
from bs4 import BeautifulSoup

url = 'http://www.scstac.org/pc.jsp'
page = requests.get(url)

soup = BeautifulSoup(page.text,'lxml')
table = soup.find('table', class_='table02')
print(table)

Body:
I was able to pull from the json response used to create the table:

import requests
from pandas.io.json import json_normalize
import pandas as pd

url = 'http://www.scstac.org/earthquake/now.do'

payload = {
        'dayCount': '1',
        'type': 'home'}

jsonData = requests.post(url, params=payload).json()
df = json_normalize(jsonData['earthHistory'])
df = df.dropna(axis=1)
df['timestamp'] = pd.to_datetime(df['dateStr'], unit = 'ms')

Output:

print (df.to_string())
          dateStr     depth      dip         earthDateStr         earthId     earthStatus  earthquakeLevel earthquakePosImgPath      enEarthSendDate enEarthquakeInLand enEarthquakeInfoRevised enEarthquakePosImgPath        enMhtResPath enNum enPublisher               enReferencePlace     enSendDate enSended            enSourceArea enTsuinfoPath enTsunamiForecastsRevised enTsunamiLevel           enTsunamiType        enTxtResPath enWarterInfoRevised        enXmlResPath  feIndex    lat     lon magType                                  magType_magValues     rake         referencePlace   strike        type      upDateStr           timestamp
0   1585208284000   15000.0 -99999.9  2020/03/26 15:38:04  20200326233800   RELESED_ALARM              6.3   Earthquake_Pos.jpg  2020/03/26 15:44:54              false                   false     Earthquake_Pos.jpg  202003261538_1.mht  en_1         范婷婷          MINDANAO, PHILIPPINES  1585208694000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  202003261538_1.txt               false  202003261538_1.xml      259   5.63  125.22       M  Mw(mB)_6.375949859619141,Mwp_6.11729621887207,... -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1585208560000 2020-03-26 07:38:04
1   1579424301000   81000.0 -99999.9  2020/01/19 16:58:21  20200120005800  RELEASED_ALARM              6.3   Earthquake_Pos.jpg  2020/01/19 17:05:35              false                   false     Earthquake_Pos.jpg  202001191658_1.mht  en_1         赵联大  MINAHASSA PENINSULA, SULAWESI  1579424735000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  202001191658_1.txt               false  202001191658_1.xml      265  -0.22  123.94       M  Mw(mB)_6.259114742279053,Mwp_6.299142837524414... -99999.9               印尼米纳哈沙半岛 -99999.9  earthquake  1579424524000 2020-01-19 08:58:21
2   1576361512000   15000.0 -99999.9  2019/12/15 06:11:52  20191215141100   RELESED_ALARM              6.8   Earthquake_Pos.jpg  2019/12/15 06:19:35              false                   false     Earthquake_Pos.jpg  201912150611_1.mht  en_1         范婷婷          MINDANAO, PHILIPPINES  1576361975000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201912150611_1.txt               false  201912150611_1.xml      259   6.83  125.40       M  Mw(mB)_7.00132417678833,Mwp_6.967108726501465,... -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1576361787000 2019-12-14 22:11:52
3   1573719461000   45000.0     48.0  2019/11/14 16:17:41  20191115001700   RELESED_ALARM              7.1   Earthquake_Pos.jpg  2019/11/14 18:59:12              false                   false     Earthquake_Pos.jpg  201911141617_2.mht  en_2         王君成           NORTHERN MOLUCCA SEA  1573729152000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201911141617_2.txt               false  201911141617_2.xml      266   1.59  126.42       M  Mw(mB)_7.46810245513916,Mwp_7.501344680786133,...    107.0               印尼马鲁古海北部    219.0  earthquake  1573719694000 2019-11-14 08:17:41
4   1572455481000   15000.0 -99999.9  2019/10/31 01:11:21  20191031091100  RELEASED_ALARM              6.7   Earthquake_Pos.jpg  2019/10/31 01:19:42              false                   false     Earthquake_Pos.jpg  201910310111_1.mht  en_1         孙立宁          MINDANAO, PHILIPPINES  1572455982000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  201910310111_1.txt               false  201910310111_1.xml      259   6.93  125.28       M  Mw(mB)_6.769245624542236,Mwp_6.674487590789795... -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1572455820000 2019-10-30 17:11:21
5   1572282285000   15000.0 -99999.9  2019/10/29 01:04:45  20191029090400  REALESED_ALARM              6.8   Earthquake_Pos.jpg  2019/10/29 01:10:54              false                   false     Earthquake_Pos.jpg  201910290104_1.mht  en_1         王宗辰          MINDANAO, PHILIPPINES  1572282654000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201910290104_1.txt               false  201910290104_1.xml      259   6.97  125.21     Mwp  Mw(mB)_6.970869064331055,Mwp_6.800000190734863... -99999.9  Mindanao, Philippines -99999.9  earthquake  1572282575000 2019-10-28 17:04:45
6   1571197028000   15000.0 -99999.9  2019/10/16 11:37:08  20191016193700  REALESED_ALARM              6.5   Earthquake_Pos.jpg  2019/10/16 11:44:14              false                   false     Earthquake_Pos.jpg  201910161137_1.mht  en_1         李宏伟          MINDANAO, PHILIPPINES  1571197454000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201910161137_1.txt               false  201910161137_1.xml      259   6.83  125.14     Mwp  Mw(mB)_6.415266513824463,Mwp_6.5,mb_6.03484487... -99999.9  Mindanao, Philippines -99999.9  earthquake  1571197370000 2019-10-16 03:37:08
7   1562483319000   15000.0 -99999.9  2019/07/07 15:08:39  20190707230800  REALESED_ALARM              7.0   Earthquake_Pos.jpg  2019/07/07 15:21:34              false                   false     Earthquake_Pos.jpg  201907071508_1.mht  en_1         侯京明           NORTHERN MOLUCCA SEA  1562484094000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  201907071508_1.txt               false  201907071508_1.xml      266   0.57  126.31     Mwp  Mw(mB)_7.122064590454102,Mwp_7.0,mb_6.67208051... -99999.9   Northern Molucca Sea -99999.9  earthquake  1562483750000 2019-07-07 07:08:39
8   1555895485000   15000.0 -99999.9  2019/04/22 09:11:25  20190422171100  REALESED_ALARM              6.2   Earthquake_Pos.jpg  2019/04/22 09:21:15              false                   false     Earthquake_Pos.jpg  201904220911_1.mht  en_1          高义             LUZON, PHILIPPINES  1555896075000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  201904220911_1.txt               false  201904220911_1.xml      249  15.79  119.67     Mwp  Mw(mB)_5.8734540939331055,Mwp_6.19999980926513... -99999.9     Luzon, Philippines -99999.9  earthquake  1555895712000 2019-04-22 01:11:25
9   1553373452000   60000.0 -99999.9  2019/03/24 04:37:32  20190324123700  REALESED_ALARM              6.2   Earthquake_Pos.jpg  2019/03/24 04:48:04              false                   false     Earthquake_Pos.jpg  201903240437_1.mht  en_1         徐志国           NORTHERN MOLUCCA SEA  1553374084000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201903240437_1.txt               false  201903240437_1.xml      266   1.85  126.53     Mwp  Mw(mB)_6.164680480957031,Mwp_6.199999809265137... -99999.9   Northern Molucca Sea -99999.9  earthquake  1553373932000 2019-03-23 20:37:32
10  1546766840000   10000.0 -99999.9  2019/01/06 17:27:20  20190107012700  REALESED_ALARM              6.9   Earthquake_Pos.jpg  2019/01/06 17:34:36              false                   false     Earthquake_Pos.jpg  201901061727_1.mht  en_1         王宗辰           NORTHERN MOLUCCA SEA  1546767276000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201901061727_1.txt               false  201901061727_1.xml      266   2.26  126.77     Mwp  Mw(mB)_6.7626872062683105,Mwp_6.90000009536743... -99999.9   Northern Molucca Sea -99999.9  earthquake  1546767157000 2019-01-06 09:27:20
11  1502400505000  172000.0 -99999.9  2017/08/11 05:28:25  20170811132800  REALESED_ALARM              6.2   Earthquake_Pos.jpg  2017/08/11 05:48:14              false                   false     Earthquake_Pos.jpg  201708110528_1.mht  en_1          原野             LUZON, PHILIPPINES  1502401694000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201708110528_1.txt               false  201708110528_1.xml      249  14.00  120.74       M          Mw_6.199999809265137,M_6.199999809265137, -99999.9                 菲律宾吕宋岛 -99999.9  earthquake  1502401094000 2017-08-10 21:28:25
12  1495213578000  530000.0 -99999.9  2017/05/20 01:06:18  20170520090600  REALESED_ALARM              6.0   Earthquake_Pos.jpg  2017/05/20 01:15:04              false                   false     Earthquake_Pos.jpg  201705200106_1.mht  en_1          原野          MINDANAO, PHILIPPINES  1495214104000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201705200106_1.txt               false  201705200106_1.xml      259   9.38  123.95       M                                      Mw_6.0,M_6.0, -99999.9                菲律宾棉兰老岛 -99999.9  earthquake  1495213827000 2017-05-19 17:06:18
13  1493382198000   35000.0 -99999.9  2017/04/28 20:23:18  20170429042300       NEW_ALARM              6.9   Earthquake_Pos.jpg  2017/04/28 20:44:05              false                   false     Earthquake_Pos.jpg  201704282023_1.mht  en_1          原野          MINDANAO, PHILIPPINES  1493383445000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201704282023_1.txt               false  201704282023_1.xml      259   5.45  125.17      Mw          Mw_6.900000095367432,M_6.880000114440918, -99999.9  Mindanao, Philippines -99999.9  earthquake  1493383329000 2017-04-28 12:23:18
14  1484000028000  627000.0 -99999.9  2017/01/10 06:13:48  20170110141300  REALESED_ALARM              7.3   Earthquake_Pos.jpg  2017/01/10 06:27:13              false                   false     Earthquake_Pos.jpg  201701100613_1.mht  en_1          原野                    CELEBES SEA  1484000833000     true  South China Sea source   tsuinfo.txt                     false           BLUE     Tsunami Information  201701100613_1.txt               false  201701100613_1.xml      262   4.48  122.62       M          Mw_7.300000190734863,M_7.300000190734863, -99999.9           苏拉威西海(西里伯斯海) -99999.9  earthquake  1513739142000 2017-01-09 22:13:48
15   209031067000   33000.0     35.0  1976/08/16 16:11:07  19760817001100  REALESED_ALARM              7.9   Earthquake_Pos.jpg  2017/12/22 06:28:20              false                   false     Earthquake_Pos.jpg  197608161611_3.mht  en_3          原野          MINDANAO, PHILIPPINES  1513895300000     true  South China Sea source   tsuinfo.txt                     false           BLUE  Tsunami Threat Message  197608161611_3.txt               false  197608161611_3.xml      259   6.26  124.02       M          Mw_7.900000095367432,M_7.900000095367432,     92.0                菲律宾棉兰老岛    341.0  earthquake  1513893811000 1976-08-16 08:11:07


来源: stackexchange

问:
"FILESTREAM Access Level" stuck at disabled
SQL Server "FILESTREAM Access Level" is stuck at disabled. I have checked all ways by SSMS and queries.

After restart, also my configured value is Full Access but Running value is disabled:

Windows 10 Enterprise v1703 Build 15063 Redstone 2

答:
MSDN Social

My experience is that the SQL Management Studio does not facilitate enabling FILESTREAM.
This is done on the SQL Server Configuration Manager, on the instance...

Then, when creating a FILESTREAM folder, its accessed by
\\[machine name]\[SQL Instance]\[TableName]

ContentLicense: CC BY-SA 3.0

ContentLicense: CC BY-SA 4.0


问:
How to include header.html.twig file in page.html.twig file in drupal 8
I have page.html.twig file in drupal 8X version in that file how to include header.html.twig file which is located as includes directory in same theme directory</p>

答:
The correct method for Drupal 8 themes is to use Twig namespaces to declare the current theme "templates" directory. Here is an example:

```<code>{% include '@THEME_NAME/includes/header.html.twig' %}
</code>```

Below is an example taken from a working theme on Drupal.org called Architect.
"@architect" refers to /templates in the working theme (architect) directory.

```<code>{% include '@architect/includes/header.html.twig' %}
</code>```

Body:
The correct method for Drupal 8 themes is to use Twig namespaces to declare the current theme "templates" directory. Here is an example:

{% include '@THEME_NAME/includes/header.html.twig' %}

Below is an example taken from a working theme on Drupal.org called Architect.
"@architect" refers to /templates in the working theme (architect) directory.

{% include '@architect/includes/header.html.twig' %}


问:
Consuming OpenRasta services
Following advice on here, I am looking at whether to replace WCF with OpenRasta.

In Visual Studio, how do I consume an OpenRasta in the same way as I would a WCF/ASMX service e.g. Add a service reference, this handles the types using WSDL.

I can't find any examples which don't require a custom WebRequest and parse the xml, which for us is a significant step backwards for utilising a service in code.

答:
As Colin says, ReSTful services are by definition hypermedia oriented, so generating lots and lots of RPC style code a la WSDL is not doable, it would break hypermedia.

You can still happily generate datacontract-style classes from an xsd and read those from the xml, it's at most 4 lines of code.

Title: Consuming OpenRasta services


问:
How to get the device token from laravel to send push notification?
I'm new to laravel and I want to send a push notification to my android and ios device. I know how to send push notification but I don't know how to  get the device token.</p>

答:
In your class that extends FirebaseMessagingService Service in onNewToken method send the new token to the back-end and store it in database and whenever you wan't to send notification through backend(laravel) use that token...</p>

```<code>public class MyFirebaseMessagingService extends FirebaseMessagingService {

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    ...
}

@Override
public void onNewToken(@NonNull String token) {
    super.onNewToken(token);
    sendTokenToServer(token);
}
private void sendTokenToServer(String token) {
    //Send it to server using retrofit or any other lib that you're familiar with
}
}
</code>```

Body:
In your class that extends FirebaseMessagingService Service in onNewToken method send the new token to the back-end and store it in database and whenever you wan't to send notification through backend(laravel) use that token...

public class MyFirebaseMessagingService extends FirebaseMessagingService {

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    ...
}

@Override
public void onNewToken(@NonNull String token) {
    super.onNewToken(token);
    sendTokenToServer(token);
}
private void sendTokenToServer(String token) {
    //Send it to server using retrofit or any other lib that you're familiar with
}
}


问:
error: Failed to run the post merge process
I'm trying to generate documents using conga composer 8 from apex code but its failing with error  Failed to run the post-merge process. I have looked into url and its same as the one I used initially in another salesforce org. I couldn't find any help online or on conga-composer form.

Here is my conga endpoint URL:

```<code>https://composer.congamerge.com/Composer8/Index.Html? sessionId=00D41000000dorw!ARQAQKbinH5TXMR_70s3XCShQh5GuSVdrFcq0Fg9OidZLo9MLxzWSby8QY1B4xM8e72DPawVziclnXBjTzpG41RiCAPKQqOt
&serverUrl=https://na35.salesforce.com/services/Soap/u/29.0/00D41000000dorwEAA
&id=a1J410000012BwS
&TemplateId=a0C41000000kg5GEAQ
&APIMODE=13
&ESAgreementName=Contract+for+Test
&queryid=a0441000001PwI7AAK,a0441000001PwICAA0
&ESSignatureType=2
&ESSignatureOrder=2
&ESVisible=1
&ESCustomField=cldocgen__App__c
&ESCustomFieldValue=a1J410000012BwSEAU
&ESRecipient1=00541000000Ke9pAAC
&ESRecipient2=003410000078zVbAAI
&ESRecipient3=003410000078zVhAAI, Method=GET]
</code>```

Any insight what might be causing this issue.

答:
Apart from what Greg has mentioned, there are 2 more observations for this error:

Under Email Administration -> Deliverability -> Access to Send Email (All Email Services) should be set to All email.

In case you are using the EmailTemplateId parameter then the classic email template must be available for use.

Also mostly this error is also because of some discrepancy in the URL.

Body:
I'm trying to generate documents using conga composer 8 from apex code but its failing with error  Failed to run the post-merge process. I have looked into url and its same as the one I used initially in another salesforce org. I couldn't find any help online or on conga-composer form.

Here is my conga endpoint URL:

https://composer.congamerge.com/Composer8/Index.Html? sessionId=00D41000000dorw!ARQAQKbinH5TXMR_70s3XCShQh5GuSVdrFcq0Fg9OidZLo9MLxzWSby8QY1B4xM8e72DPawVziclnXBjTzpG41RiCAPKQqOt
&serverUrl=https://na35.salesforce.com/services/Soap/u/29.0/00D41000000dorwEAA
&id=a1J410000012BwS
&TemplateId=a0C41000000kg5GEAQ
&APIMODE=13
&ESAgreementName=Contract+for+Test
&queryid=a0441000001PwI7AAK,a0441000001PwICAA0
&ESSignatureType=2
&ESSignatureOrder=2
&ESVisible=1
&ESCustomField=cldocgen__App__c
&ESCustomFieldValue=a1J410000012BwSEAU
&ESRecipient1=00541000000Ke9pAAC
&ESRecipient2=003410000078zVbAAI
&ESRecipient3=003410000078zVhAAI, Method=GET]

Any insight what might be causing this issue.


问:
Scroll bar when scroll right i need the element always stay in the right
I have a situation:

in this page the bordered label in red in the right side which is the default of a table

And when i moved the sroll bar to the right the bordered label in red move to the center

The problem is i don`t need the bordered labeled in red to move wherever in scrolled right or left.
what i mean is i need that bordered labeled in red to stay on the right when scrolled right or left.

This is the table Code:

```<code>   <table class="table table-striped datatable-responsive overflow-auto" id="table">
</code>```

and im just thinking to right a function like

```<code>function whenScrolled()
{
   var element = document.getElementbyId("labelborderedinred");
   //set the position of element current position + new position?
}
</code>```

the element of red labeled on top

```<code>#table_length
</code>```

the element of red labeled below

```<code>#table_paginate
</code>```

Any idea is pretty much appreciated.
Thanks in advance.

答:
The thing you want is abit tricky, yuou need to have the HTML structure to get this done,if you keep the HTML structure like the example below, you can do it with the CSS only. you need to play with your css a bit to as I am not aware of your table data

.table {table-layout: fixed; width: 100%;min-width: 1000px;}
td {background: #ddd;}
.parent {
    overflow: hidden;
    position: relative;
}
.tableWrapper {
      position: relative;
    overflow-x: auto;
    padding-bottom: 40px;
}
.nextPrevious {
  position: absolute;
    right: 10px;
    top: 40%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="parent">
<div class="tableWrapper">
<table class="table table-striped datatable-responsive overflow-auto" id="table">
  <tbody>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
      <td>5</td>
      <td>6</td>
    </tr>
  </tbody>
</table>
</div>
<div class="nextPrevious">Next previous Div</div>
</div></code>```

Body:
I have a situation:

in this page the bordered label in red in the right side which is the default of a table

And when i moved the sroll bar to the right the bordered label in red move to the center

The problem is i don`t need the bordered labeled in red to move wherever in scrolled right or left.
what i mean is i need that bordered labeled in red to stay on the right when scrolled right or left.

This is the table Code:

and im just thinking to right a function like

function whenScrolled()
{
   var element = document.getElementbyId("labelborderedinred");
   //set the position of element current position + new position?
}

the element of red labeled on top

#table_length

the element of red labeled below

#table_paginate

Any idea is pretty much appreciated.
Thanks in advance.

Body:
The thing you want is abit tricky, yuou need to have the HTML structure to get this done,if you keep the HTML structure like the example below, you can do it with the CSS only. you need to play with your css a bit to as I am not aware of your table data

.table {table-layout: fixed; width: 100%;min-width: 1000px;}
td {background: #ddd;}
.parent {
    overflow: hidden;
    position: relative;
}
.tableWrapper {
      position: relative;
    overflow-x: auto;
    padding-bottom: 40px;
}
.nextPrevious {
  position: absolute;
    right: 10px;
    top: 40%;
}

<div class="parent">
<div class="tableWrapper">
<table class="table table-striped datatable-responsive overflow-auto" id="table">
  <tbody>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
      <td>5</td>
      <td>6</td>
    </tr>
  </tbody>
</table>
</div>
<div class="nextPrevious">Next previous Div</div>
</div>


问:
How to resolve MongoDB query bracket errors?
```<code>db.restaurants.find({ $or: [ { $and: [ {cuisine: {$ne: 'American'}}, {cuisine: {$ne: 'Chinese'}} ] }]}, {name: "/^Wil/"} ] }, {name: 1, cuisine:1})
</code>```

Error:

```<code>uncaught exception: SyntaxError: missing ) after argument list :
</code>```

These kind of long queries have many brackets and I am unable to match them properly. Is there a particular tool/ IDE that we are supposed to use for writing these queries?

答:
Try this one:

```<code>db.restaurants.find({
  $or: [
    {
      $and: [
        {
          cuisine: {
            $ne: "American"
          }
        },
        {
          cuisine: {
            $ne: "Chinese"
          }
        }
      ]
    },
    {
      name: /^Wil/
    }
  ]
},
{
  name: 1,
  cuisine: 1
})
</code>```

MongoPlayground

For pretty easy queries, use MongoPlayground.
For more complex queries, I usually use Robo3t / Studio3t.

Body:
db.restaurants.find({ $or: [ { $and: [ {cuisine: {$ne: 'American'}}, {cuisine: {$ne: 'Chinese'}} ] }]}, {name: "/^Wil/"} ] }, {name: 1, cuisine:1})

Error:

uncaught exception: SyntaxError: missing ) after argument list :

These kind of long queries have many brackets and I am unable to match them properly. Is there a particular tool/ IDE that we are supposed to use for writing these queries?

Body:
Try this one:

db.restaurants.find({
  $or: [
    {
      $and: [
        {
          cuisine: {
            $ne: "American"
          }
        },
        {
          cuisine: {
            $ne: "Chinese"
          }
        }
      ]
    },
    {
      name: /^Wil/
    }
  ]
},
{
  name: 1,
  cuisine: 1
})

MongoPlayground

For pretty easy queries, use MongoPlayground.
For more complex queries, I usually use Robo3t / Studio3t.


问:
How to change the value of outside variable from inside the method
I am trying to change the value of a variable "memes"
in a function called "joke". Joke function should change the value of memes to 1313, but it does not and when the print(str(memes)) is triggered the value of "memes" variable is still 0.

```<code>class Bruhmoment:
    memes = 0
    def __init__(self, name):
        self.name=name
    global memes
    def joke(self):
        memes=1313
        print(str(memes))
</code>```

答:
You have to return the new value. Add return memes to the end of your function like so:

def joke():
    memes = 1313
    return memes
```

Body:
I am trying to change the value of a variable "memes"
in a function called "joke". Joke function should change the value of memes to 1313, but it does not and when the print(str(memes)) is triggered the value of "memes" variable is still 0.

class Bruhmoment:
    memes = 0
    def __init__(self, name):
        self.name=name
    global memes
    def joke(self):
        memes=1313
        print(str(memes))


问:
Force Browser to cache images
I am generating the images and want browser to cache them forever, but instead browser never cache them at all.
This is my php code

```<code>
header('Content-type:'.$file->content_type);
header('Expires: Thu, 15 Apr '.(date('Y')+10).' 20:00:00 GMT');
header('Content-Disposition: attachment; filename="'.$file->file_name.'"');
echo(file_get_contents($model_files->files_path.$file->md5.$model_files->seprator.$file->file_name));
</code>```

and these are the response headers which i keep getting in browser.

```<code>Date:            Thu, 02 Jun 2011 12:56:56 GMT
Server:          Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By     PHP/5.2.15
Cache-Control    no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma           no-cache
Expires          Thu, 15 Apr 2021 20:00:00 GMT
Content-Length   321823
Keep-Alive       timeout=5, max=100
Connection       Keep-Alive
Content-Type     image/png</code>```

I am not setting Date, Cache-Control and Pragma but keep getting them in response.

I know i can overwrite them but honestly i don't exactly know which values to set.

答: Have a look at session_cache_limiter.

Title: Force Browser to cache images

Body:
I am generating the images and want browser to cache them forever, but instead browser never cache them at all.
This is my php code

header('Content-type:'.$file->content_type);
header('Expires: Thu, 15 Apr '.(date('Y')+10).' 20:00:00 GMT');
header('Content-Disposition: attachment; filename="'.$file->file_name.'"');
echo(file_get_contents($model_files->files_path.$file->md5.$model_files->seprator.$file->file_name));

and these are the response headers which i keep getting in browser.

Date:            Thu, 02 Jun 2011 12:56:56 GMT
Server:          Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By     PHP/5.2.15
Cache-Control    no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma           no-cache
Expires          Thu, 15 Apr 2021 20:00:00 GMT
Content-Length   321823
Keep-Alive       timeout=5, max=100
Connection       Keep-Alive
Content-Type     image/png

I am not setting Date, Cache-Control and Pragma but keep getting them in response.

I know i can overwrite them but honestly i don't exactly know which values to set.

Body: Have a look at session_cache_limiter.


问:
Samsung default browser or any default browser in android is not supporting back camera
Below is my code, I am making qr code scanner(for Mobile device) using the below plugin

https://github.com/cozmo/jsQR

which supports almost Chrome, Mozilla FireFox, Opera, MS EDGE in Mobile devices, but I am trying to achieve in all latest devices default browsers(android- mostly Samsung devices) also its working but instead of taking rear camera(back camera) its taking front camera (user facing) for that I have written a code as per developers Mozilla group

```<code>{ facingMode: { exact: "environment" } }
</code>```

here is my code

```<code> navigator.mediaDevices.getUserMedia({ video: { facingMode: { exact: "environment" } } }).then(function(stream) {
                  video.srcObject = stream;
                  video.setAttribute("playsinline", true); // required to tell iOS safari we don't want fullscreen
                  video.play();
                  requestAnimationFrame(tick);
                  localStream = stream;
                })
                .catch(function(err) {
                    console.log(err);
                      /* handle the error */
                });
</code>```

答:
should this (~line 18):

```<code>var constraints =  {facingMode: videoDevices[1] };
</code>```

be

```<code>var constraints =  {deviceID: {exact: videoDevices[1]} };
</code>```

ps: verified that Samsung S4 still has the issue

Body:
Below is my code, I am making qr code scanner(for Mobile device) using the below plugin

https://github.com/cozmo/jsQR

which supports almost Chrome, Mozilla FireFox, Opera, MS EDGE in Mobile devices, but I am trying to achieve in all latest devices default browsers(android- mostly Samsung devices) also its working but instead of taking rear camera(back camera) its taking front camera (user facing) for that I have written a code as per developers Mozilla group

{ facingMode: { exact: "environment" } }

here is my code

 navigator.mediaDevices.getUserMedia({ video: { facingMode: { exact: "environment" } } }).then(function(stream) {
                  video.srcObject = stream;
                  video.setAttribute("playsinline", true); // required to tell iOS safari we don't want fullscreen
                  video.play();
                  requestAnimationFrame(tick);
                  localStream = stream;
                })
                .catch(function(err) {
                    console.log(err);
                      /* handle the error */
                });

Body:
should this (~line 18):

var constraints =  {facingMode: videoDevices[1] };

be

var constraints =  {deviceID: {exact: videoDevices[1]} };

ps: verified that Samsung S4 still has the issue


问:
How to avoid splitting of word with case
Below is the text that I want to split:

```<code>string content = "Tonight the warning from the Police commissioner as they crack down on anyone who leaves there house without a 'reasonable excuse'
(TAKE SOT)"

string[] contentList = content.split(' ');
</code>```

I do not want to split the word i.e (TAKE SOT), if there is a text within parentheses and in an upper case then how to avoid splitting of the part.

Thanks

答:
Later after doing some research I found a solution for the problem:

```<code>public class Program
{
    public static void Main()
    {
        string BEFORE_AND_AFTER_SOUND_EFFECT = @"\(([A-Z\s]*)\)";
        List<string> wordList = new List<string>();
        string content = "Tonight the warning from the Police commissioner as they (VO) crack down on anyone who leaves there house without a 'reasonable excuse' (TAKE SOT) INCUE:police will continue to be out there.";
        GetWords(content, wordList, BEFORE_AND_AFTER_SOUND_EFFECT);

        foreach(var item in wordList)
        {
            Console.WriteLine(item);
        }
    }

    private static void GetWords(string content, List<string> wordList, string BEFORE_AND_AFTER_SOUND_EFFECT)
    {
        if(content.Length>0)
        {
            if (Regex.IsMatch(content, BEFORE_AND_AFTER_SOUND_EFFECT))
            {
                int textLength = content.Substring(0, Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Index).Length;
                int matchLength = Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Length;
                string[] words = content.Substring(0, Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Index - 1).Split(' ');
                foreach (var word in words)
                {
                    wordList.Add(word);
                }
                wordList.Add(content.Substring(Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Index, Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Length));
                content = content.Substring((textLength + matchLength) + 1); // Remaining content
                GetWords(content, wordList, BEFORE_AND_AFTER_SOUND_EFFECT);
            }
            else
            {
               wordList.Add(content);
               content = content.Substring(content.Length); // Remaining content
               GetWords(content, wordList, BEFORE_AND_AFTER_SOUND_EFFECT);
           }
        }
    }
}
</code>```

Thanks.

Body:
Below is the text that I want to split:

string content = "Tonight the warning from the Police commissioner as they crack down on anyone who leaves there house without a 'reasonable excuse'
(TAKE SOT)"

string[] contentList = content.split(' ');

I do not want to split the word i.e (TAKE SOT), if there is a text within parentheses and in an upper case then how to avoid splitting of the part.

Thanks

Body:
Later after doing some research I found a solution for the problem:

public class Program
{
    public static void Main()
    {
        string BEFORE_AND_AFTER_SOUND_EFFECT = @"\(([A-Z\s]*)\)";
        List<string> wordList = new List<string>();
        string content = "Tonight the warning from the Police commissioner as they (VO) crack down on anyone who leaves there house without a 'reasonable excuse' (TAKE SOT) INCUE:police will continue to be out there.";
        GetWords(content, wordList, BEFORE_AND_AFTER_SOUND_EFFECT);

        foreach(var item in wordList)
        {
            Console.WriteLine(item);
        }
    }

    private static void GetWords(string content, List<string> wordList, string BEFORE_AND_AFTER_SOUND_EFFECT)
    {
        if(content.Length>0)
        {
            if (Regex.IsMatch(content, BEFORE_AND_AFTER_SOUND_EFFECT))
            {
                int textLength = content.Substring(0, Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Index).Length;
                int matchLength = Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Length;
                string[] words = content.Substring(0, Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Index - 1).Split(' ');
                foreach (var word in words)
                {
                    wordList.Add(word);
                }
                wordList.Add(content.Substring(Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Index, Regex.Match(content, BEFORE_AND_AFTER_SOUND_EFFECT).Length));
                content = content.Substring((textLength + matchLength) + 1); // Remaining content
                GetWords(content, wordList, BEFORE_AND_AFTER_SOUND_EFFECT);
            }
            else
            {
               wordList.Add(content);
               content = content.Substring(content.Length); // Remaining content
               GetWords(content, wordList, BEFORE_AND_AFTER_SOUND_EFFECT);
           }
        }
    }
}

Thanks.


问:
get the value based on two fields form single table
I have a table user with below fields .

```<code> id user_name   team       onsite_offshore
 1   xxx        US East     offshore
 2   YYY        US East     onsite
 3   zzz        US East     onsite
 4   aaa        Us West     onsite
 5   bbb        US West     offshore
</code>```

I have two dependency dropdown  geo and location with geo values 'US East' and 'US West'  and
location value 'US East and premisis' for'US East'

'US West and premisis' for 'US West dropdown'.

geo        Location

US East - US East,offshore(display as 2 options one by one)
US West - US West and offshore(display as 2 options one by one)

```<code>  on choosing US East in localtion  with geo 'US East' dropdow I want to load the value 'yyy,zzz' which is not inluded in offshore(which is in same table with different column.)
       on choosing offshore in localtion dropdown for geo 'US EASt'I want to load the value 'XXX' which is should inluded in offshore(which is in same table with different column.)

  on choosing US West in localtion  with geo 'US West' dropdown I want to load the value 'aaa' which is not inluded in offshore(which is in same table with different column.)
       on choosing offshore in localtion dropdown for geo 'US West' I want to load the value 'bbb' which is should inluded in offshore(which is in same table with different column.)

$filter_team_details=DB::table('user_master')->leftjoin('user_teams','user_teams.team','=','user_master.geo')->whereIn('user_teams.team',$teams)->groupBy('user_teams.team')->pluck('user_teams.team')->toArray(); (In this query I want to check for onsite_offshore condition in same query )
</code>```

Is it possible to check both condition single table as

答:
I don't know why you are using whereIn , Your query can be simple written like this for muliple condition :

```<code>    $filter_team_details = DB::table('user_master')
                           ->leftjoin('user_teams','user_teams.team','=','user_master.geo')
                           ->where('user_teams.team',$teams)
                           ->where('user_teams.onsite_offshore',$nameOfyourVariable)
                           ->groupBy('user_teams.team')
                           ->pluck('user_teams.team')
                           ->toArray();
</code>```

Although You can use whereIn if you wish, I hope it is helpful for you :)

Body:
I have a table user with below fields .

 id user_name   team       onsite_offshore
 1   xxx        US East     offshore
 2   YYY        US East     onsite
 3   zzz        US East     onsite
 4   aaa        Us West     onsite
 5   bbb        US West     offshore

I have two dependency dropdown  geo and location with geo values 'US East' and 'US West'  and
location value 'US East and premisis' for'US East'

'US West and premisis' for 'US West dropdown'.

geo        Location

US East - US East,offshore(display as 2 options one by one)
US West - US West and offshore(display as 2 options one by one)

  on choosing US East in localtion  with geo 'US East' dropdow I want to load the value 'yyy,zzz' which is not inluded in offshore(which is in same table with different column.)
       on choosing offshore in localtion dropdown for geo 'US EASt'I want to load the value 'XXX' which is should inluded in offshore(which is in same table with different column.)

  on choosing US West in localtion  with geo 'US West' dropdown I want to load the value 'aaa' which is not inluded in offshore(which is in same table with different column.)
       on choosing offshore in localtion dropdown for geo 'US West' I want to load the value 'bbb' which is should inluded in offshore(which is in same table with different column.)

$filter_team_details=DB::table('user_master')->leftjoin('user_teams','user_teams.team','=','user_master.geo')->whereIn('user_teams.team',$teams)->groupBy('user_teams.team')->pluck('user_teams.team')->toArray(); (In this query I want to check for onsite_offshore condition in same query )

Is it possible to check both condition single table as

Body:
I don't know why you are using whereIn , Your query can be simple written like this for muliple condition :

    $filter_team_details = DB::table('user_master')
                           ->leftjoin('user_teams','user_teams.team','=','user_master.geo')
                           ->where('user_teams.team',$teams)
                           ->where('user_teams.onsite_offshore',$nameOfyourVariable)
                           ->groupBy('user_teams.team')
                           ->pluck('user_teams.team')
                           ->toArray();

Although You can use whereIn if you wish, I hope it is helpful for you :)


问:
Find the selected column in the excel vba
```<code>For Each Sheet In ActiveWorkbook.Sheets
        If Sheet.Index <> 1 Then
           Sheet.Activate
           Range("B1").Select
           Call Something
        ElseIf Sheet.Index = 1 Then
           Sheet.Activate
           Range("A1").Select
           Call Something_new
        End If
    Next Sheet
</code>```

I'm doing a project, in which if I filter something in a (column)sheet it will synchronize in every other (column)sheet.
 In the above code, I'm using the "if" conditions based on the sheet index.
I need to use condition based on selected column, something like this

```<code>if filters are made on Column A Then
Range("A1").select
Call something
if filters are made on Column B Then
Range("B1").select
Call something_else
</code>```

I need some suggestions,

答:
These basics might be exactly what you need - on a standard filtered sheet (sheet1 for me):

```<code>If Sheet1.AutoFilter.Filters.Item(1).On Then MsgBox ("Filter 1 is on")
</code>```

Item 1 will be the first column, column A. You could test each one like so:

```<code>If Sheet1.AutoFilter.Filters.Item(1).On Then MsgBox ("Filter 1 is on")
If Sheet1.AutoFilter.Filters.Item(2).On Then MsgBox ("Filter 2 is on")
</code>```

etc. or you could cycle through dynamically testing like this:

```<code>Sub SelectFirstColumnWithFilter
    Dim i As Long
    For i = 1 To Sheet1.AutoFilter.Filters.Count
        If Sheet1.AutoFilter.Filters.Item(i).On Then Cells(1, i).Select: Exit Sub
    Next i
End Sub
</code>```

Body:
For Each Sheet In ActiveWorkbook.Sheets
        If Sheet.Index <> 1 Then
           Sheet.Activate
           Range("B1").Select
           Call Something
        ElseIf Sheet.Index = 1 Then
           Sheet.Activate
           Range("A1").Select
           Call Something_new
        End If
    Next Sheet

I'm doing a project, in which if I filter something in a (column)sheet it will synchronize in every other (column)sheet.
 In the above code, I'm using the "if" conditions based on the sheet index.
I need to use condition based on selected column, something like this

if filters are made on Column A Then
Range("A1").select
Call something
if filters are made on Column B Then
Range("B1").select
Call something_else

I need some suggestions,

Body:
These basics might be exactly what you need - on a standard filtered sheet (sheet1 for me):

If Sheet1.AutoFilter.Filters.Item(1).On Then MsgBox ("Filter 1 is on")

Item 1 will be the first column, column A. You could test each one like so:

If Sheet1.AutoFilter.Filters.Item(1).On Then MsgBox ("Filter 1 is on")
If Sheet1.AutoFilter.Filters.Item(2).On Then MsgBox ("Filter 2 is on")

etc. or you could cycle through dynamically testing like this:

Sub SelectFirstColumnWithFilter
    Dim i As Long
    For i = 1 To Sheet1.AutoFilter.Filters.Count
        If Sheet1.AutoFilter.Filters.Item(i).On Then Cells(1, i).Select: Exit Sub
    Next i
End Sub


问:
Inspecting and managing the Azure Service Bus dead letter queue
I'm using an Azure Service Bus queue.

I need to implement a diagnostic web page to show the list of items in the 'dead letter queue' (DLQ), inspect it and when I decide, move a single DLQ message to the main queue for reprocessing.

I think I have to use the "Microsoft.Azure.ServiceBus" namespace, maybe the ManagementClient, but I'm not sure this is the right way to follow.

Does anyone have an example on how to do it?

I would like to implement something like the DLQ management of Service Bus Explorer that allows to submit a message again.

答:
I think I have to use the "Microsoft.Azure.ServiceBus" namespace,
  maybe the ManagementClient, but I'm not sure this is the right way to
  follow.

Since you're dealing with messages (i.e. data), you will need to use Microsoft.Azure.ServiceBus namespace. Management namespace is for managing namespaces, queues, topics etc.

Please see this link for code samples: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues.

From this link:

```<code>namespace CoreReceiverApp
{
    using System;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.Azure.ServiceBus;

    class Program
    {
        // Connection String for the namespace can be obtained from the Azure portal under the
        // 'Shared Access policies' section.
        const string ServiceBusConnectionString = "<your_connection_string>";
        const string QueueName = "<your_queue_name>";
        static IQueueClient queueClient;

        static void Main(string[] args)
        {
            MainAsync().GetAwaiter().GetResult();
        }

        static async Task MainAsync()
        {
            queueClient = new QueueClient(ServiceBusConnectionString, QueueName);

            Console.WriteLine("======================================================");
            Console.WriteLine("Press ENTER key to exit after receiving all the messages.");
            Console.WriteLine("======================================================");

            // Register QueueClient's MessageHandler and receive messages in a loop
            RegisterOnMessageHandlerAndReceiveMessages();

            Console.ReadKey();

            await queueClient.CloseAsync();
        }

        static void RegisterOnMessageHandlerAndReceiveMessages()
        {
            // Configure the MessageHandler Options in terms of exception handling, number of concurrent messages to deliver etc.
            var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler)
            {
                // Maximum number of Concurrent calls to the callback `ProcessMessagesAsync`, set to 1 for simplicity.
                // Set it according to how many messages the application wants to process in parallel.
                MaxConcurrentCalls = 1,

                // Indicates whether MessagePump should automatically complete the messages after returning from User Callback.
                // False below indicates the Complete will be handled by the User Callback as in `ProcessMessagesAsync` below.
                AutoComplete = false
            };

            // Register the function that will process messages
            queueClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions);
        }

        static async Task ProcessMessagesAsync(Message message, CancellationToken token)
        {
            // Process the message
            Console.WriteLine($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}");

            // Complete the message so that it is not received again.
            // This can be done only if the queueClient is created in ReceiveMode.PeekLock mode (which is default).
            await queueClient.CompleteAsync(message.SystemProperties.LockToken);

            // Note: Use the cancellationToken passed as necessary to determine if the queueClient has already been closed.
            // If queueClient has already been Closed, you may chose to not call CompleteAsync() or AbandonAsync() etc. calls
            // to avoid unnecessary exceptions.
        }

        static Task ExceptionReceivedHandler(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
        {
            Console.WriteLine($"Message handler encountered an exception {exceptionReceivedEventArgs.Exception}.");
            var context = exceptionReceivedEventArgs.ExceptionReceivedContext;
            Console.WriteLine("Exception context for troubleshooting:");
            Console.WriteLine($"- Endpoint: {context.Endpoint}");
            Console.WriteLine($"- Entity Path: {context.EntityPath}");
            Console.WriteLine($"- Executing Action: {context.Action}");
            return Task.CompletedTask;
        }
    }
}
</code>```

It's a console app that receives messages from a queue. In order to receive messages from DLQ, you simply need to change the name of the queue to <your-queue-name>/$deadletterqueue.

Again this code creates a receiver that constantly receives the messages from a queue and since you are building a webpage, you will need to receive messages on demand or implement some kind of websocket kind of functionality so that server can push the changes to the client.

Body:
I think I have to use the "Microsoft.Azure.ServiceBus" namespace,
  maybe the ManagementClient, but I'm not sure this is the right way to
  follow.

Since you're dealing with messages (i.e. data), you will need to use Microsoft.Azure.ServiceBus namespace. Management namespace is for managing namespaces, queues, topics etc.

Please see this link for code samples: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues.

From this link:

namespace CoreReceiverApp
{
    using System;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.Azure.ServiceBus;

    class Program
    {
        // Connection String for the namespace can be obtained from the Azure portal under the
        // 'Shared Access policies' section.
        const string ServiceBusConnectionString = "<your_connection_string>";
        const string QueueName = "<your_queue_name>";
        static IQueueClient queueClient;

        static void Main(string[] args)
        {
            MainAsync().GetAwaiter().GetResult();
        }

        static async Task MainAsync()
        {
            queueClient = new QueueClient(ServiceBusConnectionString, QueueName);

            Console.WriteLine("======================================================");
            Console.WriteLine("Press ENTER key to exit after receiving all the messages.");
            Console.WriteLine("======================================================");

            // Register QueueClient's MessageHandler and receive messages in a loop
            RegisterOnMessageHandlerAndReceiveMessages();

            Console.ReadKey();

            await queueClient.CloseAsync();
        }

        static void RegisterOnMessageHandlerAndReceiveMessages()
        {
            // Configure the MessageHandler Options in terms of exception handling, number of concurrent messages to deliver etc.
            var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler)
            {
                // Maximum number of Concurrent calls to the callback `ProcessMessagesAsync`, set to 1 for simplicity.
                // Set it according to how many messages the application wants to process in parallel.
                MaxConcurrentCalls = 1,

                // Indicates whether MessagePump should automatically complete the messages after returning from User Callback.
                // False below indicates the Complete will be handled by the User Callback as in `ProcessMessagesAsync` below.
                AutoComplete = false
            };

            // Register the function that will process messages
            queueClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions);
        }

        static async Task ProcessMessagesAsync(Message message, CancellationToken token)
        {
            // Process the message
            Console.WriteLine($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}");

            // Complete the message so that it is not received again.
            // This can be done only if the queueClient is created in ReceiveMode.PeekLock mode (which is default).
            await queueClient.CompleteAsync(message.SystemProperties.LockToken);

            // Note: Use the cancellationToken passed as necessary to determine if the queueClient has already been closed.
            // If queueClient has already been Closed, you may chose to not call CompleteAsync() or AbandonAsync() etc. calls
            // to avoid unnecessary exceptions.
        }

        static Task ExceptionReceivedHandler(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
        {
            Console.WriteLine($"Message handler encountered an exception {exceptionReceivedEventArgs.Exception}.");
            var context = exceptionReceivedEventArgs.ExceptionReceivedContext;
            Console.WriteLine("Exception context for troubleshooting:");
            Console.WriteLine($"- Endpoint: {context.Endpoint}");
            Console.WriteLine($"- Entity Path: {context.EntityPath}");
            Console.WriteLine($"- Executing Action: {context.Action}");
            return Task.CompletedTask;
        }
    }
}

It's a console app that receives messages from a queue. In order to receive messages from DLQ, you simply need to change the name of the queue to <your-queue-name>/$deadletterqueue.

Again this code creates a receiver that constantly receives the messages from a queue and since you are building a webpage, you will need to receive messages on demand or implement some kind of websocket kind of functionality so that server can push the changes to the client.


问:
I am getting this error ---> TypeError: integer argument expected, got float
this a simple gesture recognition using python , opencv
Libraries In Use
we will be using only 2 libraries in this tutorial

OpenCV
Numpy
    import cv2
    import numpy as np
    from pynput.mouse import Button, Controller
    import wx
    mouse=Controller()

```<code>app=wx.App(False)
(sx,sy)=wx.GetDisplaySize()
(camx,camy)=(320,240)

lowerBound=np.array([33,80,40])
upperBound=np.array([102,255,255])

cam= cv2.VideoCapture(0)

kernelOpen=np.ones((5,5))
kernelClose=np.ones((20,20))
pinchFlag=0

while True:
ret, img=cam.read()
img=cv2.resize(img,(340,220))

#convert BGR to HSV
imgHSV= cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
# create the Mask
mask=cv2.inRange(imgHSV,lowerBound,upperBound)
#morphology
maskOpen=cv2.morphologyEx(mask,cv2.MORPH_OPEN,kernelOpen)
maskClose=cv2.morphologyEx(maskOpen,cv2.MORPH_CLOSE,kernelClose)

maskFinal=maskClose
result = cv2.findContours(maskFinal.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
conts,h=result if len(result) == 2 else result[1:3]

if(len(conts)==2):
    if(pinchFlag==1):
        pinchFlag=0
        mouse.release(Button.left)
    x1,y1,w1,h1=cv2.boundingRect(conts[0])
    x2,y2,w2,h2=cv2.boundingRect(conts[1])
    cv2.rectangle(img,(x1,y1),(x1+w1,y1+h1),(255,0,0),2)
    cv2.rectangle(img,(x2,y2),(x2+w2,y2+h2),(255,0,0),2)
    cx1=x1+w1/2
    cy1=y1+h1/2
    cx2=x2+w2/2
    cy2=y2+h2/2
    cx=(cx1+cx2)/2
    cy=(cy1+cy2)/2
    cv2.line(img, (cx1,cy1),(cx2,cy2),(255,0,0),2)
    cv2.circle(img, (cx,cy),2,(0,0,255),2)
    mouseLoc=(sx-(cx*sx/camx), cy*sy/camy)
    mouse.position=mouseLoc
    while mouse.position!=mouseLoc:
        pass
elif(len(conts)==1):
    x,y,w,h=cv2.boundingRect(conts[0])
    if(pinchFlag==0):
        pinchFlag=1
        mouse.press(Button.left)
    cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
    cx=x+w/2
    cy=y+h/2
    cv2.circle(img,(cx,cy),(w+h)/4,(0,0,255),2)
    mouseLoc=(sx-(cx*sx/camx), cy*sy/camy)
    mouse.position=mouseLoc
    while mouse.position!=mouseLoc:
        pass
cv2.imshow("cam",img)
cv2.waitKey(5)
Python
</code>```

i get this error :-
cv2.line(img, (cx1,cy1),(cx2,cy2),(255,0,0),2).
TypeError: integer argument expected, got float

答: cv2.line expects the values of coordinates to be integers, i.e. the value of cx1, cx2, cy1, cy2 should be integers. So before writing this statement write cx1 = int(cx1) and so on for others and the code should run.

Body:
this a simple gesture recognition using python , opencv
Libraries In Use
we will be using only 2 libraries in this tutorial

OpenCV
Numpy
    import cv2
    import numpy as np
    from pynput.mouse import Button, Controller
    import wx
    mouse=Controller()

app=wx.App(False)
(sx,sy)=wx.GetDisplaySize()
(camx,camy)=(320,240)

lowerBound=np.array([33,80,40])
upperBound=np.array([102,255,255])

cam= cv2.VideoCapture(0)

kernelOpen=np.ones((5,5))
kernelClose=np.ones((20,20))
pinchFlag=0

while True:
ret, img=cam.read()
img=cv2.resize(img,(340,220))

#convert BGR to HSV
imgHSV= cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
# create the Mask
mask=cv2.inRange(imgHSV,lowerBound,upperBound)
#morphology
maskOpen=cv2.morphologyEx(mask,cv2.MORPH_OPEN,kernelOpen)
maskClose=cv2.morphologyEx(maskOpen,cv2.MORPH_CLOSE,kernelClose)

maskFinal=maskClose
result = cv2.findContours(maskFinal.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
conts,h=result if len(result) == 2 else result[1:3]

if(len(conts)==2):
    if(pinchFlag==1):
        pinchFlag=0
        mouse.release(Button.left)
    x1,y1,w1,h1=cv2.boundingRect(conts[0])
    x2,y2,w2,h2=cv2.boundingRect(conts[1])
    cv2.rectangle(img,(x1,y1),(x1+w1,y1+h1),(255,0,0),2)
    cv2.rectangle(img,(x2,y2),(x2+w2,y2+h2),(255,0,0),2)
    cx1=x1+w1/2
    cy1=y1+h1/2
    cx2=x2+w2/2
    cy2=y2+h2/2
    cx=(cx1+cx2)/2
    cy=(cy1+cy2)/2
    cv2.line(img, (cx1,cy1),(cx2,cy2),(255,0,0),2)
    cv2.circle(img, (cx,cy),2,(0,0,255),2)
    mouseLoc=(sx-(cx*sx/camx), cy*sy/camy)
    mouse.position=mouseLoc
    while mouse.position!=mouseLoc:
        pass
elif(len(conts)==1):
    x,y,w,h=cv2.boundingRect(conts[0])
    if(pinchFlag==0):
        pinchFlag=1
        mouse.press(Button.left)
    cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
    cx=x+w/2
    cy=y+h/2
    cv2.circle(img,(cx,cy),(w+h)/4,(0,0,255),2)
    mouseLoc=(sx-(cx*sx/camx), cy*sy/camy)
    mouse.position=mouseLoc
    while mouse.position!=mouseLoc:
        pass
cv2.imshow("cam",img)
cv2.waitKey(5)
Python

i get this error :-
cv2.line(img, (cx1,cy1),(cx2,cy2),(255,0,0),2).
TypeError: integer argument expected, got float


问:
C# unsafe value type array to byte array conversions
I use an extension method to convert float arrays into byte arrays:

```<code>public static unsafe byte[] ToByteArray(this float[] floatArray, int count)
{
    int arrayLength = floatArray.Length > count ? count : floatArray.Length;
    byte[] byteArray = new byte[4 * arrayLength];
    fixed (float* floatPointer = floatArray)
    {
        fixed (byte* bytePointer = byteArray)
        {
            float* read = floatPointer;
            float* write = (float*)bytePointer;
            for (int i = 0; i < arrayLength; i++)
            {
                *write++ = *read++;
            }
        }
    }
    return byteArray;
}
</code>```

I understand that an array is a pointer to memory associated with information on the type and number of elements. Also, it seems to me that there is no way of doing a conversion from and to a byte array without copying the data as above.

Have I understood this? Would it even be impossible to write IL to create an array from a pointer, type and length without copying data?

EDIT: Thanks for the answers, I learned some fundamentals and got to try out new tricks!

After initially accepting Davy Landman's answer I found out that while his brilliant StructLayout hack does convert byte arrays into float arrays, it does not work the other way around. To demonstrate:

```<code>[StructLayout(LayoutKind.Explicit)]
struct UnionArray
{
    [FieldOffset(0)]
    public Byte[] Bytes;

    [FieldOffset(0)]
    public float[] Floats;
}

static void Main(string[] args)
{
    // From bytes to floats - works
    byte[] bytes = { 0, 1, 2, 4, 8, 16, 32, 64 };
    UnionArray arry = new UnionArray { Bytes = bytes };
    for (int i = 0; i < arry.Bytes.Length / 4; i++)
        Console.WriteLine(arry.Floats[i]);

    // From floats to bytes - index out of range
    float[] floats = { 0.1f, 0.2f, 0.3f };
    arry = new UnionArray { Floats = floats };
    for (int i = 0; i < arry.Floats.Length * 4; i++)
        Console.WriteLine(arry.Bytes[i]);
}
</code>```

It seems that the CLR sees both arrays as having the same length. If the struct is created from float data, the byte array's length is just too short.

答:
Yes, the type information and data is in the same memory block, so that is impossible unless you overwrite the type information in a float array to fool the system that it's byte array. That would be a really ugly hack, and could easily blow up...

Here's how you can convert the floats without unsafe code if you like:

```<code>public static byte[] ToByteArray(this float[] floatArray) {
    int len = floatArray.Length * 4;
    byte[] byteArray = new byte[len];
    int pos = 0;
    foreach (float f in floatArray) {
        byte[] data = BitConverter.GetBytes(f);
        Array.Copy(data, 0, byteArray, pos, 4);
        pos += 4;
    }
    return byteArray;
}
</code>```

OwnerDisplayName: Ville Koskinen

ContentLicense: CC BY-SA 2.5

Body:
I use an extension method to convert float arrays into byte arrays:

public static unsafe byte[] ToByteArray(this float[] floatArray, int count)
{
    int arrayLength = floatArray.Length > count ? count : floatArray.Length;
    byte[] byteArray = new byte[4 * arrayLength];
    fixed (float* floatPointer = floatArray)
    {
        fixed (byte* bytePointer = byteArray)
        {
            float* read = floatPointer;
            float* write = (float*)bytePointer;
            for (int i = 0; i < arrayLength; i++)
            {
                *write++ = *read++;
            }
        }
    }
    return byteArray;
}

I understand that an array is a pointer to memory associated with information on the type and number of elements. Also, it seems to me that there is no way of doing a conversion from and to a byte array without copying the data as above.

Have I understood this? Would it even be impossible to write IL to create an array from a pointer, type and length without copying data?

EDIT: Thanks for the answers, I learned some fundamentals and got to try out new tricks!

After initially accepting Davy Landman's answer I found out that while his brilliant StructLayout hack does convert byte arrays into float arrays, it does not work the other way around. To demonstrate:

[StructLayout(LayoutKind.Explicit)]
struct UnionArray
{
    [FieldOffset(0)]
    public Byte[] Bytes;

    [FieldOffset(0)]
    public float[] Floats;
}

static void Main(string[] args)
{
    // From bytes to floats - works
    byte[] bytes = { 0, 1, 2, 4, 8, 16, 32, 64 };
    UnionArray arry = new UnionArray { Bytes = bytes };
    for (int i = 0; i < arry.Bytes.Length / 4; i++)
        Console.WriteLine(arry.Floats[i]);

    // From floats to bytes - index out of range
    float[] floats = { 0.1f, 0.2f, 0.3f };
    arry = new UnionArray { Floats = floats };
    for (int i = 0; i < arry.Floats.Length * 4; i++)
        Console.WriteLine(arry.Bytes[i]);
}

It seems that the CLR sees both arrays as having the same length. If the struct is created from float data, the byte array's length is just too short.

LastEditorDisplayName: Ville Koskinen

Body:
Yes, the type information and data is in the same memory block, so that is impossible unless you overwrite the type information in a float array to fool the system that it's byte array. That would be a really ugly hack, and could easily blow up...

Here's how you can convert the floats without unsafe code if you like:

public static byte[] ToByteArray(this float[] floatArray) {
    int len = floatArray.Length * 4;
    byte[] byteArray = new byte[len];
    int pos = 0;
    foreach (float f in floatArray) {
        byte[] data = BitConverter.GetBytes(f);
        Array.Copy(data, 0, byteArray, pos, 4);
        pos += 4;
    }
    return byteArray;
}

OwnerDisplayName: Guffa

LastEditorDisplayName: Guffa


问:
How do I make this image 100% fill the container?
I have the code below. My problem is that if I add too much text, it pushes down the entire row and the image has extra space underneath. How can I make sure that the image always fills out its container and its height adapts to the amount of content in the other column?

Here is an image in case the code snippet does not show exactly what I see.

I am using Bootstrap4.

.lesson-heading h2 {
    font-size: 24px;
    font-weight: 600;
}
.lesson {
    background-color: #ffffff;
    margin-top: 25px;
}
.lesson-img {
    padding-left: 0px;
    padding-right: 0px;
    position: relative;
}
.trial-badge {
    position: absolute;
    background-color: green;
    top: 10px;
    left: 25px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
}
.lesson-content-header {
    padding-top: 15px;
    padding-right: 15px;
}
.lesson-content {
    padding-bottom: 15px;
}
.lesson-title h4 a {
    font-size: 22px;
    font-weight: 600;
    color: #333131;
    text-decoration: none;
}
.lesson-title h4 a:hover {
    color: #ed6310;
    transition: .7s;
}
.lesson-status-completed i {
    color: green;
}
.lesson-status-locked i, .lesson-status-new i {
    color: #ccc;
}
.lesson-desc p {
    font-size: 15px;
    line-height: 20px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" rel="stylesheet"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
    <div class="lesson">
        <div class="row">
            <div class="col-lg-4">
                <div class="lesson-img">
                    <img src="https://cdn.pixabay.com/photo/2019/04/07/23/11/content-marketing-4111003__340.jpg" alt=""
                        class="img-fluid">
                </div>
                <div class="trial-badge">
                    <span>Trial</span>
                </div>
            </div>
            <div class="col-lg-8 lesson-content">
                <div class="lesson-content-header d-flex justify-content-between">
                    <div class="lesson-title">
                        <h4>This is the title of the lesson</h4>
                    </div>
                    <div class="lesson-status-completed"><i class="fas fa-check-circle"></i></div>
                </div>
                <div class="lesson-desc">
                    <p>This is the description of the lesson. Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Ullam aliquid nam adipisci in quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in
                        quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in quae voluptate sunt fuga
                        impedit.</p>
                </div>
            </div>
        </div>
    </div>
</div></code>```

答:
try this code:

.lesson-heading h2 {
    font-size: 24px;
    font-weight: 600;
}
.lesson {
    background-color: #ffffff;
    margin-top: 25px;
}
.lesson-img {
    padding-left: 0px;
    padding-right: 0px;
    position: relative;
}
.trial-badge {
    position: absolute;
    background-color: green;
    top: 10px;
    left: 25px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
}
.lesson-content-header {
    padding-top: 15px;
    padding-right: 15px;
}
.lesson-content {
    padding-bottom: 15px;
}
.lesson-title h4 a {
    font-size: 22px;
    font-weight: 600;
    color: #333131;
    text-decoration: none;
}
.lesson-title h4 a:hover {
    color: #ed6310;
    transition: .7s;
}
.lesson-status-completed i {
    color: green;
}
.lesson-status-locked i, .lesson-status-new i {
    color: #ccc;
}
.lesson-desc p {
    font-size: 15px;
    line-height: 20px;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" rel="stylesheet"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
    <div class="lesson">
        <div class="row">
            <div class="col-lg-4">
                <div class="lesson-img h-100">
                    <img src="https://cdn.pixabay.com/photo/2019/04/07/23/11/content-marketing-4111003__340.jpg" alt=""
                        class="img-fluid h-100">
                </div>
                <div class="trial-badge">
                    <span>Trial</span>
                </div>
            </div>
            <div class="col-lg-8 lesson-content">
                <div class="lesson-content-header d-flex justify-content-between">
                    <div class="lesson-title">
                        <h4>This is the title of the lesson</h4>
                    </div>
                    <div class="lesson-status-completed"><i class="fas fa-check-circle"></i></div>
                </div>
                <div class="lesson-desc">
                    <p>This is the description of the lesson. Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Ullam aliquid nam adipisci in quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in
                        quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in quae voluptate sunt fuga
                        impedit.</p>
                </div>
            </div>
        </div>
    </div>
</div></code>```

Body:
I have the code below. My problem is that if I add too much text, it pushes down the entire row and the image has extra space underneath. How can I make sure that the image always fills out its container and its height adapts to the amount of content in the other column?

Here is an image in case the code snippet does not show exactly what I see.

I am using Bootstrap4.

.lesson-heading h2 {
    font-size: 24px;
    font-weight: 600;
}
.lesson {
    background-color: #ffffff;
    margin-top: 25px;
}
.lesson-img {
    padding-left: 0px;
    padding-right: 0px;
    position: relative;
}
.trial-badge {
    position: absolute;
    background-color: green;
    top: 10px;
    left: 25px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
}
.lesson-content-header {
    padding-top: 15px;
    padding-right: 15px;
}
.lesson-content {
    padding-bottom: 15px;
}
.lesson-title h4 a {
    font-size: 22px;
    font-weight: 600;
    color: #333131;
    text-decoration: none;
}
.lesson-title h4 a:hover {
    color: #ed6310;
    transition: .7s;
}
.lesson-status-completed i {
    color: green;
}
.lesson-status-locked i, .lesson-status-new i {
    color: #ccc;
}
.lesson-desc p {
    font-size: 15px;
    line-height: 20px;
}

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" rel="stylesheet"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>

                    Trial

This is the title of the lesson

This is the description of the lesson. Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Ullam aliquid nam adipisci in quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in
                        quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in quae voluptate sunt fuga
                        impedit.

Body:
try this code:

.lesson-heading h2 {
    font-size: 24px;
    font-weight: 600;
}
.lesson {
    background-color: #ffffff;
    margin-top: 25px;
}
.lesson-img {
    padding-left: 0px;
    padding-right: 0px;
    position: relative;
}
.trial-badge {
    position: absolute;
    background-color: green;
    top: 10px;
    left: 25px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
}
.lesson-content-header {
    padding-top: 15px;
    padding-right: 15px;
}
.lesson-content {
    padding-bottom: 15px;
}
.lesson-title h4 a {
    font-size: 22px;
    font-weight: 600;
    color: #333131;
    text-decoration: none;
}
.lesson-title h4 a:hover {
    color: #ed6310;
    transition: .7s;
}
.lesson-status-completed i {
    color: green;
}
.lesson-status-locked i, .lesson-status-new i {
    color: #ccc;
}
.lesson-desc p {
    font-size: 15px;
    line-height: 20px;
}

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" rel="stylesheet"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
    <div class="lesson">
        <div class="row">
            <div class="col-lg-4">
                <div class="lesson-img h-100">
                    <img src="https://cdn.pixabay.com/photo/2019/04/07/23/11/content-marketing-4111003__340.jpg" alt=""
                        class="img-fluid h-100">
                </div>
                <div class="trial-badge">
                    <span>Trial</span>
                </div>
            </div>
            <div class="col-lg-8 lesson-content">
                <div class="lesson-content-header d-flex justify-content-between">
                    <div class="lesson-title">
                        <h4><a href="#">This is the title of the lesson</a></h4>
                    </div>
                    <div class="lesson-status-completed"><i class="fas fa-check-circle"></i></div>
                </div>
                <div class="lesson-desc">
                    <p>This is the description of the lesson. Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Ullam aliquid nam adipisci in quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in
                        quae voluptate sunt fuga impedit. Ullam aliquid nam adipisci in quae voluptate sunt fuga
                        impedit.</p>
                </div>
            </div>
        </div>
    </div>
</div>


问:
Access denied for user 'root'@'192.168.128.3' in Laravel project in Docker
I try to set up Laravel project in Docker.
My docker-compose.yml:

```<code>version: "2"
services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - MYSQL_DATABASE=identy
      - MYSQL_USER=root
      - MYSQL_PASSWORD=654321
      - MYSQL_HOST=db
    ports:
      - "8080:80"
    volumes:
      - .:/var/www
    depends_on:
      - db
    networks:
      - identy-network

  db:
    image: mysql:8.0
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=654321
      - MYSQL_USER=root
      - MYSQL_PASSWORD=654321
      - MYSQL_DATABASE=identy
    volumes:
      - "mysql_data:/var/lib/mysql"
      - ./data/schema.sql:/docker-entrypoint-initdb.d/schema.sql
    networks:
      - identy-network

volumes:
  mysql_data:
    driver: local

networks:
  identy-network:
</code>```

My Dockerfile:

```<code>FROM php:7.4-apache

RUN apt-get update \
    && apt-get install -y vim git zlib1g-dev mariadb-client libzip-dev \
    && docker-php-ext-install zip mysqli pdo_mysql \
    && pecl install xdebug \
    && docker-php-ext-enable xdebug \
    && echo 'xdebug.remote_enable=on' >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo 'xdebug.remote_host=host.docker.internal' >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo 'xdebug.remote_port=9000' >>  /usr/local/etc/php/conf.d/xdebug.ini \
    && a2enmod rewrite \
    && sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf \
    && mv /var/www/html /var/www/public \
    && curl -sS https://getcomposer.org/installer \
    | php -- --install-dir=/usr/local/bin --filename=composer \
    && echo "AllowEncodedSlashes On" >> /etc/apache2/apache2.conf

WORKDIR /var/www
</code>```

.env:

```<code>...
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=identy
DB_USERNAME=root
DB_PASSWORD=654321
...
</code>```

When I run
docker exec identy-api_web_1 php artisan migrate
I get error:
**  Illuminate\Database\QueryException

SQLSTATE[HY000] [1045] Access denied for user 'root'@'192.168.144.3' (using password: YES) (SQL: select * from information_schema.tables where table_schema = identy and table_name = migrations and table_type = 'BASE TABLE')
**

I have no idea why it doesn't work.

答:
You don't need to define MYSQL_USER=root. Try this one (it creates identy db as well):

```<code>db:
  image: mysql:8.0
  ports:
    - "3306:3306"
  environment:
    - MYSQL_ROOT_PASSWORD=654321
  networks:
    - identy-network
  volumes:
    - "mysql_data:/var/lib/mysql"
  entrypoint: sh -c "
    echo 'CREATE DATABASE IF NOT EXISTS identy;' > /docker-entrypoint-initdb.d/init.sql;
    /usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
</code>```

Body:
I try to set up Laravel project in Docker.
My docker-compose.yml:

version: "2"
services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - MYSQL_DATABASE=identy
      - MYSQL_USER=root
      - MYSQL_PASSWORD=654321
      - MYSQL_HOST=db
    ports:
      - "8080:80"
    volumes:
      - .:/var/www
    depends_on:
      - db
    networks:
      - identy-network

  db:
    image: mysql:8.0
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=654321
      - MYSQL_USER=root
      - MYSQL_PASSWORD=654321
      - MYSQL_DATABASE=identy
    volumes:
      - "mysql_data:/var/lib/mysql"
      - ./data/schema.sql:/docker-entrypoint-initdb.d/schema.sql
    networks:
      - identy-network

volumes:
  mysql_data:
    driver: local

networks:
  identy-network:

My Dockerfile:

FROM php:7.4-apache

RUN apt-get update \
    && apt-get install -y vim git zlib1g-dev mariadb-client libzip-dev \
    && docker-php-ext-install zip mysqli pdo_mysql \
    && pecl install xdebug \
    && docker-php-ext-enable xdebug \
    && echo 'xdebug.remote_enable=on' >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo 'xdebug.remote_host=host.docker.internal' >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo 'xdebug.remote_port=9000' >>  /usr/local/etc/php/conf.d/xdebug.ini \
    && a2enmod rewrite \
    && sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf \
    && mv /var/www/html /var/www/public \
    && curl -sS https://getcomposer.org/installer \
    | php -- --install-dir=/usr/local/bin --filename=composer \
    && echo "AllowEncodedSlashes On" >> /etc/apache2/apache2.conf

WORKDIR /var/www

.env:

...
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=identy
DB_USERNAME=root
DB_PASSWORD=654321
...

When I run
docker exec identy-api_web_1 php artisan migrate
I get error:
**  Illuminate\Database\QueryException

SQLSTATE[HY000] [1045] Access denied for user 'root'@'192.168.144.3' (using password: YES) (SQL: select * from information_schema.tables where table_schema = identy and table_name = migrations and table_type = 'BASE TABLE')
**

I have no idea why it doesn't work.

Body:
You don't need to define MYSQL_USER=root. Try this one (it creates identy db as well):

db:
  image: mysql:8.0
  ports:
    - "3306:3306"
  environment:
    - MYSQL_ROOT_PASSWORD=654321
  networks:
    - identy-network
  volumes:
    - "mysql_data:/var/lib/mysql"
  entrypoint: sh -c "
    echo 'CREATE DATABASE IF NOT EXISTS identy;' > /docker-entrypoint-initdb.d/init.sql;
    /usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"