{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n\n```\n\r\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T15:26:04.300"},"LastActivityDate":{"kind":"string","value":"2023-02-19T15:26:04.300"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":4897330,"string":"4,897,330"},"Tags":{"kind":"null"}}},{"rowIdx":1249817,"cells":{"Id":{"kind":"number","value":75501354,"string":"75,501,354"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75499418,"string":"75,499,418"},"Score":{"kind":"number","value":2,"string":"2"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"But why are you using a edit command in the loop that opens that form?\nYou have this:\n```\nWith rs\n .MoveFirst\n Do While Not rs.EOF\n .Edit <------ WHY? This does nothing?????? explain!!!\n\n If (!Tahvil_Tmp = True) * (!Az_Tankhah = False) Then\n If DLookup(\"[Saff_Arzyabi_2]\", \"Arzyabi_Tamin_Konande_sh\", _\n \"val([Cod_Tamin_Konande]) = '\" & !Cod_Tamin_Konande & \"'\") = True Then\n DoCmd.OpenForm \"Arzyabi_Tamin_Konande_da\", acNormal, , \"[Cod_Tamin_Konande]=\" & !Cod_Tamin_Konande, , acDialog\n End If\n .Update\n .MoveNext\n Loop\nEnd With\n```\n\nSo, what does that .Edit command do? All it REALLY does is wind up locking the reocrd, but then that does ZERO value, does nothing of value, and you don't do any edits??? So, why? What is the reason for that .edit command? (except to lock the reocrd!!!).\nRemove that edit command, you are launching some form, and that form should be able to do whatever it likes to do!!!!\nA wild good guess in the dark??\nThat code should be this:\n```\nWith rs\n .MoveFirst\n Do While Not rs.EOF\n If (!Tahvil_Tmp = True) * (!Az_Tankhah = False) Then\n If DLookup(\"[Saff_Arzyabi_2]\", \"Arzyabi_Tamin_Konande_sh\", _\n \"val([Cod_Tamin_Konande]) = '\" & !Cod_Tamin_Konande & \"'\") = True Then\n DoCmd.OpenForm \"Arzyabi_Tamin_Konande_da\", acNormal, , \"[Cod_Tamin_Konande]=\" & !Cod_Tamin_Konande, , acDialog\n End If\n .MoveNext\n Loop\nEnd With\n\nme.Refresh <---- show any update dated in our form after dialog\n prompts are done.\n```\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T15:50:54.017"},"LastActivityDate":{"kind":"string","value":"2023-02-19T15:50:54.017"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":10527,"string":"10,527"},"Tags":{"kind":"null"}}},{"rowIdx":1249818,"cells":{"Id":{"kind":"number","value":75501523,"string":"75,501,523"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":15727912,"string":"15,727,912"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"[](https://i.stack.imgur.com/EnmDK.png)\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T16:12:40.763"},"LastActivityDate":{"kind":"string","value":"2023-02-19T16:12:40.763"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":15475280,"string":"15,475,280"},"Tags":{"kind":"null"}}},{"rowIdx":1249819,"cells":{"Id":{"kind":"number","value":75501740,"string":"75,501,740"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75493439,"string":"75,493,439"},"Score":{"kind":"number","value":3,"string":"3"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"You're asking your model to \"extrapolate\" - making predictions for `x` values that are greater than `x` values in the training dataset. Extrapolation works with some model types (such as linear models), but it typically does not work with decision tree models and their ensembles (such as XGBoost).\nIf you switch from XGBoost to LightGBM, then you can train extrapolation-capable decision tree ensembles using the \"linear tree\" approach:\n> Any ideas why this doesn't work?\nYour `XGBRegressor` is probably over-fitted (has `n_estimators = 100` and `max_depth = 6`). If you decrease those parameter values, then the red line will appear more jagged, and it will be easier for you to see it \"working\".\nRight now, if you ask your over-fitted XGBRegressor to extrapolate, then it basically functions as a giant look-up table. When extrapolating towards +Inf, then the \"closest match\" is at `x = 17.5`; when extrapolating towards -Inf, then the \"closest match\" is at `x = 0.0`.\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T16:46:52.327"},"LastActivityDate":{"kind":"string","value":"2023-02-19T16:46:52.327"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":1808924,"string":"1,808,924"},"Tags":{"kind":"null"}}},{"rowIdx":1249820,"cells":{"Id":{"kind":"number","value":75501762,"string":"75,501,762"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":7061071,"string":"7,061,071"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Here is a converted @Dr. belisarius's code to python:\n```\nimport pandas as pd\nimport numpy as np\n\ndef emasma_maxmin(l: pd.Series, sma_period=10, ema_factor=.2):\n \"\"\"\n mathematica's ema(sma(sma_period), ema_factor) minmax in python\n :param l: prices as pd.Series\n :param sma_period\n :param ema_factor\n :return: a tuple that contains max and min index lists\n \"\"\"\n l1 = l.rolling(window=sma_period).mean().ewm(com=int(1/ema_factor)-1).mean().dropna()\n l1_triples = [w.to_list() for w in l1.rolling(window=3) if len(w.to_list()) == 3]\n # utilize the fact that original indexes are preserved in pd.Series\n l1_indexes = l1.index[:-2]\n # index is from ordinal l that corresponds to the first element of the triple\n l2 = [index for (index, (fst, snd, trd)) in zip(l1_indexes, l1_triples) if fst < snd > trd]\n l3 = [index for (index, (fst, snd, trd)) in zip(l1_indexes, l1_triples) if fst > snd < trd]\n max_ranges = [(-np.array([l[index] for index in range(index - sma_period + 1, index + 1)])).argsort() + (index - sma_period + 1) for index in l2]\n min_ranges = [(-np.array([l[index] for index in range(index - sma_period + 1, index + 1)])).argsort() + (index - sma_period + 1) for index in l3]\n return (\n [r[0] for r in max_ranges if len(r) > 0],\n [r[-1] for r in min_ranges if len(r) > 0],\n )\n```\n\nYou may visualize the results via something like (using mplfinance):\n```\nimport pandas as pd\nimport numpy as np\nimport mplfinance as mpf\n\n# read OHLC csv\nmsft = pd.read_csv(\"MSFT1440.csv\", parse_dates=True)\ndf = msft.loc[msft['date'] >= '2021-01-01']\nmax_indexes, _ = emasma_maxmin(df.high)\n_, min_indexes = emasma_maxmin(df.low)\nmaxs, mins = set(max_indexes), set(min_indexes)\n# color minmax candlesticks\nmco = ['green' if index in maxs else 'red' if index in mins else None\n for index in df.index.values]\n# generate vertical lines at minmax\nvlines = [pd.to_datetime(str(df['date'][index]))\n for index in df.index.values if index in max_indexes or index in min_indexes]\nvline_colors = ['green' if index in maxs else 'red'\n for index in df.index.values if index in max_indexes or index in min_indexes]\n\ndf.set_index(pd.DatetimeIndex(df['date']), inplace=True)\nmpf.plot(df,\n type='candle',\n marketcolor_overrides=mco,\n vlines=dict(vlines=vlines, linewidths=0.25, colors=vline_colors))\n```\n\nwhich produces:\n[](https://i.stack.imgur.com/YRw1w.png)\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T16:49:24.677"},"LastActivityDate":{"kind":"string","value":"2023-02-20T14:07:00.577"},"LastEditDate":{"kind":"string","value":"2023-02-20T14:07:00.577"},"LastEditorUserId":{"kind":"number","value":2380455,"string":"2,380,455"},"OwnerUserId":{"kind":"number","value":2380455,"string":"2,380,455"},"Tags":{"kind":"null"}}},{"rowIdx":1249821,"cells":{"Id":{"kind":"number","value":75501869,"string":"75,501,869"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501528,"string":"75,501,528"},"Score":{"kind":"number","value":2,"string":"2"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Listen for scroll events, find the currently displayed region, and highlight the navigation elements as necessary.\n```\nwindow.addEventListener('DOMContentLoaded', updateNav);\nwindow.addEventListener('scroll', updateNav);\n\nfunction updateNav() {\n const currentRegion = [...document.querySelectorAll(\".region:not([id=''])\")]\n .find(e=>e.getBoundingClientRect().top>=0)\n \n if(currentRegion) {\n window.location.hash = `#${currentRegion.id}`;\n \n [...document.querySelectorAll(`a:not([href='#${currentRegion.id}'])`)]\n .forEach(a=>a.classList.remove('red'))\n \n document.querySelector(`a[href='#${currentRegion.id}']`)?.classList.add('red')\n }\n}\n```\n```\na { text-decoration:none; color: black}\n.red { color: red; }\n.region { margin-left: 100px; min-height: 500px; }\n.dot-navigation { position:fixed }\n```\n```\n
\n
o
\n
o
\n
o
\n
o
\n
o
\n
o
\n
\n
home...
\n
about...
\n
services...
\n
clients...
\n
reviews...
\n
contactus...
\n```\n\r\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:03:22.137"},"LastActivityDate":{"kind":"string","value":"2023-02-19T17:15:28.340"},"LastEditDate":{"kind":"string","value":"2023-02-19T17:15:28.340"},"LastEditorUserId":{"kind":"number","value":5898421,"string":"5,898,421"},"OwnerUserId":{"kind":"number","value":5898421,"string":"5,898,421"},"Tags":{"kind":"null"}}},{"rowIdx":1249822,"cells":{"Id":{"kind":"number","value":75501922,"string":"75,501,922"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501746,"string":"75,501,746"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Verilog is a case-sensitive language. This means that the signal named `FAout` is different from the one named `FAOut`.\nThe `FullAdd` module output port, `FAOut`, is undriven, which means it will have the high-impedance value (`z`). You likely meant to connect the output of the `FA_HA2` instance to the `FAOut` port instead of the signal named `FAout`.\nHere is the fixed version of the module:\n```\nmodule FullAdd(\n input FAin1,\n input FAin2,\n input FACin,\n output FAOut,\n output FACout\n );\n \n wire FAWHA1Out,FAWHA1Cout,FAWHA2Cout;\n \n //Both calls to Half Adder\n HalfAdd FA_HA1(FAin1,FAin2,FAWHA1Cout,FAWHA1Out);\n HalfAdd FA_HA2(FAWHA1Out,FACin,FAWHA2Cout,FAOut);\n or FAOr(FACout,FAWHA1Cout,FAWHA2Cout);\n \nendmodule\n```\n\nThe full adder no longer has `z` output.\nBy default, Verilog does not require you to declare all signals. You could also change the default behavior and require explicitly declared signals using this compiler directive:\n```\n`default_nettype none\n```\n\nThis helps you find common coding mistakes like this.\n```\nError-[IND] Identifier not declared\n Identifier 'FAout' has not been declared yet. If this error is not expected,\n please check if you have set `default_nettype to none.\n```\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:09:32.603"},"LastActivityDate":{"kind":"string","value":"2023-02-20T11:38:22.143"},"LastEditDate":{"kind":"string","value":"2023-02-20T11:38:22.143"},"LastEditorUserId":{"kind":"number","value":197758,"string":"197,758"},"OwnerUserId":{"kind":"number","value":197758,"string":"197,758"},"Tags":{"kind":"null"}}},{"rowIdx":1249823,"cells":{"Id":{"kind":"number","value":75501942,"string":"75,501,942"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75499409,"string":"75,499,409"},"Score":{"kind":"number","value":1,"string":"1"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"The object(close button) you should have hit to close the pop up is inside another frame.\n[](https://i.stack.imgur.com/k0DQ5.png)\nSo switch to that iframe first and then try to hit the close button. See below the code to switch frame.\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:12:25.053"},"LastActivityDate":{"kind":"string","value":"2023-02-19T17:12:25.053"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":9717780,"string":"9,717,780"},"Tags":{"kind":"null"}}},{"rowIdx":1249824,"cells":{"Id":{"kind":"number","value":75501997,"string":"75,501,997"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501643,"string":"75,501,643"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Change `onConflictStrategy` to `OnConflictStrategy` and yo'll be fine.\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:19:08.950"},"LastActivityDate":{"kind":"string","value":"2023-02-19T17:19:08.950"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":13197940,"string":"13,197,940"},"Tags":{"kind":"null"}}},{"rowIdx":1249825,"cells":{"Id":{"kind":"number","value":75502023,"string":"75,502,023"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501334,"string":"75,501,334"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"In my experience, you can save the result of media projection intent and reuse it during the same application process session. That is how most applications overcome this issue.\nBut be aware that it is more a hack than a solution because the docs do not guarantee it. In contrast, it says you can not reuse it. So use it at your own risk.\nFrom my observations, it will work almost everywhere except some Xiaomi and Huawei devices. You can add them to ignore list and ask every time. Another good idea will be to add a try-catch when reusing an intent, so you can request permission again if the intent is expired.\nContext: we use this hack in an application with millions of active users, so it has some credibility.\nCode snippet to get the idea, but not production ready:\n```\nobject MediaProjectionIntentHolder {\n \n var intent: Intent? = null\n\n}\n\nclass ScreenRecordingFragment : Fragment() {\n \n\n // A user clicked button and this function is called\n private fun startScreenRecording() {\n val intent = MediaProjectionIntentHolder.intent\n // You can check Huawei / Xiaomi devices here to ask permission every time\n if (intent != null) {\n recordScreen(intent)\n } else {\n requestPermission()\n }\n }\n\n private fun recordScreen(intent: Intent) {\n // Actual screen recording start\n }\n\n private showError() {\n // show error\n }\n\n\n private fun requestPermission() {\n val service = requireContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager\n val intent = service.createScreenCaptureIntent()\n\n val screenRecordingSupported = context.packageManager.queryIntentActivities(intent, 0).isNotEmpty()\n\n if (screenRecordingSupported) {\n startActivityForResult(intent, REQUEST_CODE)\n } else {\n showError()\n }\n }\n\n override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {\n super.onActivityResult(requestCode, resultCode, data)\n if (requestCode == REQUEST_CODE) {\n if (resultCode == Activity.RESULT_OK && data != null) {\n MediaProjectionIntentHolder.intent = data\n recordScreen(data)\n } else {\n showError()\n }\n }\n }\n\n private companion object {\n private consta val REQUEST_CODE = 42\n }\n}\n```\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:22:44.263"},"LastActivityDate":{"kind":"string","value":"2023-02-20T17:19:15.977"},"LastEditDate":{"kind":"string","value":"2023-02-20T17:19:15.977"},"LastEditorUserId":{"kind":"number","value":7958563,"string":"7,958,563"},"OwnerUserId":{"kind":"number","value":7958563,"string":"7,958,563"},"Tags":{"kind":"null"}}},{"rowIdx":1249826,"cells":{"Id":{"kind":"number","value":75502159,"string":"75,502,159"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75471228,"string":"75,471,228"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"The simplest way to get this running is to add typescript and ts-node to the project.\n```\nnpm i -D typescript ts-node\n```\n\nThen `npx wdio`\nI opted not to use the compiler in a WebdriverIO project but then started getting this error after a few weeks. I just added the libraries above rather than try to chase down the config i likely messed up, in order to eliminate the error message.\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:42:06.963"},"LastActivityDate":{"kind":"string","value":"2023-02-19T17:53:25.597"},"LastEditDate":{"kind":"string","value":"2023-02-19T17:53:25.597"},"LastEditorUserId":{"kind":"number","value":21245917,"string":"21,245,917"},"OwnerUserId":{"kind":"number","value":21245917,"string":"21,245,917"},"Tags":{"kind":"null"}}},{"rowIdx":1249827,"cells":{"Id":{"kind":"number","value":75502279,"string":"75,502,279"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501985,"string":"75,501,985"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"They are the same WSL directory.\nWhen you use `wsl.localhost`, you are accessing that directoy from Windows.\nWhen you use wsl:Ubuntu, you are using VSCode WSL extension, so accessing that directory directly from WSL.\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T17:56:52.960"},"LastActivityDate":{"kind":"string","value":"2023-02-19T17:56:52.960"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":2125671,"string":"2,125,671"},"Tags":{"kind":"null"}}},{"rowIdx":1249828,"cells":{"Id":{"kind":"number","value":75502357,"string":"75,502,357"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75500447,"string":"75,500,447"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"![Empty Activity](https://i.stack.imgur.com/rhO9y.png)\nWhy don't you create \"Empty Activity\" for learning android studio.\nStarting with \"Empty Activity\" is good for understanding this IDE.\nI did the same way when I was starting.\nHope this would help you.\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:09:34.797"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:09:34.797"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":21245258,"string":"21,245,258"},"Tags":{"kind":"null"}}},{"rowIdx":1249829,"cells":{"Id":{"kind":"number","value":75502385,"string":"75,502,385"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501528,"string":"75,501,528"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Thanks, [Angelina](https://stackoverflow.com/users/18630923/angelina) for your comment.\nI found this to be useful [https://www.youtube.com/watch?v=fAAk9CATILc](https://www.youtube.com/watch?v=fAAk9CATILc)\n```\nlet section = document.querySelectorAll(\"section\");\nlet dotNav = document.querySelectorAll(\".dot-navigation div a\");\n\nwindow.onscroll = () => {\n section.forEach((sec) => {\n let top = window.scrollY;\n let offset = sec.offsetTop - 200;\n let height = sec.offsetHeight;\n let id = sec.getAttribute(\"id\");\n\n if (top >= offset && top < offset + height) {\n dotNav.forEach((dot) => {\n dot.classList.remove(\"navDot-active\");\n document.querySelector(\".dot-navigation div a[href*=\" + id + \"]\").classList.add(\"navDot-active\");\n });\n }\n });\n};\n```\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:14:04.587"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:14:04.587"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":15284985,"string":"15,284,985"},"Tags":{"kind":"null"}}},{"rowIdx":1249830,"cells":{"Id":{"kind":"number","value":75502391,"string":"75,502,391"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501564,"string":"75,501,564"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Playwright ships with `.d.ts` files so you should be getting Intellisense via the JS language service.\n- - `rm -rf node_modules && npm install`\nIf all else fails, you can force the type acquisition via [jsconfig.json](https://code.visualstudio.com/docs/languages/jsconfig). It should not be needed in your case, but comes in\nhandy when you can't get VSCode to recognize type definitions. You use it like so:\n```\n{\n \"typeAcquisition\": {\n \"include\": [\"playwright\"]\n },\n \"exclude\": [\"**/node_modules/*\"]\n}\n```\n\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:14:46.190"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:14:46.190"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":6934588,"string":"6,934,588"},"Tags":{"kind":"null"}}},{"rowIdx":1249831,"cells":{"Id":{"kind":"number","value":75502408,"string":"75,502,408"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75501274,"string":"75,501,274"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"`RectTransform`s seem to disable when you add elements to a struct called `DrivenRectTransformTracker` [defined in the RectTransform scripting implementation](https://github.com/Unity-Technologies/UnityCsReference/blob/e740821767d2290238ea7954457333f06e952bad/Runtime/Transform/ScriptBindings/RectTransform.bindings.cs#L47).\nThe case that you describe is done in the [GridLayoutGroup implementation](https://github.com/Unity-Technologies/uGUI/blob/2019.1/UnityEngine.UI/UI/Core/Layout/GridLayoutGroup.cs#L224) which is a protected member of the class the `GridLayoutGroup` inherits from, [LayoutGroup](https://github.com/Unity-Technologies/uGUI/blob/2019.1/UnityEngine.UI/UI/Core/Layout/LayoutGroup.cs#L44).\nThe documentation for it can be found in the [Unity Scripting Reference](https://docs.unity3d.com/ScriptReference/DrivenRectTransformTracker.html).\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:16:16.647"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:16:16.647"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":5593150,"string":"5,593,150"},"Tags":{"kind":"null"}}},{"rowIdx":1249832,"cells":{"Id":{"kind":"number","value":75502414,"string":"75,502,414"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75502150,"string":"75,502,150"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"I think the first problem is that getElementsById is not a method on the div tag so this causes the script to encounter an error and halt. The second issue is that calling innerHTML on the li tags will return something like `New Born`, i.e. the result includes the HTML of the a tag inside the li tag. You can change innerHTML to textContent to get the text inside the a tag (alternatively you could grab the a tag and get its innerHTML).\n```\nfunction sort() {\n var list, i, switching, shouldSwitch;\n div = document.querySelector(\".search-block\");\n // a = div.getElementsById(\"a\");\n list = document.getElementById(\"list1\");\n switching = true;\n while (switching)\n {\n switching = false;\n b = list.getElementsByTagName(\"li\");\n for (i=0; i<(b.length - 1); i++){\n shouldSwitch = false;\n // textContent instead of innerHTML\n if (b[i].textContent.toLowerCase() > b[i+1].textContent.toLowerCase()){\n shouldSwitch = true;\n break;\n }\n }\n if (shouldSwitch)\n {\n b[i].parentNode.insertBefore(b[i+1], b[i]);\n switching = true;\n }\n }\n\n}\n```\n```\n
\n \n \n \n\n

&copy; 2022 Farias Carril Photography | Designed and built by Daniel Carril

\n
\n```\n\r\n\n- [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)- [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:17:08.347"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:17:08.347"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":14454939,"string":"14,454,939"},"Tags":{"kind":"null"}}},{"rowIdx":1249833,"cells":{"Id":{"kind":"number","value":75502431,"string":"75,502,431"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":72814243,"string":"72,814,243"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"In TypeScript 5 you will be able to use `@overload` tag:\n```\n/**\n * @overload\n * @param {string} ticket\n * @param {string} userId\n *//**\n * @overload\n * @param {string} ticket\n * @param {string} firstname\n * @param {string} lastname\n *//**\n * @param {string} a\n * @param {string} b\n * @param {string} c\n */\nfunction assignSlave(a, b, c) {}\n```\n\nFor reference:\n[https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#overload-support-in-jsdoc](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#overload-support-in-jsdoc)\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:19:26.540"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:19:26.540"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":2817257,"string":"2,817,257"},"Tags":{"kind":"null"}}},{"rowIdx":1249834,"cells":{"Id":{"kind":"number","value":75502458,"string":"75,502,458"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75273668,"string":"75,273,668"},"Score":{"kind":"number","value":0,"string":"0"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"Full Disclosure: I'm one of the authors of Tensorflow Decision Forests.\nDecision Forests are not yet compatible with TFLite, so the conversion is unfortunately not possible. Feel free to tell the team about your uses case on the [TF-DF Github repo](https://github.com/tensorflow/decision-forests) to help prioritize this feature.\n"},"Title":{"kind":"null"},"ContentLicense":{"kind":"string","value":"CC BY-SA 4.0"},"FavoriteCount":{"kind":"null"},"CreationDate":{"kind":"string","value":"2023-02-19T18:25:39.843"},"LastActivityDate":{"kind":"string","value":"2023-02-19T18:25:39.843"},"LastEditDate":{"kind":"null"},"LastEditorUserId":{"kind":"null"},"OwnerUserId":{"kind":"number","value":13286957,"string":"13,286,957"},"Tags":{"kind":"null"}}},{"rowIdx":1249835,"cells":{"Id":{"kind":"number","value":75502647,"string":"75,502,647"},"PostTypeId":{"kind":"number","value":2,"string":"2"},"AcceptedAnswerId":{"kind":"null"},"ParentId":{"kind":"number","value":75499409,"string":"75,499,409"},"Score":{"kind":"number","value":1,"string":"1"},"ViewCount":{"kind":"null"},"Body":{"kind":"string","value":"To click on the element as the desired element is within a [