{ // 获取包含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 !== 'PDF TO Markdown' && linkText !== 'PDF TO Markdown' ) { link.textContent = 'PDF TO 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 !== 'Voice Cloning' ) { link.textContent = 'Voice Cloning'; link.href = 'https://vibevoice.info/'; 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, 'PDF TO 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\nextract of functions.js:\n$(function(){\n var mytree = [\n {\n text: \"Parent 1\",\n nodes: [\n {\n text: \"Child 1\",\n nodes: [\n {\n text: \"Grandchild 1\"\n },\n {\n text: \"Grandchild 2\"\n }\n ]\n },\n {\n text: \"Child 2\"\n }\n ]\n },\n {\n text: \"Parent 2\"\n }\n ];\n\n $('#tree').treeview({data: mytree});\n});\n\nA:\n\nCan you share sample link that you are following?\nIt seems like you are importing Twitter Bootstrap 4.3.1\n\nBut as I know, Offical Bootstrap still not provide TreeView on their document.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":34,"cells":{"text":{"kind":"string","value":"Q:\n\nXML Schema for analysis in C#\n\nIs it possible to use a XML Schema to check against the contents of a XML file?\nFor instance, in ASP.NET web.config, can I create a schema to check that ? This will ultimately be used in a C# app, the C# app should take in the XML document and the XML Schema and check if the XML Document violates any of the \"rules\" listed in the XML schema, i.e. \nIs it possible to do the checking without any boundary to the structure of the XML file? i.e. the attribute can be within any part of the XML document and the schema will still work.\n\nA:\n\nPossible: Yes, in XML Schema 1.1 using assertions.\nPractical or recommended: No.\nXML Schema is intended to be used to validate the \"structure of the XML file,\" as you anticipate in your question. You can skip much of that via xsd:any and then use assertions to express the sort of spot-checks that you describe via XPath expressions. However, it'd be more natural to just apply XPath expressions directly to your XML from within C#, or using Schematron, which is a standard for applying XPath expressions to do validation.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":35,"cells":{"text":{"kind":"string","value":"Q:\n\nCell should contain example input value for user to see\n\nI want to create automated cells in Excel which will show the type of data to be entered in that cells. I want to create cells which will show \"Enter Username here\", \" Enter DOB here\" same as that which shows in fb and Gmail login page. I don't want to save any credentials. \nI had created multiple dropdown lists and people are not understanding that there is a dropdown until they click on that cell. So I want to create automated cells which will show the type of data to be entered into it. It should disappear when I click on that cell and should appear if I erase the contents from that cell which I anyone had entered.\n\nA:\n\nLook into the change selection event:\nPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)\n if target.address = \"$A$1\" then\n target.value = \"\"\n else\n Dim value as string\n value = range(\"$A$1\").value\n if value=\"\" then 'Note: It'd be better to check here if the user input is correct!\n range(\"$A$1\").value = \"Enter DOB here\"\n end if\n end if\nEnd Sub\n\nEdit to user's comments:\nPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)\n if target.address = \"$A$1\" then\n if target.value = \"Enter DOB here\"\n target.value = \"\"\n end if\n else\n Dim value as string\n value = range(\"$A$1\").value\n if value=\"\" then 'Note: It'd be better to check here if the user input is correct!\n range(\"$A$1\").value = \"Enter DOB here\"\n end if\n end if\nEnd Sub\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":36,"cells":{"text":{"kind":"string","value":"Q:\n\nIs a low number of members in a class considered a code smell?\n\nI am currently making a simple to-do list program using the MVC pattern, and thus have a model class for the Notebook. However, something feels \"off\" as it has a very low number of members.\nThe Notebook is composed of categories, which are composed of To-do lists, which are composed of Items. \nWhat I cannot place is whether this is a case poor analysis (e.g. there are more members and responsibilities I am just missing them..) or perhaps a code smell that the class is not needed (in that case I'm not sure what to do as I could just have a list of categories in that controller, but then I don't have a notebook entity modelled which seems wrong as well).\nBelow is the very simple class I have:\nclass Notebook\n{\n private String title;\n private List categories;\n\n public Notebook(String title, List categories)\n {\n }\n\n public void setCategories(List categories)\n {\n }\n\n public List getCategories()\n {\n }\n}\n\nI often have this issue where it feels like I am making classes for the sake of it and they have a very number of members/responsibilities, so it would be nice to know whether I am stressing for no reason or not.\n\nA:\n\nNot necessarily, there is the concept in Domain Driven Design of what is called a \"Standard Type\". Which is really a basic primitive wrapped in an object class. The idea is that the primitive contains no information about what information it contains, it's just a string/int/whatever. So by having say an object that surrounds the primitive and ensures that it is always valid ensures that the object has a meaning far beyond just the primitive it contains e.g. a Name is not just a string, it's a Name.\nHere's an example taken from the comments of Velocity\npublic class Velocity\n{\n private readonly decimal _velocityInKPH;\n\n public static Velocity VelocityFromMPH(decimal mph)\n {\n return new Velocity(toKph(mph));\n }\n\n private Velocity(decimal kph)\n {\n this._velocityInKPH = kph;\n }\n\n public decimal Kph\n {\n get{ return this._velocityInKPH; }\n }\n\n public decimal Mph\n {\n get{ return toMph(this._velocityInKPH); }\n }\n\n // equals addition subtraction operators etc.\n\n private static decimal ToMph(decimal kph){ // conversion code }\n private static decimal ToKph(decimal mph){ // conversion code }\n}\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":37,"cells":{"text":{"kind":"string","value":"Q:\n\nIs it focus or depth of field?\n\nI was trying to shoot a group of people standing clumped but at different distances, quite close to me, think disorganized portrait. I have a Nikon d750, and was not able to get everyone into focus. If I brought the people closer to me in focus, then the background were blurred and vice versa. I pushed the aperture all the way to f18 or so and it didn't bring the whole scene into focus. Was I shooting from too close .... Or this makes me wonder is this about AF-S vs AF-A instead of aperture and the camera choosing one point to focus upon instead of the area? How would you compose a group shot like this to all be in focus? Thanks! \n\nA:\n\nIt sounds like depth of field. If (with an APS crop sensor, 30 mm lens, f/4), if you focus at say 6 feet you might have about 2 feet of DOF span, like from 5 feet to 7 feet (coarse approximations). If your subject is distributed at say 6 to 8 feet, this 5-7 DOF zone does not include the far ones. If you focus far, you miss the near ones. Which is your description. \nIf you focus on the near ones, or on the far ones, you have wasted half of your DOF range in empty space where there is no one. There are DOF calculators which compute these numbers.\nNormal procedure would be to focus more near the middle depth of the group (or slightly in front of the middle), to put the zone more centered on your group. So yes, you do chose your point of focus too.\nAnd of course, stopping down the f/stop, like from f/4 to f/8 or f/11, could greatly increase the span of DOF, so that the zone size is double or more.\nDOF is rather vague, and is NOT a critically precise number. If the calculator say DOF is 5 to 7 feet, then 7.02 feet is no different than 6.98 feet, both are at the limit of acceptability. These 5 to 7 feet numbers are considered the extremes of acceptability, and the actual focused distance will of course always be the sharpest point.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":38,"cells":{"text":{"kind":"string","value":"Q:\n\n¿Cuál es el valor primitivo de [] con base en ECMAScript 2016 (versión 7)?\n\nPara escribir una respuesta a ¿Cómo funciona el condicional if (!+[]+!+[] == 2) en JavaScript? me aventuré a utilizar https://www.ecma-international.org/ecma-262/7.0/index.html para las referencias.\nEn ToPrimitive se explica el procedimiento para convertir una valor en un valor primitivo pero no he logrado asimilarlo para el caso de [].\nSé que [] es un objeto y que es equivalente a new Array()\nTambién sé que un array es un objeto exótico, así que uno o más de sus métodos internos esenciales no tiene comportamiento predeterminado.\n\nNotas:\n\nComentario de Paul Vargas (chat)\nRevisar Array objects (sección de ECMAScript 2016)\n\nOtras pregunta relacionadas:\n\n¿Por qué _=$=+[],++_+''+$ es igual a 10?\n\nA:\n\nRespuesta corta\nEl valor primitivo de [] es '' (cadena de texto vacía).\nExplicación\nFinalmente me decidí a googlear y encontré esta respuesta a Why does ++[[]][+[]]+[+[]] return the string “10”?1, la cual es similar a mi respuesta a ¿Cómo funciona el condicional if (!+[]+!+[] == 2) en JavaScript? en cuando a que hace referencia a una especificación ECMASCript sólo que aquella no especifica a cual versión se refieren las citas, sin embargo, me ha sido útil para llenar el \"hueco\" que derivó en esta pregunta.\nMas abajo incluyo un par de extractos los cuales se pueden resumir como\n\ndocument.write([].join() === '') // Resultado true\n\nExtractos de la ECMAScript 2016 (versión 7)\n\n12.2.5Array Initializer\n\nNOTE\n An ArrayLiteral is an expression describing the initialization of an Array > object, using a list, of zero or more expressions each of which represents an array element, enclosed in square brackets. The elements need not be literals; they are evaluated each time the array initializer is evaluated.\n\nArray elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an AssignmentExpression (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute to the length of the Array.\n\n7.1.1 ToPrimitive ( input [ , PreferredType ] )\nThe abstract operation ToPrimitive takes an input argument and an\n optional argument PreferredType. The abstract operation ToPrimitive\n converts its input argument to a non-Object type. If an object is\n capable of converting to more than one primitive type, it may use the\n optional hint PreferredType to favour that type. Conversion occurs\n according to Table 9:\nTable 9: ToPrimitive Conversions\n\nInput Type Result\nUndefined Return input.\nNull Return input.\nBoolean Return input.\nNumber Return input.\nString Return input.\nSymbol Return input.\nObject Perform the steps following this table.\n\nWhen Type(input) is Object, the following steps are taken:\n\nIf PreferredType was not passed, let hint be \"default\". \nElse if PreferredType is hint String, let hint be \"string\". \nElse PreferredType is hint Number, let hint be \"number\". \nLet exoticToPrim be ? GetMethod(input, @@toPrimitive). \nIf exoticToPrim is not undefined, then \n \n \nLet result be ? Call(exoticToPrim, input, « hint »). \nIf Type(result) is not Object, return result. \nThrow a TypeError exception. \n\nIf hint is \"default\", let hint be \"number\". \nReturn ? OrdinaryToPrimitive(input, hint). \n\nWhen the abstract operation OrdinaryToPrimitive is called with\n arguments O and hint, the following steps are taken: \n\nAssert: Type(O) is Object. \nAssert: Type(hint) is String and its value is either \"string\" or \"number\". \nIf hint is \"string\", then \n \n \nLet methodNames be « \"toString\", \"valueOf\" ». \n\nElse, \n \n \nLet methodNames be « \"valueOf\", \"toString\" ». \n\nFor each name in methodNames in List order, do \n \n \nLet method be ? Get(O, name). \nIf IsCallable(method) is true, then \nLet result be ? Call(method, O). \nIf Type(result) is not Object, return result. \n\nThrow a TypeError exception. \n\nNOTE\nWhen ToPrimitive is called with no hint, then it generally behaves as\n if the hint were Number. However, objects may over-ride this behaviour\n by defining a @@toPrimitive method. Of the objects defined in this\n specification only Date objects (see 20.3.4.45) and Symbol objects\n (see 19.4.3.4) over-ride the default ToPrimitive behaviour. Date\n objects treat no hint as if the hint were String.\n\nEn el caso de un objeto de tipo Array, el método para determinar el valor primitivo es join() de acuerdo a lo siguiente:\n\n22.1.3.28 Array.prototype.toString ( )\nWhen the toString method is called, the following steps are taken:\n\nLet array be ? ToObject(this value).\nLet func be ? Get(array, \"join\").\nIf IsCallable(func) is false, let func be the intrinsic function %ObjProto_toString%.\nReturn ? Call(func, array).\n\nNOTE\nThe toString function is intentionally generic; it does not require\n that its this value be an Array object. Therefore it can be\n transferred to other kinds of objects for use as a method.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":39,"cells":{"text":{"kind":"string","value":"Q:\n\nModoboa 1.1.1 Deployment Errors\n\nI tried to install modoboa follow this steps: http://modoboa.readthedocs.org/en/latest/getting_started/install.html\nI installed modoboa with pip install modoboa:\nTraceback (most recent call last):\n File \"manage.py\", line 10, in \n execute_from_command_line(sys.argv)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 453, in execute_from_command_line\n utility.execute()\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 392, in execute\n self.fetch_command(subcommand).run_from_argv(self.argv)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 272, in fetch_command\n klass = load_command_class(app_name, subcommand)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 77, in load_command_class\n module = import_module('%s.management.commands.%s' % (app_name, name))\n File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module\n __import__(name)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py\", line 8, in \n from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py\", line 9, in \n from django.db import models\n File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 40, in \n backend = load_backend(connection.settings_dict['ENGINE'])\n File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 34, in __getattr__\n return getattr(connections[DEFAULT_DB_ALIAS], item)\n File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 93, in __getitem__\n backend = load_backend(db['ENGINE'])\n File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 27, in load_backend\n return import_module('.base', backend_name)\n File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module\n __import__(name)\n File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py\", line 17, in \n raise ImproperlyConfigured(\"Error loading MySQLdb module: %s\" % e)\ndjango.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb\n\npython manage.py syncdb --noinput failed, check your configuration\nTraceback (most recent call last):\n File \"manage.py\", line 10, in \n execute_from_command_line(sys.argv)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 453, in execute_from_command_line\n utility.execute()\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 392, in execute\n self.fetch_command(subcommand).run_from_argv(self.argv)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 272, in fetch_command\n klass = load_command_class(app_name, subcommand)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 77, in load_command_class\n module = import_module('%s.management.commands.%s' % (app_name, name))\n File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module\n __import__(name)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py\", line 8, in \n from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py\", line 9, in \n from django.db import models\n File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 40, in \n backend = load_backend(connection.settings_dict['ENGINE'])\n File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 34, in __getattr__\n return getattr(connections[DEFAULT_DB_ALIAS], item)\n File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 93, in __getitem__\n backend = load_backend(db['ENGINE'])\n File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 27, in load_backend\n return import_module('.base', backend_name)\n File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module\n __import__(name)\n File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py\", line 17, in \n raise ImproperlyConfigured(\"Error loading MySQLdb module: %s\" % e)\ndjango.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb\n\npython manage.py syncdb failed, check your configuration\nUnknown command: 'migrate'\nType 'manage.py help' for usage.\n\npython manage.py migrate --fake failed, check your configuration\nTraceback (most recent call last):\n File \"manage.py\", line 10, in \n execute_from_command_line(sys.argv)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 453, in execute_from_command_line\n utility.execute()\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 392, in execute\n self.fetch_command(subcommand).run_from_argv(self.argv)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 272, in fetch_command\n klass = load_command_class(app_name, subcommand)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 77, in load_command_class\n module = import_module('%s.management.commands.%s' % (app_name, name))\n File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module\n __import__(name)\n File \"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py\", line 11, in \n from django.core import serializers\n File \"/usr/local/lib/python2.7/dist-packages/django/core/serializers/__init__.py\", line 22, in \n from django.core.serializers.base import SerializerDoesNotExist\n File \"/usr/local/lib/python2.7/dist-packages/django/core/serializers/base.py\", line 5, in \n from django.db import models\n File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 40, in \n backend = load_backend(connection.settings_dict['ENGINE'])\n File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 34, in __getattr__\n return getattr(connections[DEFAULT_DB_ALIAS], item)\n File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 93, in __getitem__\n backend = load_backend(db['ENGINE'])\n File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 27, in load_backend\n return import_module('.base', backend_name)\n File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module\n __import__(name)\n File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py\", line 17, in \n raise ImproperlyConfigured(\"Error loading MySQLdb module: %s\" % e)\ndjango.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb\n\npython manage.py loaddata initial_users.json failed, check your configuration\nUnknown command: 'collectstatic'\nType 'manage.py help' for usage.\n\npython manage.py collectstatic --noinput failed, check your configuration\n\nI tried to install pip install MySQL-python but I received this error:\nDownloading/unpacking MySQL-python\n Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded\n Running setup.py egg_info for package MySQL-python\n sh: mysql_config: orden no encontrada\n Traceback (most recent call last):\n File \"\", line 16, in \n File \"/tmp/pip_build_root/MySQL-python/setup.py\", line 17, in \n metadata, options = get_config()\n File \"setup_posix.py\", line 43, in get_config\n libs = mysql_config(\"libs_r\")\n File \"setup_posix.py\", line 25, in mysql_config\n raise EnvironmentError(\"%s not found\" % (mysql_config.path,))\n EnvironmentError: mysql_config not found\n Complete output from command python setup.py egg_info:\n sh: mysql_config: orden no encontrada\n\nTraceback (most recent call last):\n\n File \"\", line 16, in \n\n File \"/tmp/pip_build_root/MySQL-python/setup.py\", line 17, in \n\n metadata, options = get_config()\n\n File \"setup_posix.py\", line 43, in get_config\n\n libs = mysql_config(\"libs_r\")\n\n File \"setup_posix.py\", line 25, in mysql_config\n\n raise EnvironmentError(\"%s not found\" % (mysql_config.path,))\n\nEnvironmentError: mysql_config not found\n\n----------------------------------------\nCleaning up...\nCommand python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/MySQL-python\nStoring complete log in /root/.pip/pip.log\n\nSeems that error is caused by MySQL module but I don't know how to resolve it.\n\nA:\n\nYou should install the python mysqldb package provided with your distribution.\nOn a debian/ubuntu one:\n$ apt-get install python-mysqldb\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":40,"cells":{"text":{"kind":"string","value":"Q:\n\nDo we want an xkcd tag?\n\nxkcd is referred to often on PPCG, with at least 47 questions which are based on concepts or directly related to the xkcd webcomic.\nTherefore, is it worthwhile introducing an xkcd tag to group all of these challenges together?\n\nA:\n\nNo\nTags are meant to classify questions according to some distinctive quality that they share. Simply referencing an xkcd comic is not a distinctive quality that would create a meaningful classification.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":41,"cells":{"text":{"kind":"string","value":"Q:\n\nBinding value to select in angular js across 2 controllers\n\nWorking with angularJS I am trying to figure out a way to bind the value of a select element under the scope of controller A to use it as an argument for an ng-click call [getQuizByCampID() Function] under the scope of controller B.\nMy first idea was to use jquery, but I have read in the link below that using jquery is not recommended when starting with angularJS. \n\"Thinking in AngularJS\" if I have a jQuery background?\nI also read in the link below that this is performed using ng-model, the only problem is that that the example provided is all under the same controller. \n and Binding value to input in Angular JS\nWhat is the angularJS way to get the value of the select element under controller A into the function call in the select under controller B?\nPrice.html view\n
**Controller A** \n \n
\n\n
**Controller B**\n \n
\n\nApp.js\nvar app= angular.module('myApp', ['ngRoute']);\napp.config(['$routeProvider', function($routeProvider) {\n $routeProvider.when('/price', {templateUrl: 'partials/price.html', controller: 'priceCtrl'});\n}]);\n\n$routeProvider.when('/price', {templateUrl: 'partials/price.html', controller: 'priceCtrl'});\n\nQuiz Controller\n'use strict';\n\napp.controller('quizCtrl', ['$scope','$http','loginService', function($scope,$http,loginService){\n$scope.txt='Quiz';\n$scope.logout=function(){\n loginService.logout();\n}\ngetQuiz(); // Load all available campaigns \nfunction getQuiz(campID){ \n $http.post(\"js/ajax/getQuiz.php\").success(function(data){\n $scope.quizzes = data;\n //console.log(data);\n });\n};\n $scope.getQuizByCampID = function (campid) {\n alert(campid);\n$http.post(\"js/ajax/getQuiz.php?campid=\"+campid).success(function(data){\n $scope.quizzesById = data;\n $scope.QuizInput = \"\";\n });\n };\n\n $scope.addQuiz = function (quizid, quizname, campid) { \n console.log(quizid + quizname + campid); \n $http.post(\"js/ajax/addQuiz.php?quizid=\"+quizid+\"&quizname=\"+quizname+\"&campid=\"+campid).success(function(data){\n\n getQuiz();\n $scope.QuizInput = \"\";\n});\n };\n\n}])\n\nA:\n\nYou should store the value in a service.\nexample: \napp.factory('SharedService', function() {\n this.inputValue = null;\n\n this.setInputValue = function(value) {\n this.inputValue = value;\n }\n\n this.getInputValue = function() {\n return this.inputValue;\n }\n\n return this;\n});\n\nExample on Plunkr\nRead: AngularJS Docs on services\nor check this Egghead.io video\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":42,"cells":{"text":{"kind":"string","value":"Q:\n\nPass values to IN operator in a Worklight SQL adapter\n\nI have started to work with SQL adapters in Worklight, but I do not understand how can I pass values to an IN condition when invoking my adapter procedure.\n\nA:\n\nYou will need to edit your question with your adapter's XML as well as implementation JavaScript...\nAlso, make sure to read the SQL adapters training module.\n\nWhat you need to do is have your function get the values:\nfunction myFunction (value1, value2) { ... }\n\nAnd your SQL query will use them, like so (just as an example how to pass variables to any SQL query, doesn't matter if it contains an IN condition or not):\nSELECT * FROM person where name='$[value1]' or id=$[value2];\n\nNote the quotation marks for value1 (for text) and lack of for value2 (for numbers).\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":43,"cells":{"text":{"kind":"string","value":"Q:\n\nHow to change XML from dataset into HTML UL\n\nI'm working on a C# webforms application and have a datalayer which gathers information about the menu a customer can see, based on their customer number and order type.\nI was using the ASP.NET menu control for this until the qa department asked to change the menu to expand on click instead of hover. At that point, I decided to try and do the menu with a simpler css/html/jquery approach but I've hit a jam.\nI have the following method in my datalayer that gets information for the menu and returns it as XML. What I'm stuck on is how to take the XML that was being gathered, when I was using the menu control and hopefully reformat it into a UL for using in the html/css approach I'd like to do. \npublic static string BuildMenu(string cprcstnm, string docType)\n {\n DataSet ds = new DataSet();\n string connStr = ConfigurationManager.ConnectionStrings[\"DynamicsConnectionString\"].ConnectionString;\n using (SqlConnection conn = new SqlConnection(connStr))\n {\n string sql = \"usp_SelectItemMenuByCustomer\";\n SqlDataAdapter da = new SqlDataAdapter(sql, conn);\n da.SelectCommand.CommandType = CommandType.StoredProcedure;\n da.SelectCommand.Parameters.Add(\"@CPRCSTNM\", SqlDbType.VarChar).Value = cprcstnm;\n da.SelectCommand.Parameters.Add(\"@DOCID\", SqlDbType.VarChar).Value = docType;\n da.Fill(ds);\n da.Dispose();\n }\n ds.DataSetName = \"Menus\";\n ds.Tables[0].TableName = \"Menu\";\n DataRelation relation = new DataRelation(\"ParentChild\",\n ds.Tables[\"Menu\"].Columns[\"MenuID\"],\n ds.Tables[\"Menu\"].Columns[\"ParentID\"],\n false);\n\n relation.Nested = true;\n ds.Relations.Add(relation);\n\n return ds.GetXml();\n }\n\nA sample of XMl that is output is as follows: \n\n- \n 23 \n 0 \n ACC \n ACC \n 0 \n- \n 34 \n 1 \n BASE \n BASE \n 23 \n- \n 516 \n 2 \n HYP \n HYP \n 34 \n\nI would need to convert this to something such as :\n