{ // 获取包含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\nA:\n\nTake a look at how some of the popular PHP frameworks use templating. Examples include cakePHP, Zend Framework, and Code Igniter. Even if you are not going to base your site on these frameworks, the template design pattern is a good way to keep php code away from your web designers, so they can focus on layout and not functionality.\n\nA:\n\nIt sounds to me like you need to begin implementing what is known as \"separation of concerns\" across your application generally. The examples folks give about templating, in response to your specific complaint about page editors breaking your code, are important, but represent just one example of this tactic. As your program gets larger and more complex it becomes harder to modify and debug--even if your designer is not breaking your code.\nProbably the most common separation is a three way split between data, logic and presentation as described in the design pattern Model-View-Controller (MVC). You do not need a full blown MVC framework in place to implement the same basic principles. The idea is simply to encapsulate code that deals with your data (model) in one place, the code that presents this data to the user (view) in another. You tie that code together with code that is only concerned with presenting the right data to the right user at a the right time (controller).\nFrom your description, it sounds like you have right now is a Transaction Script pattern, where you have a php file \"dothis.php\" that is loaded in the browser, and all the function definitions and HTML for the display are together. You already have functions, so you are already beginning to encapsulate pieces of logic.\nThe way I would approach this would be, in keeping with the other answers here about templating, is to remove all of the HTML into another file only referencing simple PHP variables and maybe some loops (but as little conditional switching as you can). That will make the template easier to read and harder to break. When your page editor wants to modify the layout, give them THAT file.\nYou then separate all of your data access functions to another file, ideally creating a class (or several classes, depending on how complex your data is and how frequently you need to reuse it). \nAt this point your \"dothis.php\" has been stripped down to maybe some configuration code (which you can separate out to an include, and some authentication code (which you can separate out to its own class), and is only calling the data access functions, and calling the included template file. Your controller itself is therefore greatly simplified and easier to manage.\n\nA:\n\nI would highly recommend reading the book PHP In Action. It takes you through abstracting your database connections, templating systems and all the other basics of a web application. If every PHP developer read this book then the language would have a much better reputation.\nIt also has chapters on refactoring, unit testing and the MVC control pattern. \n\nA:\n\nDoes the outside person need to edit the logic, or just the display (HTML)?\nIf it's the latter case, check out the Smarty template engine.\n\nA:\n\nI think I'd like to stay away from an unweildy framework. Just some approach I can use that generally makes the pages more readable with cleaner code. \nStack Overflow wants me to decide which answer is best, when best is a subjective opinion. Who is to say what the 'best' practice is. \n\nA:\n\nIf you decide to continue using functions, you can get some inspiration from WordPress. You can probably reduce the \"program\" to a minimum by making templates more granular.\nAlso, good tools (i.e. HTML editors) can help designers ignore your PHP and work on the design without breaking the code. (But I have no suggestions, sorry.)\nThe other way to some things is to create own template system instead of SMARTY, but it would probably take too long to create a working system to satisfy your needs that would go past just a replacing something like %%VARIABLE%% with a text.\nOur company uses SMARTY and even with a lot of code in templates, designers know how to work with it. For simple CMS sites we use ExpressionEngine, which uses HTML-like tags for inserting logic into templates.\n\nA:\n\nThere's a lot that can be said on this topic but a very basic starting point would be to move as much code as possible out into separate files and then use include statements.\n\nA:\n\nI usually use includes, as they can be very useful for organising and grouping functions together. Also, comment your code. There's nothing worse than for someone else to see your work and not know why you've done this. Naming variables and functions sensibly can go a long way too - for example:\n$userName = \"John Doe\";\n$dateOfBirth = \"04/02/1982\";\n\nfunction calculateUserAgeFromBirth($userName, $dateOfBirth)\n\nNaming variables like this also helps minimise comments about what your code actually does.\n\n"},"title":{"kind":"string","value":"PHP best practices?"},"question":{"kind":"string","value":"What is a good way to remove the code from display pages when developing with PHP. Often the pages I work on need to be editted by an outside person. This person is often confused by lots of blocks of PHP, and also likes to break my code.\nI've tried moving blocks of code out into functions, so now there are functions spread out all throughout the HTML now. As some pages become more complex it becomes a program again, and processing POSTs are questionable.\nWhat can I be doing better in my PHP development?\n"},"answers":{"kind":"list like","value":["You don't need a \"system\" to do templating.\nYou can do it on your own by keeping presentation & logic separate.\nThis way the designer can screw up the display, but not the logic behind it.\nHere's a simple example:\n\n\nNow here's the people.php file (which you give your designer):\n \n\n\n Person:
\n \n\n\n\n","Take a look at how some of the popular PHP frameworks use templating. Examples include cakePHP, Zend Framework, and Code Igniter. Even if you are not going to base your site on these frameworks, the template design pattern is a good way to keep php code away from your web designers, so they can focus on layout and not functionality.\n","It sounds to me like you need to begin implementing what is known as \"separation of concerns\" across your application generally. The examples folks give about templating, in response to your specific complaint about page editors breaking your code, are important, but represent just one example of this tactic. As your program gets larger and more complex it becomes harder to modify and debug--even if your designer is not breaking your code.\nProbably the most common separation is a three way split between data, logic and presentation as described in the design pattern Model-View-Controller (MVC). You do not need a full blown MVC framework in place to implement the same basic principles. The idea is simply to encapsulate code that deals with your data (model) in one place, the code that presents this data to the user (view) in another. You tie that code together with code that is only concerned with presenting the right data to the right user at a the right time (controller).\nFrom your description, it sounds like you have right now is a Transaction Script pattern, where you have a php file \"dothis.php\" that is loaded in the browser, and all the function definitions and HTML for the display are together. You already have functions, so you are already beginning to encapsulate pieces of logic.\nThe way I would approach this would be, in keeping with the other answers here about templating, is to remove all of the HTML into another file only referencing simple PHP variables and maybe some loops (but as little conditional switching as you can). That will make the template easier to read and harder to break. When your page editor wants to modify the layout, give them THAT file.\nYou then separate all of your data access functions to another file, ideally creating a class (or several classes, depending on how complex your data is and how frequently you need to reuse it). \nAt this point your \"dothis.php\" has been stripped down to maybe some configuration code (which you can separate out to an include, and some authentication code (which you can separate out to its own class), and is only calling the data access functions, and calling the included template file. Your controller itself is therefore greatly simplified and easier to manage.\n","I would highly recommend reading the book PHP In Action. It takes you through abstracting your database connections, templating systems and all the other basics of a web application. If every PHP developer read this book then the language would have a much better reputation.\nIt also has chapters on refactoring, unit testing and the MVC control pattern. \n","Does the outside person need to edit the logic, or just the display (HTML)?\nIf it's the latter case, check out the Smarty template engine.\n","I think I'd like to stay away from an unweildy framework. Just some approach I can use that generally makes the pages more readable with cleaner code. \nStack Overflow wants me to decide which answer is best, when best is a subjective opinion. Who is to say what the 'best' practice is. \n","If you decide to continue using functions, you can get some inspiration from WordPress. You can probably reduce the \"program\" to a minimum by making templates more granular.\nAlso, good tools (i.e. HTML editors) can help designers ignore your PHP and work on the design without breaking the code. (But I have no suggestions, sorry.)\nThe other way to some things is to create own template system instead of SMARTY, but it would probably take too long to create a working system to satisfy your needs that would go past just a replacing something like %%VARIABLE%% with a text.\nOur company uses SMARTY and even with a lot of code in templates, designers know how to work with it. For simple CMS sites we use ExpressionEngine, which uses HTML-like tags for inserting logic into templates.\n","There's a lot that can be said on this topic but a very basic starting point would be to move as much code as possible out into separate files and then use include statements.\n","I usually use includes, as they can be very useful for organising and grouping functions together. Also, comment your code. There's nothing worse than for someone else to see your work and not know why you've done this. Naming variables and functions sensibly can go a long way too - for example:\n$userName = \"John Doe\";\n$dateOfBirth = \"04/02/1982\";\n\nfunction calculateUserAgeFromBirth($userName, $dateOfBirth)\n\nNaming variables like this also helps minimise comments about what your code actually does.\n"],"string":"[\n \"You don't need a \\\"system\\\" to do templating.\\nYou can do it on your own by keeping presentation & logic separate.\\nThis way the designer can screw up the display, but not the logic behind it.\\nHere's a simple example:\\n\\n\\nNow here's the people.php file (which you give your designer):\\n \\n\\n\\n Person:
\\n \\n\\n\\n\\n\",\n \"Take a look at how some of the popular PHP frameworks use templating. Examples include cakePHP, Zend Framework, and Code Igniter. Even if you are not going to base your site on these frameworks, the template design pattern is a good way to keep php code away from your web designers, so they can focus on layout and not functionality.\\n\",\n \"It sounds to me like you need to begin implementing what is known as \\\"separation of concerns\\\" across your application generally. The examples folks give about templating, in response to your specific complaint about page editors breaking your code, are important, but represent just one example of this tactic. As your program gets larger and more complex it becomes harder to modify and debug--even if your designer is not breaking your code.\\nProbably the most common separation is a three way split between data, logic and presentation as described in the design pattern Model-View-Controller (MVC). You do not need a full blown MVC framework in place to implement the same basic principles. The idea is simply to encapsulate code that deals with your data (model) in one place, the code that presents this data to the user (view) in another. You tie that code together with code that is only concerned with presenting the right data to the right user at a the right time (controller).\\nFrom your description, it sounds like you have right now is a Transaction Script pattern, where you have a php file \\\"dothis.php\\\" that is loaded in the browser, and all the function definitions and HTML for the display are together. You already have functions, so you are already beginning to encapsulate pieces of logic.\\nThe way I would approach this would be, in keeping with the other answers here about templating, is to remove all of the HTML into another file only referencing simple PHP variables and maybe some loops (but as little conditional switching as you can). That will make the template easier to read and harder to break. When your page editor wants to modify the layout, give them THAT file.\\nYou then separate all of your data access functions to another file, ideally creating a class (or several classes, depending on how complex your data is and how frequently you need to reuse it). \\nAt this point your \\\"dothis.php\\\" has been stripped down to maybe some configuration code (which you can separate out to an include, and some authentication code (which you can separate out to its own class), and is only calling the data access functions, and calling the included template file. Your controller itself is therefore greatly simplified and easier to manage.\\n\",\n \"I would highly recommend reading the book PHP In Action. It takes you through abstracting your database connections, templating systems and all the other basics of a web application. If every PHP developer read this book then the language would have a much better reputation.\\nIt also has chapters on refactoring, unit testing and the MVC control pattern. \\n\",\n \"Does the outside person need to edit the logic, or just the display (HTML)?\\nIf it's the latter case, check out the Smarty template engine.\\n\",\n \"I think I'd like to stay away from an unweildy framework. Just some approach I can use that generally makes the pages more readable with cleaner code. \\nStack Overflow wants me to decide which answer is best, when best is a subjective opinion. Who is to say what the 'best' practice is. \\n\",\n \"If you decide to continue using functions, you can get some inspiration from WordPress. You can probably reduce the \\\"program\\\" to a minimum by making templates more granular.\\nAlso, good tools (i.e. HTML editors) can help designers ignore your PHP and work on the design without breaking the code. (But I have no suggestions, sorry.)\\nThe other way to some things is to create own template system instead of SMARTY, but it would probably take too long to create a working system to satisfy your needs that would go past just a replacing something like %%VARIABLE%% with a text.\\nOur company uses SMARTY and even with a lot of code in templates, designers know how to work with it. For simple CMS sites we use ExpressionEngine, which uses HTML-like tags for inserting logic into templates.\\n\",\n \"There's a lot that can be said on this topic but a very basic starting point would be to move as much code as possible out into separate files and then use include statements.\\n\",\n \"I usually use includes, as they can be very useful for organising and grouping functions together. Also, comment your code. There's nothing worse than for someone else to see your work and not know why you've done this. Naming variables and functions sensibly can go a long way too - for example:\\n$userName = \\\"John Doe\\\";\\n$dateOfBirth = \\\"04/02/1982\\\";\\n\\nfunction calculateUserAgeFromBirth($userName, $dateOfBirth)\\n\\nNaming variables like this also helps minimise comments about what your code actually does.\\n\"\n]"},"answers_scores":{"kind":"list like","value":[19,6,5,4,2,1,1,0,0],"string":"[\n 19,\n 6,\n 5,\n 4,\n 2,\n 1,\n 1,\n 0,\n 0\n]"},"non_answers":{"kind":"list like","value":[],"string":"[]"},"non_answers_scores":{"kind":"list like","value":[],"string":"[]"},"tags":{"kind":"list like","value":["php"],"string":"[\n \"php\"\n]"},"name":{"kind":"string","value":"stackoverflow_0000036417_php.txt"}}},{"rowIdx":1327,"cells":{"content":{"kind":"string","value":"Q:\n\nTargeting multiple versions of .net framework\n\nSuppose I have some code that would, in theory, compile against any version of the .net framework. Think \"Hello World\", if you like. \nIf I actually compile the code, though, I'll get an executable that runs against one particular version. \nIs there any way to arrange things so that the compiled exe will just run against whatever version it finds? I strongly suspect that the answer is no, but I'd be happy to be proven wrong...\n\nEdit: Well, I'll go to the foot of our stairs. I had no idea that later frameworks would happily run exe's compiled under earlier versions. Thanks for all the responses!\n\nA:\n\nIm not sure if this is correct, but i'd try to compile it for the lowest version, the higher versions should be able to run the lower versions exe's.\n\nA:\n\nRead ScuttGu's post about VS 2008 Multi-Targeting Support\n\nOne of the big changes we are making\n starting with the VS 2008 release is\n to support what we call\n \"Multi-Targeting\" - which means that\n Visual Studio will now support\n targeting multiple versions of the\n .NET Framework, and developers will be\n able to start taking advantage of the\n new features Visual Studio provides\n without having to always upgrade their\n existing projects and deployed\n applications to use a new version of\n the .NET Framework library.\nNow when you open an existing project\n or create a new one with VS 2008, you\n can pick which version of the .NET\n Framework to work with - and the IDE\n will update its compilers and\n feature-set to match this. Among\n other things, this means that\n features, controls, projects,\n item-templates, and assembly\n references that don't work with that\n version of the framework will be\n hidden, and when you build your\n application you'll be able to take the\n compiled output and copy it onto a\n machine that only has an older version\n of the .NET Framework installed, and\n you'll know that the application will\n work.\n\nThat way you can use VS2008 to develop .NET 2.0 projects that will work on both .NET 2.0, 3.0 and 3.5\n\nA:\n\nAlong side multi targeting, the frameworks are backwards compatible, so something compiled to 1.0 will run on 1.1 and 2. Somthing compiled on 1.1 will run on 2 ... etc.\n\nA:\n\nI know @John Boker is correct when it comes to .Net class libraries. You can compile a class library against .Net 1.1 and then use it in a .Net 2.0 or higher project.\nI suspect the same is also true for executables.\n\nA:\n\nwith 2005 & 2008, yes (on CLR 2.0)\nWith 2003, no.. because it compiles down to CLR 1.1\nYou could theorectically write some code using #if (DOTNET35) and such so that you don't use features outside the compilers knowledge and then run the desired compiler on the app... I question the usefulness of this though.\n\nA:\n\nWell, AFAIK, all .NET versions (except version 1.x) compile to the same bytecode. In case of C#, all new features are simply syntactic sugar, which get transformed into C# 2.0 constructs when compiling.\nThe key point where things could go wrong is when you use C# 3.0 or 3.5 specific DLLs. They don't work well with the .NET 2.0 framework, so you can't use those.\nI can't really think of a workaround for this, sorry :(\n\nA:\n\nOn the subject of which .NET framework the user has installed, there is also a new option with the Client Profile that’s available with .NET 3.5 SP1. This basically allows you to ship a small (277k) bootstrap program which downloads and installs the required files (A subset od the full .NET framework).\nFor more information, and general tips on creating a small .NET installation, see this great blog entry by Scott Hanselman.\n\n"},"title":{"kind":"string","value":"Targeting multiple versions of .net framework"},"question":{"kind":"string","value":"Suppose I have some code that would, in theory, compile against any version of the .net framework. Think \"Hello World\", if you like. \nIf I actually compile the code, though, I'll get an executable that runs against one particular version. \nIs there any way to arrange things so that the compiled exe will just run against whatever version it finds? I strongly suspect that the answer is no, but I'd be happy to be proven wrong...\n\nEdit: Well, I'll go to the foot of our stairs. I had no idea that later frameworks would happily run exe's compiled under earlier versions. Thanks for all the responses!\n"},"answers":{"kind":"list like","value":["Im not sure if this is correct, but i'd try to compile it for the lowest version, the higher versions should be able to run the lower versions exe's.\n","Read ScuttGu's post about VS 2008 Multi-Targeting Support\n\nOne of the big changes we are making\n starting with the VS 2008 release is\n to support what we call\n \"Multi-Targeting\" - which means that\n Visual Studio will now support\n targeting multiple versions of the\n .NET Framework, and developers will be\n able to start taking advantage of the\n new features Visual Studio provides\n without having to always upgrade their\n existing projects and deployed\n applications to use a new version of\n the .NET Framework library.\nNow when you open an existing project\n or create a new one with VS 2008, you\n can pick which version of the .NET\n Framework to work with - and the IDE\n will update its compilers and\n feature-set to match this. Among\n other things, this means that\n features, controls, projects,\n item-templates, and assembly\n references that don't work with that\n version of the framework will be\n hidden, and when you build your\n application you'll be able to take the\n compiled output and copy it onto a\n machine that only has an older version\n of the .NET Framework installed, and\n you'll know that the application will\n work.\n\nThat way you can use VS2008 to develop .NET 2.0 projects that will work on both .NET 2.0, 3.0 and 3.5\n","Along side multi targeting, the frameworks are backwards compatible, so something compiled to 1.0 will run on 1.1 and 2. Somthing compiled on 1.1 will run on 2 ... etc.\n","I know @John Boker is correct when it comes to .Net class libraries. You can compile a class library against .Net 1.1 and then use it in a .Net 2.0 or higher project.\nI suspect the same is also true for executables.\n","with 2005 & 2008, yes (on CLR 2.0)\nWith 2003, no.. because it compiles down to CLR 1.1\nYou could theorectically write some code using #if (DOTNET35) and such so that you don't use features outside the compilers knowledge and then run the desired compiler on the app... I question the usefulness of this though.\n","Well, AFAIK, all .NET versions (except version 1.x) compile to the same bytecode. In case of C#, all new features are simply syntactic sugar, which get transformed into C# 2.0 constructs when compiling.\nThe key point where things could go wrong is when you use C# 3.0 or 3.5 specific DLLs. They don't work well with the .NET 2.0 framework, so you can't use those.\nI can't really think of a workaround for this, sorry :(\n","On the subject of which .NET framework the user has installed, there is also a new option with the Client Profile that’s available with .NET 3.5 SP1. This basically allows you to ship a small (277k) bootstrap program which downloads and installs the required files (A subset od the full .NET framework).\nFor more information, and general tips on creating a small .NET installation, see this great blog entry by Scott Hanselman.\n"],"string":"[\n \"Im not sure if this is correct, but i'd try to compile it for the lowest version, the higher versions should be able to run the lower versions exe's.\\n\",\n \"Read ScuttGu's post about VS 2008 Multi-Targeting Support\\n\\nOne of the big changes we are making\\n starting with the VS 2008 release is\\n to support what we call\\n \\\"Multi-Targeting\\\" - which means that\\n Visual Studio will now support\\n targeting multiple versions of the\\n .NET Framework, and developers will be\\n able to start taking advantage of the\\n new features Visual Studio provides\\n without having to always upgrade their\\n existing projects and deployed\\n applications to use a new version of\\n the .NET Framework library.\\nNow when you open an existing project\\n or create a new one with VS 2008, you\\n can pick which version of the .NET\\n Framework to work with - and the IDE\\n will update its compilers and\\n feature-set to match this. Among\\n other things, this means that\\n features, controls, projects,\\n item-templates, and assembly\\n references that don't work with that\\n version of the framework will be\\n hidden, and when you build your\\n application you'll be able to take the\\n compiled output and copy it onto a\\n machine that only has an older version\\n of the .NET Framework installed, and\\n you'll know that the application will\\n work.\\n\\nThat way you can use VS2008 to develop .NET 2.0 projects that will work on both .NET 2.0, 3.0 and 3.5\\n\",\n \"Along side multi targeting, the frameworks are backwards compatible, so something compiled to 1.0 will run on 1.1 and 2. Somthing compiled on 1.1 will run on 2 ... etc.\\n\",\n \"I know @John Boker is correct when it comes to .Net class libraries. You can compile a class library against .Net 1.1 and then use it in a .Net 2.0 or higher project.\\nI suspect the same is also true for executables.\\n\",\n \"with 2005 & 2008, yes (on CLR 2.0)\\nWith 2003, no.. because it compiles down to CLR 1.1\\nYou could theorectically write some code using #if (DOTNET35) and such so that you don't use features outside the compilers knowledge and then run the desired compiler on the app... I question the usefulness of this though.\\n\",\n \"Well, AFAIK, all .NET versions (except version 1.x) compile to the same bytecode. In case of C#, all new features are simply syntactic sugar, which get transformed into C# 2.0 constructs when compiling.\\nThe key point where things could go wrong is when you use C# 3.0 or 3.5 specific DLLs. They don't work well with the .NET 2.0 framework, so you can't use those.\\nI can't really think of a workaround for this, sorry :(\\n\",\n \"On the subject of which .NET framework the user has installed, there is also a new option with the Client Profile that’s available with .NET 3.5 SP1. This basically allows you to ship a small (277k) bootstrap program which downloads and installs the required files (A subset od the full .NET framework).\\nFor more information, and general tips on creating a small .NET installation, see this great blog entry by Scott Hanselman.\\n\"\n]"},"answers_scores":{"kind":"list like","value":[6,3,0,0,0,0,0],"string":"[\n 6,\n 3,\n 0,\n 0,\n 0,\n 0,\n 0\n]"},"non_answers":{"kind":"list like","value":[],"string":"[]"},"non_answers_scores":{"kind":"list like","value":[],"string":"[]"},"tags":{"kind":"list like","value":[".net","compilation","version"],"string":"[\n \".net\",\n \"compilation\",\n \"version\"\n]"},"name":{"kind":"string","value":"stackoverflow_0000043939_.net_compilation_version.txt"}}},{"rowIdx":1328,"cells":{"content":{"kind":"string","value":"Q:\n\nBigger than a char but smaller than a blob\n\nChar's are great because they are fixed size and thus make for a faster table. They are however limited to 255 characters. I want to hold 500 characters but a blob is variable length and that's not what I want.\nIs there some way to have a fixed length field of 500 characters in MySQL or am I going to have to use 2 char fields?\n\nA:\n\nI would suggest using a varchar(500). Even though varchar isn't a fixed length, the database should reserve the correct amount of space. You shouldn't notice any performance difference using varchar(500) over 2xchar(255).\nYou're also probably going to cause extra overhead by joining two char fields together.\n\nA:\n\nI would suggest using a varchar(500)\n\n... if you have MySQL 5.0.3 or higher. In previous versions, VARCHAR was restricted to 255 characters.\nAlso, CHAR and VARCHAR do not work the same regarding trailing spaces. Be sure to read 10.4.1. The CHAR and VARCHAR Types (this is for MySQL 5.0).\n\nA:\n\nYou're worrying too much about internal implementation details. Don't pre-optimize. \nGo with VARCHAR(500)\n\n"},"title":{"kind":"string","value":"Bigger than a char but smaller than a blob"},"question":{"kind":"string","value":"Char's are great because they are fixed size and thus make for a faster table. They are however limited to 255 characters. I want to hold 500 characters but a blob is variable length and that's not what I want.\nIs there some way to have a fixed length field of 500 characters in MySQL or am I going to have to use 2 char fields?\n"},"answers":{"kind":"list like","value":["I would suggest using a varchar(500). Even though varchar isn't a fixed length, the database should reserve the correct amount of space. You shouldn't notice any performance difference using varchar(500) over 2xchar(255).\nYou're also probably going to cause extra overhead by joining two char fields together.\n","\nI would suggest using a varchar(500)\n\n... if you have MySQL 5.0.3 or higher. In previous versions, VARCHAR was restricted to 255 characters.\nAlso, CHAR and VARCHAR do not work the same regarding trailing spaces. Be sure to read 10.4.1. The CHAR and VARCHAR Types (this is for MySQL 5.0).\n","You're worrying too much about internal implementation details. Don't pre-optimize. \nGo with VARCHAR(500)\n"],"string":"[\n \"I would suggest using a varchar(500). Even though varchar isn't a fixed length, the database should reserve the correct amount of space. You shouldn't notice any performance difference using varchar(500) over 2xchar(255).\\nYou're also probably going to cause extra overhead by joining two char fields together.\\n\",\n \"\\nI would suggest using a varchar(500)\\n\\n... if you have MySQL 5.0.3 or higher. In previous versions, VARCHAR was restricted to 255 characters.\\nAlso, CHAR and VARCHAR do not work the same regarding trailing spaces. Be sure to read 10.4.1. The CHAR and VARCHAR Types (this is for MySQL 5.0).\\n\",\n \"You're worrying too much about internal implementation details. Don't pre-optimize. \\nGo with VARCHAR(500)\\n\"\n]"},"answers_scores":{"kind":"list like","value":[7,2,0],"string":"[\n 7,\n 2,\n 0\n]"},"non_answers":{"kind":"list like","value":[],"string":"[]"},"non_answers_scores":{"kind":"list like","value":[],"string":"[]"},"tags":{"kind":"list like","value":["database","mysql"],"string":"[\n \"database\",\n \"mysql\"\n]"},"name":{"kind":"string","value":"stackoverflow_0000005075_database_mysql.txt"}}},{"rowIdx":1329,"cells":{"content":{"kind":"string","value":"Q:\n\nHow do I style (css) radio buttons and labels?\n\nGiven the code bellow, how do I style the radio buttons to be next to the labels and style the label of the selected radio button differently than the other labels?\n\n\r\n\r\n\r\n
\r\n
\r\n What color is the sky?\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\n\nAlso let me state that I use the yui css styles as base. If you are not familir with them, they can be found here:\n\nreset-fonts-grids.css\nbase-min.css\n\nDocumentation for them both here : Yahoo! UI Library\n@pkaeding: Thanks. I tried some floating both thing that just looked messed up. The styling active radio button seemed to be doable with some input[type=radio]:active nomination on a google search, but I didnt get it to work properly. So the question I guess is more: Is this possible on all of todays modern browsers, and if not, what is the minimal JS needed?\n\nA:\n\nThe first part of your question can be solved with just HTML & CSS; you'll need to use Javascript for the second part.\nGetting the Label Near the Radio Button\nI'm not sure what you mean by \"next to\": on the same line and near, or on separate lines? If you want all of the radio buttons on the same line, just use margins to push them apart. If you want each of them on their own line, you have two options (unless you want to venture into float: territory):\n\nUse
s to split the options apart and some CSS to vertically align them:\n\n\n
\n
\n What color is the sky?\n \n\n \n \n
\n \n \n
\n \n \n
\n
\n\nFollow A List Apart's article: Prettier Accessible Forms\n\nApplying a Style to the Currently Selected Label + Radio Button\nStyling the