{ // 获取包含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\nI actually have posted this problem before, i know that will get you all angry. But i tried fixing it for a while but im just not as experienced as the people on here so I return. Please dont hate me.\n\nA: @user663049: I think your problem is this line --\n$query = \"SELECT item_id, username, item_content FROM updates ORDER BY update_time DESC LIMIT $start,$number_of_posts\" or die(mysql_error()); \n\nIt should be --\n$query = \"SELECT item_id, username, item_content FROM updates ORDER BY update_time DESC LIMIT \" . $start . \", \" . $number_of_posts;\n\n$result = mysql_query($query) or die(mysql_error());\n\n\nA: If it displays nothing maybe because of web server configuration. Could you just try to insert at the begining of the PHP block the following, so you may see at least errors and make the debugging\n\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/5413201\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":502,"cells":{"text":{"kind":"string","value":"Q: How can I define an ext property from Heap.io with gradle kotlin dsl Im using the heap.io and their Android SDK and they advise you to setup their library like:\n\n*\n\n*build.gradle:\n\nandroid {\n defaultConfig {\n // Add this section to enable Heap event capture.\n ext {\n heapEnabled = true\n }\n // ...\n }\n // ...\n}\n\nBut this is using the gradle groovy sintax, Im trying to use it with the Kotlin DSL of gradle like:\n\n*\n\n*build.gradle.kts\nandroid {\n defaultConfig {\n ext {\n set(\"heapEnabled\", true)\n }\n\nBut it does not work for some reason, so:\nWhy that may be happening?\n\nA: This works:\n(this as ExtensionAware).extensions.extraProperties.set(\"heapEnabled\", true)\n\nI believe Heap is looking into making it so the cast isn't necessary.\n\nA: extra.set(\"heapEnabled\", false)\n\nA: I was able to make it work using withGroovyBuilder like:\nandroid {\n defaultConfig {\n withGroovyBuilder {\n \"ext\" {\n setProperty(\"heapEnabled\", LhConfig.isAnalyticEnabled(project))\n }\n }\n\nI still dont understand where is the issue :(\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/62580898\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":503,"cells":{"text":{"kind":"string","value":"Q: How to add a new line in text field of dropdown in semantic-ui react? Here is the render function \nrender(){\n const { members, user } = this.props;\n let memberOptions = [];\n members.forEach((member, i) => {\n memberOptions.push({\n key: i,\n text: member.user.name,\n value: member.user.id,\n image: { avatar: true, src: member.user.gravatar },\n });\n });\n return (\n \n )\n }\n\nThis will render perfectly. But I also want to add one more text(say email) in this text field in a new line. So that dropdown items show similar to this : https://react.semantic-ui.com/elements/list#list-example-relaxed\nHow can I achieve this?\n\nA: Akhila, I would recommend that you use the content prop instead of the text prop for your Dropdown.Item that you are rendering from your memberOptions array. The text prop specifically expects a string. The content prop will accept anything, including other React components or nodes. So instead of returning text as a string, you could do something like this for content, maybe as a separate class method on your component:\nconst renderItemContent = (member) => {\n const {\n email,\n name,\n } = member.user;\n\n const emailStyle = {\n color : '#333',\n fontSize : '.875em',\n }\n\n return(\n \n {name}\n {email &&\n
{email}
\n }\n
\n )\n}\n\nThen set content: this.renderItemContent(member) on your memberOptionsArray.\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/50129466\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"0\"\n}"}}},{"rowIdx":504,"cells":{"text":{"kind":"string","value":"Q: How set set bash variable to file name in Docker I have a Dockerfile in which files in a directory are downloaded:\nRUN wget https://www.classe.cornell.edu/~cesrulib/downloads/tarballs/ -r -l1 --no-parent -A tgz \\\n --cut=99 -nH -nv --show-progress --progress=bar:force:noscroll\n\nI know that there is exactly one file here of the form \"bmad_dist_YYYY_MMDD.tgz\" where \"YYYY_MMDD\" is a date. For example, the file might be named \"bmad_dist_2020_0707.tgz\". I want to set a bash variable to the file name without the \".tgz\" extension. If this was outside of docker I could use:\nFULLNAME=$(ls -1 bmad_dist_*.tgz)\nBMADDIST=\"${FULLNAME%.*}\"\n\nSo I tried in the dockerfile:\nENV FULLNAME $(ls -1 bmad_dist_*.tgz)\nENV BMADDIST \"${FULLNAME%.*}\"\n\nBut this does not work. Is it possible to do what I want?\n\nA: Shell expansion does not happen in Dockerfile ENV. Then workaround that you can try is to pass the name during Docker build.\nGrab the filename during build name and discard the file or you can try --spider for wget to just get the filename.\nARG FULLNAME\nENV FULLNAME=${FULLNAME}\n\nThen pass the full name dynamically during build time.\nFor example\ndocker build --build-args FULLNAME=$(wget -nv https://upload.wikimedia.org/wikipedia/commons/5/54/Golden_Gate_Bridge_0002.jpg 2>&1 |cut -d\\\" -f2) -t my_image .\n\n\n\nA: The ENV ... ... syntax is mainly for plaintext content, docker build arguments, or other environment variables. It does not support a subshell like your example.\nIt is also not possible to use RUN export ... and have that variable defined in downstream image layers.\nThe best route may be to write the name to a file in the filesystem and read from that file instead of an environment variable. Or, if an environment variable is crucial, you could set an environment variable from the contents of that file in an ENTRYPOINT script.\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/62786274\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"0\"\n}"}}},{"rowIdx":505,"cells":{"text":{"kind":"string","value":"Q: Test services with real backend in angular I want to test a service, which calls a real backend url and can not find the solution for it. My service has to call data from server and I want to be sure, that the data comes to the service and the service handle it right.\nSo here is just a simple example of my Login Service:\n@Injectable()\nexport class LoginService {\n/**\n * The token, which will be stored on the localStorage.\n */\npublic token: string;\n//Eventemitter, for updating the navigation, when the user logs in\n@Output() loggedInEm:EventEmitter = new EventEmitter();\n\n\nconstructor(private http: Http) {\n // set token if saved in local storage\n var currentUser = JSON.parse(localStorage.getItem('currentUser'));\n this.token = currentUser && currentUser.token;\n}\n\nlogin(_mail, _pass): Observable {\n var headers = new Headers();\n headers.append('Content-Type', 'application/json');\n var data = {\n mail: _mail,\n pass: _pass\n };\n return this.http.post('/login', JSON.stringify(data), {\n headers : headers\n }).map((response: Response) => {\n let res = response.json();\n this.logged = res;\n });\n}\n\npublic loggedIn() : boolean {\n return this.logged;\n}\n\nThis is how I want to test it:\ndescribe('Login Service', () => {\n\n let loginService: LoginService;\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n declarations: [\n ],\n providers: [\n LoginService\n ],\n imports: [\n FormsModule,\n IonicModule\n ],\n });\n inject([LoginService], (service) => {\n loginService = service;\n });\n });\n\n\n it(\"Should login user\", () => {\n loginService.login(\"mail@mail.ru\", \"123456\");\n let loggedIn = loginService.loggedIn();\n expect(loggedIn).toBe(true);\n });\n});\n\nBut I get following error:\nTypeError: Cannot read property 'login' of undefined, so the service must be undefined. I could mock the service, but I want to work it with the real database, which I have on my backend server. \nSo what could be the problem and how can I solve it?\nKind regards,\nAndrej\n\nA: Try this : \nit(\"Should login user\", () => {\n loginService.login(\"mail@mail.ru\", \"123456\").subscribe(value => {\n let loggedIn = loginService.loggedIn();\n expect(loggedIn).toBe(true);\n done();\n });\n})\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/46252236\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"2\"\n}"}}},{"rowIdx":506,"cells":{"text":{"kind":"string","value":"Q: TypeError: _onRequestWithOpts is not a function at Object.httpsProvider._onRequestWithOpts I'm creating an app that uses firebase-functions. I created my app directory and ran firebase init. After that was completed I tried to run the hello world program that it gives you using firebase serve, and I get this error:\nTypeError: _onRequestWithOpts is not a function\nat Object.httpsProvider._onRequestWithOpts\n\nfrom what it looks like, it seems to be an issue with the onRequest() method but I have made apps using this before and have never ran into this issue. I literally didn't change a single piece of code that they initially give you so unless they decided to change something overnight i'm not sure what the issue is.\nusing firebase deploy works, but firebase serve does not. Using express and adding new functions, the error pops up when running firebase deploy and serve.\nconst functions = require('firebase-functions');\n\n// // Create and Deploy Your First Cloud Functions\n// // https://firebase.google.com/docs/functions/write-firebase- \nfunctions\n//\nexports.helloWorld = functions.https.onRequest((request, response) \n=> {\nresponse.send(\"Hello from Firebase!\");\n});\n\n Gabriels-MacBook-Pro:functions Mike$ firebase serve\n\n === Serving from '/Users/Gabe/Desktop/mycart-functions'...\n\n ⚠ Your requested \"node\" version \"8\" doesn't match your global \n version \"10\"\n ✔ functions: Emulator started at http://localhost:5000\n i functions: Watching \"/Users/Gabe/Desktop/mycart- \n functions/functions\" for Cloud Functions...\n ⚠ TypeError: _onRequestWithOpts is not a function\n at Object.httpsProvider._onRequestWithOpts \n (/usr/local/lib/node_modules/firebase- \n tools/lib/emulator/functionsEmulatorRuntime.js:278:24)\n at Object.httpsProvider.onRequest \n (/usr/local/lib/node_modules/firebase- \n tools/lib/emulator/functionsEmulatorRuntime.js:283:34)\n at Object. (/Users/Gabe/Desktop/mycart- \n functions/functions/index.js:6:39)\n at Module._compile (internal/modules/cjs/loader.js:776:30)\n at Object.Module._extensions..js \n (internal/modules/cjs/loader.js:787:10)\n at Module.load (internal/modules/cjs/loader.js:653:32)\n at tryModuleLoad (internal/modules/cjs/loader.js:593:12)\n at Function.Module._load (internal/modules/cjs/loader.js:585:3)\n at Module.require (internal/modules/cjs/loader.js:690:17)\n at require (internal/modules/cjs/helpers.js:25:18)\n ⚠ We were unable to load your functions code. (see above)\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/56947340\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":507,"cells":{"text":{"kind":"string","value":"Q: SQLite query running successfully in version 3.5.2 but giving error in version 3.7.11 - using aggregate functions My query was working fine in Sqlite 3.5.1 version but when I run the same query in 3.7.11 version am getting misuse of aggregate function min() error. Below one is my query. Please help me in this regard\nselect distinct category from m_ipaperdara order by min(displayorder) asc \n\nA: DISTINCT is not a grouping that can be used for aggregate functions.\nIf you want take the smalled displayorder in each category, you have to explicitly group by that column:\nSELECT category FROM m_ipaperdara GROUP BY category ORDER BY MIN(displayorder)\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/12594607\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"0\"\n}"}}},{"rowIdx":508,"cells":{"text":{"kind":"string","value":"Q: Is PyCharm Community Edition doesn't have Database Tool? I'm using pycharm 2020.3 community edition. but id doesn't showing database tool. it means this edition comes without that option? or any action we have to do for this?\n*Note: some people saying add plugin data base browser. but that is not built in. I want database tool.\n\nA: PyCharm Community doesn't have database tools. See comparison matrix https://www.jetbrains.com/pycharm/features/editions_comparison_matrix.html\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/66837584\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"-1\"\n}"}}},{"rowIdx":509,"cells":{"text":{"kind":"string","value":"Q: solr LowerCaseFilterFactory should not filter number I'm using a query schema which need to let abc match Abc and 400 match 400 (user name match).\nBut I found when I use LowerCaseFilterFactory, It not return any result when I query 400.\nI digg into the source code, and found LowerCaseTokenizerFactory use LowerCaseTokenizer which extends LetterTokenizer, and it filter all the numbers.\nHow should I fix this?\n\nA: You are right that LowerCaseTokenizer will remove all non-letters. It would very useful (as far as providing a meaningful answer) to see your schema, as I don't believe just using the lowercase filter factory should generate a Tokenizer of any kind.\nAt any rate, though, there are plenty of other options for tokenizers. Both Standard or Classic might suit your needs better.\nSomething along the line of:\n\n \n \n\n\nMight do well for you.\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/16248589\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":510,"cells":{"text":{"kind":"string","value":"Q: ErrorException: Creating default object from empty value - Laravel I have just got this error all the tries while updating my table data.\n\nErrorException: Creating default object from empty value\n\nAdminController.php\npublic function update(Request $r, $post_id) {\n $post = Post::find($post_id);\n\n $post->post_title = $r->post_title;\n $post->post_image = $r->post_image;\n $post->post_details = $r->post_details;\n $post->post_rating = $r->post_rating;\n $post->id = $r->id;\n \n $post->save();\n\n return back();\n}\n\nMy Resource Route\nRoute::resource('post', AdminController::class);\n\nBlade File\n
\n\n
post_id) }}\" method=\"POST\">\n @csrf\n @method('PUT')\n\n id}}\">\n post_rating}}\">\n
\n Edit Title: post_title}}\" aria-label=\"default input example\">\n
\n
\n Edit Description:\n \n
\n
\n post_image))}}\" alt=\"\" width=\"120px;\">\n Edit Photos:\n post_image }}\" multiple>\n
\n \n
\n\n
\n\nCould someone help me, please?\n\nA: There is a chance that the model doesn't exist. You can add a check for this in your controller as follows:\npublic function update(Request $r, $post_id) {\n $post = Post::find($post_id);\n if (!$post) {\n // You can add code to handle the case when the model isn't found like displaying an error message\n return back();\n }\n\n $post->post_title = $r->post_title;\n $post->post_image = $r->post_image;\n $post->post_details = $r->post_details;\n $post->post_rating = $r->post_rating;\n $post->id = $r->id;\n \n $post->save();\n\n return back();\n}\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/68810878\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":511,"cells":{"text":{"kind":"string","value":"Q: Communicating between Kernel Threads in Linux I am porting a app/PCI driver from vxWorks to Linux and I would like to keep the same architecture if possible. The current driver has 2 tasks(threads) that communicate with each other using message queues. Is there a mechanism to communicate between kernel threads? The message queues are being used to pass buffer addresses and size info so the tasks can use DMA to move large amounts of data.\n\nA: It sounds like the workqueue interface might be what you're after - or for something lighter-weight, a kfifo combined with a rwsem semaphore.\n\nA: I would strongly advise against keeping the VxWorks architecture on Linux. Kernel thread proliferation is frowned upon, your code will never make it into official kernel tree. Even if you don't care about that, are you 100% sure that you want to develop a driver in a non-standard way ? Things would be much simpler if you would just get rid of these two tasks. BTW, why on earth you need tasks for PCI driver to begin with ? \n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/1442270\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":512,"cells":{"text":{"kind":"string","value":"Q: Django Attribute Error - Form object has no attribute 'is_valid' I am receiving an error, object has no attribute 'is_valid', when trying to insert form data into a form. Below is the structure of my code:\nViews.py:\ndef add_user(request):\n form = Car(request.POST)\n if request.method == 'POST' and form.is_valid():\n last_store = form.cleaned_data.get['value']\n make = request.POST.get('make', '')\n model = request.POST.get('model', '')\n ..\n\n car_obj = Car(last_store = last_store, make = make, model = model, series = series, series_year = series_year, price_new = price_new, engine_size = engine_size, fuel_system = fuel_system, tank_capacity = tank_capacity, power = power, seating_capacity = seating_capacity, standard_transmission = standard_transmission, body_type = body_type, drive = drive, wheelbase = wheelbase, available = available)\n car_obj.save()\n return HttpResponseRedirect('/inventory/add/')\n else:\n form = Car()\n\n return render(request, 'cars/inventory-add.html', {})\n\nClass:\nclass Car(models.Model):\n make = models.CharField(max_length=200, null=False)\n model = models.CharField(max_length=200, null=False)\n series = models.CharField(max_length=200, null=False)\n series_year = models.IntegerField(null=False)\n price_new = models.IntegerField(null=False)\n ..\n last_store = models.ForeignKey(Store, on_delete=models.DO_NOTHING, related_name=\"last_store\")\n available = models.BooleanField(null=False, default=True)\n\n def __str__(self):\n return(self.make + \" \" + self.model)\n\nCarForm (forms.py)\nclass CarForm(forms.ModelForm):\n class Meta:\n model = Car\n fields = ['last_store', 'make', 'model', 'series', 'series_year', 'price_new', 'engine_size', 'fuel_system', 'tank_capacity', 'power', 'seating_capacity', 'standard_transmission', 'body_type', 'drive', 'wheelbase', 'available']\n\nThe error lies within the last_store as without form.is_valid(), apparently I cannot use form.cleaned_data, but form.is_valid() seems to not even exist? As seen in the class, last_store is of type a foreign key, therefore I am struggling to set the default value for it when the user enters input into the form. The last_store variable is attempting to fetch the value from the inputted form data which consists of a SELECT option..\n\nA: You have a clash between your model and form, which are both named Car. Typically you would fix this by renaming the form CarForm.\nNote that you shouldn't normally need to create the object with car_obj = Car(...). If you use a model form, you can simplify your code to car_obj = form.save(). You should also move CarForm(request.POST) inside the if request.method == 'POST' check, and include form in the template context. Putting that together, you get something like:\ndef add_user(request):\n if request.method == 'POST':\n form = CarForm(request.POST)\n if form.is_valid():\n car_obj = form.save()\n return HttpResponseRedirect('/inventory/add/')\n else:\n form = CarForm()\n return render(request, 'cars/inventory-add.html', {'form': form})\n\n\nA: In your views.py file line 2\nform = Car(request.POST):\n\nchange it to\nform = CarForm(request.POST):\n\nHope it works!\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/52952348\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"0\"\n}"}}},{"rowIdx":513,"cells":{"text":{"kind":"string","value":"Q: how do i define props in a function i am new to react and i am trying to use props in a function and i am not sure how to use it. This is the code.\nimport React from 'react';\nimport './Card.css';\nimport { connect } from 'react-redux';\nimport { addBasket } from '../actions/addAction';\nfunction Card({props},{image, title,author,price}) {\n return (\n
\n
\n \n
\n
\n
\n

{props.title}

\n
\n

{props.author}

\n
\n
\n

£{props.price}

\n
\n \n
\n );\n}\n\nexport default connect(null, { addBasket })(Card);\n\nAnd that's the error i am getting.\nTypeError: Cannot read property 'title' of undefined\n
\n
\n
\n

{props.title}

\n
\n

{props.author}

\n
\n\n\nA: Replace\nfunction Card({props},{image, title,author,price}) {\n\nwith\nfunction Card(props) {\n\nI recommend working through the official React tutorial before using Redux.\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/65298201\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":514,"cells":{"text":{"kind":"string","value":"Q: How To get the Check Rule Constraint How can I get the expression of a check constraint?\nWith MSSMS I can easly see that Table Person has a CHECK constraint named CK_Person validating the expression ([DateOfBirth]<[DateOfDeath]).\nWith this query I can get the COLUMN_NAME, CONSTRAINT_NAME and CONSTRAINT_TYPE:\nSELECT CCU.COLUMN_NAME, CCU.CONSTRAINT_NAME, TC.CONSTRAINT_TYPE\n FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC\n INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS CCU ON TC.CONSTRAINT_NAME = CCU.CONSTRAINT_NAME\n WHERE TC.TABLE_NAME = 'Person'\n\nResulting\n+-------------+-----------------+-----------------+\n| COLUMN_NAME | CONSTRAINT_NAME | CONSTRAINT_TYPE |\n+-------------+-----------------+-----------------+\n| PersonID | PK_Person | PRIMARY KEY |\n| DateOfBirth | CK_Person | CHECK |\n| DateOfDeath | CK_Person | CHECK |\n+-------------+-----------------+-----------------+\n\nBut how can I get the actual expression itself?\n\nA: Try this...\nSELECT definition AS Check_Expression\n ,name AS ConstraintName\nFROM sys.check_constraints\nWHERE Parent_object_ID = OBJECT_ID('TableName')\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/30226137\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"0\"\n}"}}},{"rowIdx":515,"cells":{"text":{"kind":"string","value":"Q: Custom view, onSaveInstanceState is not called I created a custom view, and tried to restore the state automatically on screen rotation (just as EditText restores current input text automatically), but when I see the log, onSaveInstanceState is not called, and only onRestoreInstanceState is called. What is wrong?\nclass MyView:LinearLayout\n{\n constructor(context: Context?) : super(context)\n constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)\n constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(\n context, attrs, defStyleAttr)\n\n init\n {\n isSaveEnabled=true\n }\n\n override fun onSaveInstanceState(): Parcelable\n {\n return super.onSaveInstanceState()\n Log.d(\"ss\", \"save\")\n }\n\n override fun onRestoreInstanceState(state: Parcelable?)\n {\n super.onRestoreInstanceState(state)\n Log.d(\"ss\", \"restore\")\n }\n}\n\nActivity layout:\n\n\n\n \n\n\nActivity:\nclass MainActivity : AppCompatActivity()\n{\n\n override fun onCreate(savedInstanceState: Bundle?)\n {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n }\n}\n\n\nA: The reason why you can't see Log.d(\"ss\", \"save\") being called is simply that the code line is invoked after the return statement. The onSaveInstanceState() is actually called. To see the log move Log.d(\"ss\", \"save\") above return super.onSaveInstanceState().\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/50555614\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"-1\"\n}"}}},{"rowIdx":516,"cells":{"text":{"kind":"string","value":"Q: MySQL : Updating a table having a 'where' clause with a max value I want to update the last generated row (the max(id) row.\nI tried this code but it doesn't work \nupdate person t1\nset t1.age = 25\nwhere t1.id = (select max(t2.id) from person t2\n where t2.address = 'LA, California');\n\nMySQL tells me that : Error Code: 1093. You can't specify target table 't1' for update in FROM clause\nSo, I suppose that I cannot reach the same tale while performing operations such as updates.\nHow can I sole this problem ?\nRegards.\n\nA: You cannot reference the same table in a subquery, but you can instead do it in a JOIN (which is allowed in UPDATE and DELETE statements):\nUPDATE person a\nJOIN (SELECT MAX(id) AS id FROM person WHERE address = 'LA, California') b\n ON a.id = b.id\nSET a.age = 25\n\nAnother way you can do it is by using the ORDER BY / LIMIT technique:\nUPDATE person\nSET age = 25\nWHERE address = 'LA, California'\nORDER BY id DESC\nLIMIT 1\n\n\nA: You can try as:\nUPDATE person t1\n INNER JOIN (SELECT MAX(id) AS id FROM person\n WHERE t2.address = 'LA, California') t2\n ON t1.id = t2.id\nSET t1.age = 25;\n\nor\nSELECT MAX(t2.id)\nINTO @var_max_id\nFROM person t2\nWHERE t2.address = 'LA, California';\n\nUPDATE person t1\nSET t1.age = 25\nWHERE t1.id = IFNULL(@var_max_id, -1);\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/11719346\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"0\"\n}"}}},{"rowIdx":517,"cells":{"text":{"kind":"string","value":"Q: ClosedXML Copy and Paste Range of formulas as values I have a function ApplyFormulas() that will obviously apply formulas like so\ndetailWs.Range(companyModel.RevenueFormulaRangeDollars).FormulaR1C1 = companyModel.RevenueFormulaDollars;\n\nHowever Now I need to copy that range and paste it in the same spot so the values are real and not just formula references. \nI am able to do this in VBA with excel interop but I am utilizing ClosedXML. Does anyone know of a way to do this? I tried CopyTo() but there is no paste special etc.\nI also attempted\ndetailWs.Range(companyModel.NoChargeFormulaRangePercent).Value = detailWs.Range(companyModel.NoChargeFormulaRangePercent).Value;\n\nbut im getting a property or indexer cant be used because it lacks a getter but from what I can tell both have a get; set; property.\nI've tried a couple for things and still not working..\n var test = detailWs.Range(companyModel.NoChargeFormulaRangePercent).CellsUsed();\n foreach(var c in test)\n {\n c.Value = c.Value.ToString();\n }\n\n\nA: Here's what I created a few months ago to copy all the formulas in one worksheet to another. \nNote: I am having a problem where some formulas using a Name are not correctly copying the Name because something thinks the Name(i.e. =QF00) is a reference and will change it with AutoFill. Will update when I figure it out.\ncx.IXLWorksheet out_buff\ncx.IXLRange src_range\ncx.IXLCells tRows = src_range.CellsUsed(x => x.FormulaA1.Length > 0);\n\nforeach (cx.IXLCell v in tRows)\n{\n cell_address = v.Address.ToString();\n out_buff.Range(cell_address).FormulaA1 = v.FormulaA1;\n}\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/53675836\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":518,"cells":{"text":{"kind":"string","value":"Q: Only the last usercontrol shows contentcontrol I have a weird problem. I've created a usercontrol with a label and a canvas.\nThe canvas references a resource.\nBut the canvas is only shown on the last control in my stackpanel.\nThis is my window\n\n\n\n\n \n \n \n \n \n \n \n \n\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n\n\nThis is my usercontrol, in the contentcontrol at the bottom I reference my canvas.\n\n\n\n \n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n\nAnd this is my App file where I define my resources\n\n\n \n \n \n\n \n \n \n\n \n \n \n\n\n \n\n\n\n\n\nAs you can see in the screenshot, only the last control shows the canvas.. \n\nA: Since you have only one Canvas and each Visual can have only one parent in visual tree therefore each time you place your resource it's put in that place of visual tree and removed from the previous place. You can either put Canvas directly into ViewBox in UserControl and make Path a resource or you can try setting x:Shared attribute to false on your Canvas which should result in new instance of resource being created each time you refer to it:\n\n \n \n \n\n\n\nA: Set x:Shared=false on resource. It will work.\n\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/18658092\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"3\"\n}"}}},{"rowIdx":519,"cells":{"text":{"kind":"string","value":"Q: Problems while running the alexa helloWorldSample I try to deploy the alexa helloworld skill on my own Server using this tutorial\nI can build the Sample and get 2 jar files in the target directory but when i try to run the Server via\nmvn exec:java -Dexec.executable=”java” -DdisableRequestSignatureCheck=true \ni get this error:\njava.lang.ClassNotFoundException: Launcher\nCan anyone help me in this case? \nBest regards, \nFelixT\nHere is my logfile with the error: \n[DEBUG] Goal: org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli)\n[DEBUG] Style: Regular\n[DEBUG] Configuration: \n\n ${exec.arguments}\n ${exec.classpathScope}\n ${exec.cleanupDaemonThreads} default-value=\n ${exec.args}\n ${exec.daemonThreadJoinTimeout}\n ${exec.includePluginDependencies}\n ${exec.includeProjectDependencies}\n ${exec.keepAlive}\n ${exec.killAfter}\n \n Launcher\n \n \n \n ${skip}\n ${sourceRoot}\n ${exec.stopUnresponsiveDaemonThreads} default-value=\n \n \n javax.net.ssl.keyStore\n /root/java-keystore.jks\n \n \n javax.net.ssl.keyStorePassword\n XXXXXXXXXX\n \n \n com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck\n true\n \n \n com.amazon.speech.speechlet.servlet.supportedApplicationIds\n ${supportedApplicationIds}\n \n \n com.amazon.speech.speechlet.servlet.timestampTolerance\n ${timestampTolerance}\n \n \n ${testSourceRoot}\n\n[DEBUG] =======================================================================\n[INFO] \n[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ helloworld >>>\n[INFO] \n[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ helloworld <<<\n[DEBUG] Could not find metadata joda-time:joda-time/maven-metadata.xml in local (/root/.m2/repository)\n[DEBUG] Failure to find joda-time:joda-time/maven-metadata.xml in file:///root/samples/skill-samples-java-master/helloworld/repo was cached in the local repository, resolution will not be reattempted until the update interval of alexa-skills-kit-repo has elapsed or updates are forced\n[DEBUG] Skipped remote update check for joda-time:joda-time/maven-metadata.xml, locally cached metadata up-to-date.\n[DEBUG] alexa-skills-kit-samples:helloworld:jar:1.0\n[DEBUG] com.amazon.alexa:alexa-skills-kit:jar:1.6.0:compile\n[DEBUG] org.eclipse.jetty:jetty-server:jar:9.0.6.v20130930:compile\n[DEBUG] org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile\n[DEBUG] org.eclipse.jetty:jetty-http:jar:9.0.6.v20130930:compile\n[DEBUG] org.eclipse.jetty:jetty-util:jar:9.0.6.v20130930:compile\n[DEBUG] org.eclipse.jetty:jetty-io:jar:9.0.6.v20130930:compile\n[DEBUG] org.eclipse.jetty:jetty-servlet:jar:9.0.6.v20130930:compile\n[DEBUG] org.eclipse.jetty:jetty-security:jar:9.0.6.v20130930:compile\n[DEBUG] log4j:log4j:jar:1.2.17:compile\n[DEBUG] org.slf4j:slf4j-api:jar:1.7.10:compile\n[DEBUG] org.slf4j:slf4j-log4j12:jar:1.7.10:compile\n[DEBUG] org.apache.commons:commons-lang3:jar:3.4:compile\n[DEBUG] org.apache.directory.studio:org.apache.commons.io:jar:2.4:compile\n[DEBUG] commons-io:commons-io:jar:2.4:compile\n[DEBUG] com.amazonaws:aws-lambda-java-core:jar:1.0.0:compile\n[DEBUG] com.amazonaws:aws-lambda-java-log4j:jar:1.0.0:compile\n[DEBUG] com.amazonaws:aws-java-sdk-dynamodb:jar:1.9.40:compile\n[DEBUG] com.amazonaws:aws-java-sdk-s3:jar:1.9.40:compile\n[DEBUG] com.amazonaws:aws-java-sdk-kms:jar:1.9.40:compile\n[DEBUG] com.amazonaws:aws-java-sdk-core:jar:1.9.40:compile\n[DEBUG] commons-logging:commons-logging:jar:1.1.3:compile\n[DEBUG] org.apache.httpcomponents:httpclient:jar:4.3.4:compile\n[DEBUG] org.apache.httpcomponents:httpcore:jar:4.3.2:compile\n[DEBUG] commons-codec:commons-codec:jar:1.6:compile\n[DEBUG] com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile\n[DEBUG] com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile\n[DEBUG] com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile\n[DEBUG] joda-time:joda-time:jar:2.9.9:compile\n[INFO] \n[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ helloworld ---\n[DEBUG] Created new class realm maven.api\n[DEBUG] Importing foreign packages into class realm maven.api\n[DEBUG] Imported: org.apache.maven.cli < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core\n[DEBUG] Imported: org.apache.maven.lifecycle < plexus.core\n[DEBUG] Imported: org.apache.maven.repository < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.personality < plexus.core\n[DEBUG] Imported: org.apache.maven.usability < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core\n[DEBUG] Imported: org.sonatype.aether.version < plexus.core\n[DEBUG] Imported: org.sonatype.aether.* < plexus.core\n[DEBUG] Imported: org.sonatype.aether.artifact < plexus.core\n[DEBUG] Imported: org.apache.maven.* < plexus.core\n[DEBUG] Imported: org.apache.maven.project < plexus.core\n[DEBUG] Imported: org.sonatype.aether.repository < plexus.core\n[DEBUG] Imported: org.sonatype.aether.impl < plexus.core\n[DEBUG] Imported: org.apache.maven.exception < plexus.core\n[DEBUG] Imported: org.apache.maven.plugin < plexus.core\n[DEBUG] Imported: org.sonatype.aether.collection < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.* < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.logging < plexus.core\n[DEBUG] Imported: org.apache.maven.profiles < plexus.core\n[DEBUG] Imported: org.sonatype.aether.metadata < plexus.core\n[DEBUG] Imported: org.sonatype.aether.spi < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.* < plexus.core\n[DEBUG] Imported: org.sonatype.aether.graph < plexus.core\n[DEBUG] Imported: org.apache.maven.rtinfo < plexus.core\n[DEBUG] Imported: org.sonatype.aether.installation < plexus.core\n[DEBUG] Imported: org.apache.maven.monitor < plexus.core\n[DEBUG] Imported: org.sonatype.aether.transfer < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.context < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core\n[DEBUG] Imported: org.sonatype.aether.deployment < plexus.core\n[DEBUG] Imported: org.apache.maven.model < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core\n[DEBUG] Imported: org.apache.maven.artifact < plexus.core\n[DEBUG] Imported: org.apache.maven.toolchain < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core\n[DEBUG] Imported: org.apache.maven.settings < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.events < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core\n[DEBUG] Imported: org.apache.maven.reporting < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core\n[DEBUG] Imported: org.apache.maven.configuration < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core\n[DEBUG] Imported: org.codehaus.classworlds < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core\n[DEBUG] Imported: org.apache.maven.classrealm < plexus.core\n[DEBUG] Imported: org.sonatype.aether.resolution < plexus.core\n[DEBUG] Imported: org.apache.maven.execution < plexus.core\n[DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.container < plexus.core\n[DEBUG] Imported: org.codehaus.plexus.component < plexus.core\n[DEBUG] Populating class realm maven.api\n[DEBUG] org.codehaus.mojo:exec-maven-plugin:jar:1.2.1:\n[DEBUG] org.apache.maven:maven-toolchain:jar:1.0:compile\n[DEBUG] org.apache.maven:maven-project:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-settings:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-profile:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-model:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-artifact:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-core:jar:2.0.6:compile\n[DEBUG] org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile\n[DEBUG] org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile\n[DEBUG] org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile\n[DEBUG] org.apache.maven:maven-error-diagnostics:jar:2.0.6:compile\n[DEBUG] commons-cli:commons-cli:jar:1.0:compile\n[DEBUG] org.apache.maven:maven-plugin-descriptor:jar:2.0.6:compile\n[DEBUG] org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile\n[DEBUG] org.apache.maven:maven-monitor:jar:2.0.6:compile\n[DEBUG] classworlds:classworlds:jar:1.1:compile\n[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:compile\n[DEBUG] org.codehaus.plexus:plexus-utils:jar:2.0.5:compile\n[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile\n[DEBUG] junit:junit:jar:3.8.2:test (scope managed from compile) (version managed from 3.8.1)\n[DEBUG] org.apache.commons:commons-exec:jar:1.1:compile\n[DEBUG] Created new class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1\n[DEBUG] Importing foreign packages into class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1\n[DEBUG] Imported: < maven.api\n[DEBUG] Populating class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1\n[DEBUG] Included: org.codehaus.mojo:exec-maven-plugin:jar:1.2.1\n[DEBUG] Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.6\n[DEBUG] Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7\n[DEBUG] Included: commons-cli:commons-cli:jar:1.0\n[DEBUG] Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4\n[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:2.0.5\n[DEBUG] Included: org.apache.commons:commons-exec:jar:1.1\n[DEBUG] Excluded: org.apache.maven:maven-toolchain:jar:1.0\n[DEBUG] Excluded: org.apache.maven:maven-project:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-settings:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-profile:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-model:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-artifact:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-core:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.6\n[DEBUG] Excluded: org.apache.maven:maven-monitor:jar:2.0.6\n[DEBUG] Excluded: classworlds:classworlds:jar:1.1\n[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6\n[DEBUG] Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9\n[DEBUG] Excluded: junit:junit:jar:3.8.2\n[DEBUG] Configuring mojo org.codehaus.mojo:exec-maven-plugin:1.2.1:java from plugin realm ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1, parent: sun.misc.Launcher$AppClassLoader@a14482]\n[DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.2.1:java' with basic configurator -->\n[DEBUG] (f) arguments = []\n[DEBUG] (f) classpathScope = runtime\n[DEBUG] (f) cleanupDaemonThreads = false\n[DEBUG] (f) daemonThreadJoinTimeout = 15000\n[DEBUG] (f) includePluginDependencies = false\n[DEBUG] (f) includeProjectDependencies = true\n[DEBUG] (f) keepAlive = false\n[DEBUG] (f) killAfter = -1\n[DEBUG] (f) localRepository = id: local\n url: file:///root/.m2/repository/\n layout: none\n\n[DEBUG] (f) mainClass = Launcher\n[DEBUG] (f) pluginDependencies = [org.codehaus.mojo:exec-maven-plugin:maven-plugin:1.2.1:, org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile, org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile, commons-cli:commons-cli:jar:1.0:compile, org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile, org.codehaus.plexus:plexus-utils:jar:2.0.5:compile, org.apache.commons:commons-exec:jar:1.1:compile]\n[DEBUG] (f) project = MavenProject: alexa-skills-kit-samples:helloworld:1.0 @ /root/samples/skill-samples-java-master/helloworld/pom.xml\n[DEBUG] (f) remoteRepositories = [ id: alexa-skills-kit-repo\n url: file:///root/samples/skill-samples-java-master/helloworld/repo\n layout: default\nsnapshots: [enabled => true, update => daily]\n releases: [enabled => true, update => daily]\n, id: central\n url: https://repo.maven.apache.org/maven2\n layout: default\nsnapshots: [enabled => false, update => daily]\n releases: [enabled => true, update => daily]\n]\n[DEBUG] (f) skip = false\n[DEBUG] (f) stopUnresponsiveDaemonThreads = false\n[DEBUG] (s) key = javax.net.ssl.keyStore\n[DEBUG] (s) value = /root/java-keystore.jks\n[DEBUG] (s) key = javax.net.ssl.keyStorePassword\n[DEBUG] (s) value = Felix123\n[DEBUG] (s) key = com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck\n[DEBUG] (s) value = true\n[DEBUG] (s) key = com.amazon.speech.speechlet.servlet.supportedApplicationIds\n[DEBUG] (s) key = com.amazon.speech.speechlet.servlet.timestampTolerance\n[DEBUG] (f) systemProperties = [org.codehaus.mojo.exec.Property@7b159b, org.codehaus.mojo.exec.Property@5d9a50, org.codehaus.mojo.exec.Property@957c0f, org.codehaus.mojo.exec.Property@13a5f75, org.codehaus.mojo.exec.Property@1cb4004]\n[DEBUG] -- end configuration --\n[DEBUG] Invoking : Launcher.main()\n[DEBUG] Plugin Dependencies will be excluded.\n[DEBUG] Project Dependencies will be included.\n[DEBUG] Collected project artifacts [com.amazon.alexa:alexa-skills-kit:jar:1.6.0:compile, org.eclipse.jetty:jetty-server:jar:9.0.6.v20130930:compile, org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile, org.eclipse.jetty:jetty-http:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-util:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-io:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-servlet:jar:9.0.6.v20130930:compile, org.eclipse.jetty:jetty-security:jar:9.0.6.v20130930:compile, log4j:log4j:jar:1.2.17:compile, org.slf4j:slf4j-api:jar:1.7.10:compile, org.slf4j:slf4j-log4j12:jar:1.7.10:compile, org.apache.commons:commons-lang3:jar:3.4:compile, org.apache.directory.studio:org.apache.commons.io:jar:2.4:compile, commons-io:commons-io:jar:2.4:compile, com.amazonaws:aws-lambda-java-core:jar:1.0.0:compile, com.amazonaws:aws-lambda-java-log4j:jar:1.0.0:compile, com.amazonaws:aws-java-sdk-dynamodb:jar:1.9.40:compile, com.amazonaws:aws-java-sdk-s3:jar:1.9.40:compile, com.amazonaws:aws-java-sdk-kms:jar:1.9.40:compile, com.amazonaws:aws-java-sdk-core:jar:1.9.40:compile, commons-logging:commons-logging:jar:1.1.3:compile, org.apache.httpcomponents:httpclient:jar:4.3.4:compile, org.apache.httpcomponents:httpcore:jar:4.3.2:compile, commons-codec:commons-codec:jar:1.6:compile, com.fasterxml.jackson.core:jackson-databind:jar:2.3.2:compile, com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile, com.fasterxml.jackson.core:jackson-core:jar:2.3.2:compile, joda-time:joda-time:jar:2.9.9:compile]\n[DEBUG] Collected project classpath [/root/samples/skill-samples-java-master/helloworld/target/classes]\n[DEBUG] Adding to classpath : file:/root/samples/skill-samples-java-master/helloworld/target/classes/\n[DEBUG] Adding project dependency artifact: alexa-skills-kit to classpath\n[DEBUG] Adding project dependency artifact: jetty-server to classpath\n[DEBUG] Adding project dependency artifact: javax.servlet to classpath\n[DEBUG] Adding project dependency artifact: jetty-http to classpath\n[DEBUG] Adding project dependency artifact: jetty-util to classpath\n[DEBUG] Adding project dependency artifact: jetty-io to classpath\n[DEBUG] Adding project dependency artifact: jetty-servlet to classpath\n[DEBUG] Adding project dependency artifact: jetty-security to classpath\n[DEBUG] Adding project dependency artifact: log4j to classpath\n[DEBUG] Adding project dependency artifact: slf4j-api to classpath\n[DEBUG] Adding project dependency artifact: slf4j-log4j12 to classpath\n[DEBUG] Adding project dependency artifact: commons-lang3 to classpath\n[DEBUG] Adding project dependency artifact: org.apache.commons.io to classpath\n[DEBUG] Adding project dependency artifact: commons-io to classpath\n[DEBUG] Adding project dependency artifact: aws-lambda-java-core to classpath\n[DEBUG] Adding project dependency artifact: aws-lambda-java-log4j to classpath\n[DEBUG] Adding project dependency artifact: aws-java-sdk-dynamodb to classpath\n[DEBUG] Adding project dependency artifact: aws-java-sdk-s3 to classpath\n[DEBUG] Adding project dependency artifact: aws-java-sdk-kms to classpath\n[DEBUG] Adding project dependency artifact: aws-java-sdk-core to classpath\n[DEBUG] Adding project dependency artifact: commons-logging to classpath\n[DEBUG] Adding project dependency artifact: httpclient to classpath\n[DEBUG] Adding project dependency artifact: httpcore to classpath\n[DEBUG] Adding project dependency artifact: commons-codec to classpath\n[DEBUG] Adding project dependency artifact: jackson-databind to classpath\n[DEBUG] Adding project dependency artifact: jackson-annotations to classpath\n[DEBUG] Adding project dependency artifact: jackson-core to classpath\n[DEBUG] Adding project dependency artifact: joda-time to classpath\n[DEBUG] joining on thread Thread[Launcher.main(),5,Launcher]\n[WARNING] \njava.lang.ClassNotFoundException: Launcher\n at java.net.URLClassLoader.findClass(URLClassLoader.java:381)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)\n at java.lang.Thread.run(Thread.java:748)\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD FAILURE\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 1:46.627s\n[INFO] Finished at: Fri Oct 27 19:09:37 UTC 2017\n[INFO] Final Memory: 7M/17M\n[INFO] ------------------------------------------------------------------------\n[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project helloworld: An exception occured while executing the Java class. Launcher -> [Help 1]\norg.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project helloworld: An exception occured while executing the Java class. Launcher\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)\n at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)\n at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)\n at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)\n at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)\n at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)\n at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)\n at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)\n at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)\n at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n at java.lang.reflect.Method.invoke(Method.java:498)\n at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)\n at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)\n at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)\n at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)\nCaused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. Launcher\n at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352)\n at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)\n ... 19 more\nCaused by: java.lang.ClassNotFoundException: Launcher\n at java.net.URLClassLoader.findClass(URLClassLoader.java:381)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n at java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)\n at java.lang.Thread.run(Thread.java:748)\n[ERROR] \n[ERROR] \n[ERROR] For more information about the errors and possible solutions, please read the following articles:\n[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException\n\nand the Pom.xml: \n http://maven.apache.org/maven-v4_0_0.xsd\">\n 4.0.0\n alexa-skills-kit-samples\n helloworld\n jar\n 1.0\n helloworld\n http://developer.amazon.com/ask\n \n \n alexa-skills-kit-repo\n file://${project.basedir}/repo\n \n \n\n \n \n com.amazon.alexa\n alexa-skills-kit\n 1.6.0\n compile\n \n \n org.eclipse.jetty\n jetty-server\n 9.0.6.v20130930\n compile\n \n \n org.eclipse.jetty\n jetty-servlet\n 9.0.6.v20130930\n compile\n \n \n log4j\n log4j\n 1.2.17\n compile\n \n \n org.slf4j\n slf4j-api\n 1.7.10\n compile\n \n \n org.slf4j\n slf4j-log4j12\n 1.7.10\n \n \n org.apache.commons\n commons-lang3\n 3.4\n compile\n \n \n org.apache.directory.studio\n org.apache.commons.io\n 2.4\n compile\n \n \n com.amazonaws\n aws-lambda-java-core\n 1.0.0\n compile\n \n \n com.amazonaws\n aws-lambda-java-log4j\n 1.0.0\n compile\n \n \n com.amazonaws\n aws-java-sdk-dynamodb\n 1.9.40\n \n \n\n \n \n \n \n \n\n \n src\n \n \n src/resources\n \n \n \n \n \n org.apache.maven.plugins\n maven-compiler-plugin\n 3.3\n \n 1.7\n 1.7\n \n \n\n \n org.codehaus.mojo\n exec-maven-plugin\n 1.2.1\n \n Launcher\n \n \n javax.net.ssl.keyStore\n /root/java-keystore.jks\n \n \n javax.net.ssl.keyStorePassword\n Felix123\n \n \n com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck\n ${disableRequestSignatureCheck}\n \n \n com.amazon.speech.speechlet.servlet.supportedApplicationIds\n ${supportedApplicationIds}\n \n \n com.amazon.speech.speechlet.servlet.timestampTolerance\n ${timestampTolerance}\n \n \n \n \n \n \n \n\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/46982459\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":520,"cells":{"text":{"kind":"string","value":"Q: Keep icon bar floated right and wrap text around I have a little header bar in html/css where there are a couple icons floated to the right side. I want them to remain in position and have the title (on the left) just wrap below if the area gets too small on the right side. Right now, my html looks like so (using bootstrap) :\n
\n

02 Development, LLC v. 607 South Park, LLC

\n
\n
\n\nSo I have a col-sm-8 and col-sm-4. This will not work in the long run because col-sm-4 is too small in certain sizes, so I need to make the right column with the icon have a set width (140px lets say). So if a set a min-width on the right side it's going break on smaller sizes.\nWhat I am wondering if, is there a way to let that title on the left side in the col-sm-8 move around the set width buttons on the right side when responsive (i basically want the buttons to stay in the same place the whole time). Something like if the buttons on the right were absolutely position but not out of the flow so the text reacts to it.\nHere is a fiddle I was fooling with https://jsfiddle.net/DTcHh/24085/\nEDIT \nSo I improvised a solution by doing the following :\n- taking the right icon-bar element out of the dom flow by absolutely positioning it and giving it a set with\n- adding the same width as padding to the element wrapping both the left and the right items\nI could then just do away with the col's all together. The code looks like so :\nHTML:\n
\n
\n\n

02 Development, LLC v. 607 South Park, LLC

\n
\n 123\n
\n
\n
\n

test 123345.

\n

\n

cases

\n
\n
\n\nCSS: \n.activity-panel-item {\n height: 100%;\n padding: 0;\n}\n\n.activity-panel-item--header {\n position: fixed;\n width: 100%;\n top: 0;\n left: 0;\n padding: 12px 125px 12px 12px;\n min-height: 50px;\n background-color: rgba(0, 0, 0, 0.8);\n}\n\n.activity-panel-item--header p {\n color: #fff;\n}\n\n.activity-panel-item--header .icon {\n cursor: pointer;\n color: #fff;\n margin: 0px 12px;\n font-size: 20px;\n}\n\n.activity-panel-item--body {\n overflow-y: auto;\n padding: 10px 20px;\n display: block;\n width: 100%;\n height: 100%\n}\n\n.activity-title-input {\n width: 100%;\n}\n\n.activity-panel-item--header--iconbar {\n display: block;\n float: right;\n top: 10px;\n right: 10px;\n width: 125px;\n min-height: 50px;\n height: auto;\n position: absolute;\n}\n\nSee working fiddle: https://jsfiddle.net/DTcHh/24114/ \nAny and all input would be helpful, or if anyone has a different working approach that would be great also. Thanks!\n\nA: You can do it without bootstrap col-*-* and by giving the explicit width to both divs, plus little extra style to your icon bar.\nUpdated Code\n
\n
\n

02 Development, LLC v. 607 South Park, LLC

\n
\n
123
\n
\n\njsFiddle\nEDIT 1\nIf you think deeply according to this solution we both are at same point. Let me explain, I am giving minimum width 25% to icon bar and 75% width to left element. That mean depending on situation width of icon bar can be increase but it must be at least 25% of total screen or container and width of left element is 75% that can be decrease depending on situation. \nAnd you are giving width 125px or any to icon bar that means it can be increase or decrease depending on situation but the original is 125px\nHere the situation I mean area and screen resolution. If icon are larger and not fit in 25% then this width can be increase and left element can be decrease same is your edited case if icon bar not fit in 125px then this width can be increase because we are not mentioning the maximum width to icon bar or minimum width to left element.\n.\nEDIT 2\nI hope this is not illegal on stackoverflow to edit answer as many time as I need.\nApart from coding let’s do some math. Suppose we have 3 icon of (32x32) each. So the total width of icon wrapper will (32+32+32) 96px add little margin of 12px to each icon (12x3=36) on right side for beauty. Now the wrapper width is 96+36 = 132px. And we are on device that has width of 400px. My icon wrapper is (25%) 100px of 400px (device width) and your wrapper is 125px. I am saying OK browser minimum width of icon wrapper is 100px but if icons are larger and not fit in 100px you can increase this width according to you need, In this case it will increase 100px to 132px or any. But I don't want to break these icons to next line. They should be display in their original size and style (32x32) plus margin. You can break left content (text) to wrap around these icons but don't break the icons itself. They should retain their original size. No matter what ever device width is. Browser, Please don't decrease the icon size just increase wrapper width.\nAnd your 125px is less than 132px. So your wrapper will break and one of its icon will move to next line. Until you have to go to you CSS and explicitly wrote 132px or any in width. And what if after one month your boss said please place icon of 40x40 and after 3 month and so on...?\nTry it, place larger icons and see what happens to your width: 125px.\n\nA: Unless I am totally misunderstanding you.. here is a easy method. Too much CSS \nclasses so I used my own but you get the concept. \n
\n
\n

02 Development, LLC v. 607 South Park, LLC

\n
\n
\n 1\n 2\n 3\n
\n
\n
\n

test 123345.

\n

Nothing Here

\n

cases

\n
\n\nDemo: https://jsfiddle.net/norcaljohnny/ovo83p5k/\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/39153253\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"5\"\n}"}}},{"rowIdx":521,"cells":{"text":{"kind":"string","value":"Q: Displaying malformed html with twig Assume we have a string\n$mystring = \" Hello\"\n\nHow can I display this string using twig while preventing leaking html tags? Or in other word how can I make twig to close tags automatically if they are still open?\nI guess {{ mystring | raw }} just prints raw text without verifying / purifying.\n\nA: sw_sanitize does this already.\n{{ ' hello' | sw_sanitize }}\n\nProduces:\n hello().Where(item => item.Selected).Select(item => item.Value).ToArray();\n List objLessonDetails = objLessonDashboard.getLessonLearntDetails();\n var searchData = objLessonDetails.Where(i => (ddlAsset.SelectedValue == \"0\") || (i._Asset.AssetID == ddlAsset.SelectedValue))\n .Where(i => (ddlAuditType.SelectedValue == \"0\") || (i._Audit.AuditTypeID == ddlAuditType.SelectedValue))\n .Where(i => (chklstDepartment.SelectedValue == \"0\") || (selectedIds.Contains(i._Department.DepartmentID)))\n .Where(i => (ddlCategory.SelectedValue == \"0\") || (i._Category.CategoryID == ddlCategory.SelectedValue))\n .Where(i => (ddlStartYear.SelectedItem.Text == \"--Select All--\") || (Convert.ToInt32(i._Year.StartYear) >= Convert.ToInt32(ddlStartYear.SelectedItem.Text)))\n .Where(i => (ddlEndYear.SelectedItem.Text == \"--Select All--\") || (Convert.ToInt32(i._Year.EndYear) <= Convert.ToInt32(ddlEndYear.SelectedItem.Text)))\n .Distinct().ToList();\n BindGrid(searchData);\n\n\nA: Use \"\" in place of \"0\".\nchklstDepartment.SelectedValue == \"\"\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/44922008\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"-1\"\n}"}}},{"rowIdx":523,"cells":{"text":{"kind":"string","value":"Q: How can I create views with dynamic content in iOS? I' m encountered with a problem because of my lack of knowledge of iOS platform I think.I have a view controller User Profile. The main view has next structure: ScrollView which contains one subview and this UIView has 7 UIViews with UILabels, UItextViews, UIImageViews, etc. each of them displays specific info about user. The problem - data for this views is fetched from the server and it can be different. E.g I have a subview Education, it contains next info: name of the institute, degree, years of learning, etc. But one user can have several educations. So the size of this view can be dynamic. But i can't simply change the view size with view.frame = CGRectMake because under it I have a view job experience and etc. Or for example professional skills view: it can be one skill and it can be one hundred skills for one user -so I need to change the size of this view but under it I have another view so i need to move it and so on and so forth. So the question what is the correct way of dealing with this situation? I understood that I can't just change view frames with view.frame= CGRectMake() - because it is too much work and it is a stupid approach I think. I know there must be some more straightforward way for this very common problem, may be autolayout or something else? Anyway I hope for some help and advice of how can I make views with dynamic content. \n\nA: I really don't know why you said \"I can't just change view frames\". Of course you can!\nThe approach I always take to this scenario (where your view's height is variable) is to declare a yOffset property and based on this I place my content at the right y position. \n@property (nonatomic, assign) int yOffset;\n\nThen inside the init method I initialize this property to either 0 or some predefined initial margin.\n_yOffset = TOP_MARGIN;\n\nThen consider the following scenario: a user profile with n number of skills. This is how you would use the yOffset property.\nfor (int i=0; i\n \n \n \n\n#end\n\nBut this does not work and the handler is not engaged.\nIf I remove the #if condition the handler is engaged but the properties are not interpreted (for exemple the \"mimeType\" field is explicitly set to \"$apiObj.additionalProperties.get('mime_type')\" and not to the value of the additionnalProperty set on API.\nWhat is wrong ?\nHow could I use the additionnal properties added on API ?\nNext when the Handler is called, I did not find any way to read the response of the endpoint.\nI find code to change the response ou the response status code to write fault for exemple\nBut I did not find a way to read the binary response send by my endpoint to work on it.\nHelp will be appreciated!\nUPDATED\nFor the second part of the question, I create a method as follow:\nprivate void replaceBody(SOAPBody body) throws IOException {\n OMElement element = body.getFirstElement();\n if (element.getLocalName().equalsIgnoreCase(BINARY_LOCAL_NAME)) {\n OMNode subChild = element.getFirstOMChild();\n if (subChild instanceof OMText && ((OMText) subChild).isBinary()) {\n OMText textNode = ((OMText) subChild);\n DataHandler originalDataHandler = (DataHandler) textNode.getDataHandler();\n\n InputStream modifiedInputStream = modify(originalDataHandler.getInputStream());\n\n DataHandler newDataHandler = new DataHandler(new StreamingOnRequestDataSource(modifiedInputStream ));\n OMText newTextNode = body.getOMFactory().createOMText(newDataHandler, true);\n\n textNode.insertSiblingBefore(newTextNode);\n textNode.detach();\n }\n }\n }\n\nAnd I lookup for SOAPBody as follow :\norg.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext)\n .getAxis2MessageContext();\nRelayUtils.buildMessage(axis2MC, true);\naxis2MC.setProperty(RelayConstants.FORCE_RESPONSE_EARLY_BUILD, Boolean.TRUE);\nSOAPBody body = axis2MC.getEnvelope().getBody();\n\nI test the behaviour on small file but I think we need to do more stuff to handle big file ou chunked api.\nAny advice?\n\nA: Regarding velocity_template.xml & API Properties Configurations\nThe velocity_template.xml file is used to construct the API Synapse Artifacts to deploy them in the Gateway. As it is a common template file, you have to place your conditions and customizations in the correct sections of the template to reflect in the Synapse Artifact.\nIf you are trying to publish a REST API, then place your code block after this section in the velocity_template.xml\n#foreach($handler in $handlers)\n\n #if($handler.hasProperties())\n #set ($map = $handler.getProperties() )\n #foreach($property in $map.entrySet())\n \n #end\n #end\n\n#end\n\n\n\nThis makes sure, that your handler is engaged after all mandatory Handlers of the API Managers are engaged. If you want to engage your handler in the middle, then add a condition within #foreach block to append your handler. You can follow this doc for more detailed information.\nOnce the velocity_template.xml changes are made, re-publish the API by selecting the Gateway environments to deploy the updated Synapse Artifacts. If it is a distributed environment, make sure to update the velocity_template.xml of the Publisher node.\nAlso, check for any typos in your code block: I see an extra ) at the end of the #if condition.\n#if($apiObj.additionalProperties.get('encrypted') == \"true\"))\n...\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/72698024\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":525,"cells":{"text":{"kind":"string","value":"Q: Stanford Parser for Python: Output Format I am currently using the Python interface for the Stanford Parser. \n from nltk.parse.stanford import StanfordParser\n import os\n\n os.environ['STANFORD_PARSER'] ='/Users/au571533/Downloads/stanford-parser-full-2016-10-31'\n os.environ['STANFORD_MODELS'] = '/Users/au571533/Downloads/stanford-parser-full-2016-10-31'\n parser=StanfordParser(model_path=\"edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz\")\n\n new=list(parser.raw_parse(\"The young man who boarded his usual train that Sunday afternoon was twenty-four years old and fat. \"))\n print new\n\nThe output I get looks something like this: \n [Tree('ROOT', [Tree('S', [Tree('NP', [Tree('NP', [Tree('DT', ['The']), Tree('JJ', ['young']), Tree('NN', ['man'])]), Tree('SBAR', [Tree('WHNP', [Tree('WP', ['who'])]), Tree('S', [Tree('VP', [Tree('VBD', ['boarded']), Tree('NP', [Tree('PRP$', ['his']), Tree('JJ', ['usual']), Tree('NN', ['train'])]), Tree('NP', [Tree('DT', ['that']), Tree('NNP', ['Sunday'])])])])])]), Tree('NP', [Tree('NN', ['afternoon'])]), Tree('VP', [Tree('VBD', ['was']), Tree('NP', [Tree('NP', [Tree('JJ', ['twenty-four']), Tree('NNS', ['years'])]), Tree('ADJP', [Tree('JJ', ['old']), Tree('CC', ['and']), Tree('JJ', ['fat'])])])]), Tree('.', ['.'])])])]\n\nHowever, I only need the part of speech labels, therefore I'd like to have an output in a format that looks like word/tag. \nIn java it is possible to specify -outputFormat 'wordsAndTags' and it gives exactly what I want. Any hint on how to implement this in Python? \nHelp would be GREATLY appreciated. \nThanks!\nPS: Tried to use the Stanford POSTagger but it is by far less accurate on some of the words I'm interested in. \n\nA: If you look at the NLTK classes for the Stanford parser, you can see that the the raw_parse_sents() method doesn't send the -outputFormat wordsAndTags option that you want, and instead sends -outputFormat Penn.\nIf you derive your own class from StanfordParser, you could override this method and specify the wordsAndTags format.\nfrom nltk.parse.stanford import StanfordParser\n\nclass MyParser(StanfordParser):\n\n def raw_parse_sents(self, sentences, verbose=False):\n \"\"\"\n Use StanfordParser to parse multiple sentences. Takes multiple sentences as a\n list of strings.\n Each sentence will be automatically tokenized and tagged by the Stanford Parser.\n The output format is `wordsAndTags`.\n\n :param sentences: Input sentences to parse\n :type sentences: list(str)\n :rtype: iter(iter(Tree))\n \"\"\"\n cmd = [\n self._MAIN_CLASS,\n '-model', self.model_path,\n '-sentences', 'newline',\n '-outputFormat', 'wordsAndTags',\n ]\n return self._parse_trees_output(self._execute(cmd, '\\n'.join(sentences), verbose))\n\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/41522476\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"1\"\n}"}}},{"rowIdx":526,"cells":{"text":{"kind":"string","value":"Q: HTML in MySQL Database -- Best Practices I'm beginning to create a system whereby I (as the only user at present) will be loading a dynamically created PHP page which has a in it. I then will be grabbing the HTML of that
and saving it to be displayed to other users in a separate area of the website.\nMy Questions: What are some best practices to follow for this kind of thing? Saving the HTML as TEXT or LONGTEXT in MySQL? BLOB? Maybe even saving this data as a .txt file which uses PHP include() to include it into the file which displays it to users?\nI'm not really sure of the best approach for this kind of thing, and thus the barrage of questions. I'm also not very familiar with creating databases and therefore, I'm not knowledgeable as to their strengths/weaknesses. It seems like using a MySQL database for this is the way to go, but I'm not married to it.\nNote #1: The HTML must be preserved in it's entirety. So something like
Let's use blue for this.
can't end up coming out as
Let\\'s use blue for this.
. \nNote #2: The table I'm saving from gets randomly generated (including number of rows/columns) each time. So, I need all data within the table, including all 's and
's.\n\nA: Both MySQL and HTML files can work. Your choice should depend on how simple the data is, and how much you are storing.\nSome considerations:\n\n\n*\n\n*Speed. The HTML files and include() approach is going to be faster. The file system is the fastest, simplest form of data persistence.\n\n*Horizontal scalability. If you adopt the file system approach, you are more or less tied to the disk on that machine. With a separate database engine, you have the future option of running the database on separate cluster servers on the network.\n\n*Meta Data. Do you need to store things like time of creation, which user created the HTML, how many times it has been viewed by other users? If so, you probably only have one realistic choice - a \"proper\" database. This can be MySQL or perhaps one of the NoSQL solutions.\n\n*Data Consumption. Do you show the table in its entirety to other users? Or do you show selected parts of it? Possibly even different parts to different users? This impacts how you store data - the entire table as ONE entity, or each row as an entity, or each individual cell.\n\n*TEXT or LONGTEXT? Of course only applicable if you're going with SQL. The only way to answer this is to know how many bytes you are expecting to store per \"HTML fragment\". Note that your character encoding also impacts the number of bytes stored. Refer to: TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT maximum storage sizes\nAlso note that in MySQL, each TEXT/LONGTEXT may also result in an I/O to the disk.\nAs for the concern:\n\nThe HTML must be preserved in its entirety.\n\nAs long as you don't escape the HTML at any point, you should be fine. At first glance, this violates a security best practice, but if you think about it, \"not escaping HTML\" is exactly what you want to do. The practice of escaping HTML output only helps to eliminate HTML syntax being parsed as HTML tags (potential malicious), but in your case, you don't want HTML syntax eliminated at all - you intentionally want to be parsed into an actual HTML table cell. So do not escape anything and the example you gave should never occur.\nJust note: although you do not HTML-escape the output, you still should filter your inputs. In essence, this means: before writing to your DB, check that the user input is indeed HTML. To enhance your application's security, it may also be wise to define rules for what can be stored in those table cells - perhaps no