{ // 获取包含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\nvar MainController = function ($scope) {\n\n var model = { \n Name: \"Madhur Kapoor\", \n Books: [{ Title: \"The Hunger Games\", isComplete: false }, \n { Title: \"The Alchemist\", isComplete: true }, \n { Title: \"Angel & Demons\", isComplete: false }, \n { Title: \"Da Vinci Code\", isComplete: true }, \n { Title: \"The Godfather\", isComplete: false } \n ] \n };\n\n $scope.readingList = model;\n\n};\n\nnow my question is how check box will be checked or unchecked because check property is used to check unchecked the check box but if u see the code it look like \nif angular add the check property to checkbox at run time then how angular js detect that controls is check box not radio button? please help me to understand how check property will be added to check box. very confusing. thanks\n\nA:\n\nWhen you assign an ng-model to an input, angular checks the type of that input and binds it to the correct attribute.\nFor checkboxes it will bind to the 'checked' attribute. For text it will bind to the underlying value.\nMore on the ng-model API: https://docs.angularjs.org/api/ng/directive/ngModel\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28860,"cells":{"text":{"kind":"string","value":"Q:\n\nNetezza LAST_VALUE filter\n\nAm trying to create a NETEZZA table which has only the most recent records for a particular key - eg imagine a table (MYTABLE) as follows:\nCol1 Col2 TIMESTAMP\nxxxx xxxx 13:45\nxxxx xxxx 13:46\nxxxx yyyy 10:00\n\nI would like to return a table as follows:\nCol1 Col2 TIMESTAMP\nxxxx xxxx 13:46\nxxxx yyyy 10:00\n\nI'm guessing I need some code along the lines of:\n Create table MYNEWTABLE as\n select *\n from MYTABLE\n WHERE rowid in\n (\n SELECT LAST_VALUE(rowid)\n OVER (PARTITION BY COL1, COL2\n ORDER BY TIMESTAMP)\n FROM MYTABLE\n )\n ORDER BY COL1,COL2\n distribute on (COL1)\n\nHowever this isn't really working, can anyone please advise? (specifically how to filter the table by the last value of timestamp within the col1 / col2 partition)\n\nA:\n\nGot it - finally! rowid was a misnomer. Credit to Shawn Fox of Netezza Community for inspiration.\n Create table MYNEWTABLE as select * from\n (select *\n ,row_number() over (\n partition by COL1, COL2 order by TIMESTAMP desc\n ) row\n from MYTABLE \n ) x\n WHERE x.row=1\n distribute on (COL1)\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28861,"cells":{"text":{"kind":"string","value":"Q:\n\nComposite ID in join-table\n\nI have the following PostLike class:\n@Entity\n@Data\n@NoArgsConstructor\n@AllArgsConstructor\npublic class PostLike extends BaseEntity {\n\n @ManyToOne\n @JoinColumn(name = \"user_id\")\n private User user;\n\n @ManyToOne\n @JoinColumn(name = \"post_id\")\n private Post post;\n}\n\nThe class already has an ID field provided by parent BaseEntity class.\nIn the User class, I have the following field:\n@OneToMany(mappedBy = \"user\", fetch = FetchType.LAZY)\nSet userLikes = new HashSet();\n\nAnd in the Post class:\n@OneToMany(mappedBy = \"post\")\nprivate Set postLikes = new HashSet();\n\nI want a PostLike to have a composite primary key, which consists of user_id and post_id.\nThanks in advance.\n\nA:\n\nAs one way to do this you can use @EmbeddedId annotation and express this composite key with embeddable class:\n@Entity\npublic class PostLike {\n\n @Embeddable\n private static class Id implements Serializable {\n\n @Column(name = \"user_id\")\n private Long userId;\n\n @Column(name = \"post_id\") \n private Long postId;\n\n public Id() {\n }\n\n public Id(Long userId, Long postId) {\n this.userId = userId;\n this.postId = postId;\n }\n\n // equals and hashCode\n }\n\n @EmbeddedId\n Id id = new Id();\n\n @ManyToOne\n @JoinColumn(name = \"user_id\")\n private User user;\n\n @ManyToOne\n @JoinColumn(name = \"post_id\")\n private Post post;\n\n public PostLike() {\n }\n\n public PostLike(User user , Post post) {\n this.user = user;\n this.post = post;\n\n this.id.postId = post.getId();\n this.id.userId = user.getId();\n\n post.getUserLikes().add(this);\n user.getUserLikes().add(this);\n }\n ... // getters and setters\n}\n\nSome notes:\nfrom javadoc of @EmbeddedId\n\nThere must be only one EmbeddedId annotation and\n no Id annotation when the EmbeddedId annotation is used.\n\nfrom Java Persistence with Hibernate\n\nThe primary advantage of this strategy is the possibility for bidirectional navigation.\n ...\n A disadvantage is the more complex code needed to manage the\n intermediate entity instances to create and remove links, which you have to save\n and delete independently.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28862,"cells":{"text":{"kind":"string","value":"Q:\n\nSci fi short story, multi species starship crew, man has sex with a wolf\n\nI read this in a UK anthology approx 12 years ago, I can't think of any of the other stories, or any describer of the book itself.\nThe story is a sequence of reports to the Governing Council, who seem to be a super strict politically correct body. The reports are assessed to ensure all is still ok after this incident, otherwise crew termination will be carried out.\nThere is a Earth youth in his late teens, I think he's ranked as Ensign, he is the main protagonist, the ship diverts to pick up an extra crew member, this man is from a colony world that has only been back in contact for a few years.\nEn Route to collect him, the protagonist and a Timber Wolf (male as well I think) have sex, this is perceived as normal and mentally healthy by the Council. There are also some whales and, I think, one class of Great Ape that are also aboard and inter species sexual encounters are commonplace.\nNew crew member arrives and is a bit aloof and abrasive, the Council takes a very keen interest in all his interactions with the crew. One day they are doing these like political indoctrination lessons and new guy propounds a theory that some species became extinct because they liked being hunted.\nA couple of minutes later they've en masse spaced him through an airlock . He's screaming \"you're all animals!\" as he is bundled into it.\nThe Council assess all crew and the verdict is they are still fine and no cross contamination of ideology occurred so the crew are allowed to live\nThe Timber Wolf and the other animals had some kind of communication device strapped to them and it was the Ensigns immediate superior officer but also his friend.\nUpdate: I've been thinking about this story, there was a bit of backstory, there was only one class of wolf that was found to have true sapience, the other breeds didn't make the grade, it was the same (I think!) with the Great Ape, one type of gorilla that had it but the other breeds were just dumb.\nAlso there might, but I'm not sure, have been something about a sloth\n\nA:\n\nA slight correction. I believe this is a short story Restricted to the Necessary in the 1998 short story collection Apocalypses and Apostrophes by John Barnes. \nIn it as you have noted the male protagonist has intimate relations with a wolf commander/captain. As I recall the Timberwolf has a very silver colored coat which the protagonist finds particularly attractive. \nThe \"villain\" effectively commits a heretical crime by stating that the crew members (which are other animal descendant species) enjoy or otherwise want to be dominated/hunted by humans as part of their genetic background. As you indicated he is summarily executed by being ejected out the airlock. \n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28863,"cells":{"text":{"kind":"string","value":"Q:\n\nSetting class properties in Java, Spring config Vs System Properties file\n\nWe can use both Spring config file OR a .properties file to store and retrieve some properties, like for a database connection. (db url, db password and etc)\nWe can also use Spring config file and a .properties file together, where we reference the property from a .property file (like in ant)\nWhat would be the advantages or disadvantages for the following scenarios:\n1 - Using only .properties file. \n2 - Using only Spring config file. \n3 - Using both together. \nWould any of the scenarios be better when it comes to maintenance?\nI need to choose between the three, and I would like to have a better judgement before I go with any of the option!\nThanks in advance! \n- Ivar \n\nA:\n\nBoth together. Use a properties file that's externalizable from your project to configure Spring. Spring then configures your project. Mostly, you don't write code to read from properties files. Let Spring manage that and inject your objects with the appropriate values. Then you have appropriate dependency injection and the artifact you build isn't environment-specific.\nDisadvantages:\n\nHow does your code know what file to load the properties from? Isn't that a property? It also violated dependency injection by having code go find a resource rather than passively accepting one.\nConfiguration is tightly coupled to your artifact and can't change between environments without rebuilding (BAD).\nThe way you seem to think of it, this combines the disadvantages of the other two, but if you do it the way I described, it eliminates those disadvantages, which is an advantage.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28864,"cells":{"text":{"kind":"string","value":"Q:\n\nR join coordinates on map with lines\n\nI have a list of start longidudes,latitudes and end longitudes and latitudes in a .csv file which i need to plot on a map and join with lines. The coordinates are for Manchester in England.\n.csv example:\nTimestamp Start Description End Description Start(lon,lat) End(lon,lat)\n24/10/2016 Wimslow Simonsway 53.371535,-2.23148 53.32803,-2.246991 \n14/10/2016 Horwich Park M1 3BG 53.58194,-2.53801 53.47837,-2.23296 \n\netc.\n\nA:\n\nAssuming your data is called dat you can first create seperate columns for Lon and Lat (careful, the values are in opposite order of the variable names), then use geom_segment to plot the lines.\nlibrary(tidyr)\nlibrary(ggmap)\nlibrary(ggplot2)\n\nmap <- get_map(location = 'Manchester', zoom = 9, scale = 2)\ndat <- dat %>%\n separate(Start.lon.lat., c(\"Start.Lat\", \"Start.Lon\"), sep =\",\") %>%\n separate(End.lon.lat., c(\"End.Lat\", \"End.Lon\"), sep =\",\")\n\nggmap(map) +\n geom_segment(data = dat, aes(x = as.numeric(Start.Lon), \n y = as.numeric(Start.Lat), \n xend = as.numeric(End.Lon), \n yend = as.numeric(End.Lat)))\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28865,"cells":{"text":{"kind":"string","value":"Q:\n\nCan someone help me define these 3 lines of code?\n\nCan somebody help me with what these lines of code are actually saying? \n if (!(x == snakeX && y == snakeY)) batch.draw(texture, x, y);\n\nand \n for (BodyPart bodyPart : bodyParts) {\n bodyPart.draw(batch);\n }\n\nA:\n\nhere is what you could say about those lines\n if (!(x == snakeX && y == snakeY)) batch.draw(texture, x, y);\n\nif some coordinate* (x,y) are not equal to the snake coordinate\n (position of the snake in the screen) then a texture will be drawn in\n the screen at the (x,y) position of the screen\n\n for (BodyPart bodyPart : bodyParts) {\n bodyPart.draw(batch);\n }\n\ndrawing all the part of the body of snake which each par is class\n named BodyPart\n\nthis code refer to the classic game of snake \ngood luck\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28866,"cells":{"text":{"kind":"string","value":"Q:\n\nAbout presenter pattern in rails. is a better way to do it?\n\nI have in my model:\ndef presenter\n @presenter ||= ProfilePresenter.new(self)\n @presenter\nend\n\nThe ProfilePresenter is a class that has methods like, get_link(), get_img_url(size), get_sex(), get_relationship_status() and other methods that have not to do with the model, not even with the controller but is used multiple times in the view.\nSo now i use them by doing this:\nProfile.presenter.get_link\n# or\nProfile.presenter.get_img_url('thumb') # returns the path of the image. is not used to make a db query\n\nSincerelly i think i missed out the real concept of presenters.. but this is what m trying to archive, how can be called this?\n\nA:\n\nNormally this sort of thing is handled via helper methods, such as:\ndef profile_link(profile)\n profile.link ? content_tag(:a, h(profile.name), :href => profile.link) : 'No profile'\nend\n\nIt is unfortunate you cannot layer in Presenter-style helper methods that extend a Model at view time. They need to be called in a procedural manner with a parameter, kind of anti-OO.\nThe Presenter approach is not fully supported in the Rails MVC area because it needs to bind to a view in order to have access to the various helper methods required to properly render content, plus information about the session that may impact the presentation.\nA more robust approach might be to do something like this:\nclass ProfilePresenter\n def initialize(view, profile)\n @profile = profile\n @view = view\n\n yield(self) if (block_given?)\n end\n\n def link\n @profile.link ? @view.content_tag(:a, @view.h(profile.name), :href => @profile.link) : 'No profile'\n end\n\n def method_missing(*args)\n @profile.send(*args)\n end\nend\n\nThis would show up in your view as something like:\n<% ProfilePresenter.new(self, @profile) do |profile| %>\n
<%= profile.link %>\n<% end %>\n\nYou can simplify calling this by making a helper method that does something mildly crazy like:\ndef presenter_for(model)\n \"#{model.class}Presenter\".constantize.new(self, model) do |presenter|\n yield(presenter) if (block_given?)\n end\nend\n\nThis means you have a much simpler call:\n<% presenter_for(@profile) do |profile| %>\n
<%= profile.link %>\n<% end %>\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28867,"cells":{"text":{"kind":"string","value":"Q:\n\nChatter Group CRUD\n\nI got dinged in a Security Review for not checking the CRUD settings for some code that inserts a record into a Chatter Group. The Group Id is stored in a Custom Setting, but the organization could set up the group to be Private, and not add the user to the group, at which point the code would fail.\nBut in the response, they suggested something like this:\nisCreateable = Schema.sObjectType.FeedItem.isCreateable();\n\nBut am I right in thinking that doesn't make sense for a Chatter Group? I believe I have to confirm that that the user is a member of the group, and if they are, they will be able to post to the group? Just want to be sure before I submit it again...\n\nA:\n\nI think I agree with you about their suggestion; I'm not sure how that's helpful.\nThere are (at least) two scenarios:\n\nThe group is public, in which case the user (or Apex running on the user's behalf) need not be a member to post to it.\nThe group is private, in which case a quick query on CollaborationGroupMember can determine the running user's membership:\nCollaborationGroupMember[] membership = [select id \n from CollaborationGroupMember \n where collaborationGroupId = :myGroupId and memberid = :myUserId]; \n\nif( membership.isEmpty() ) {\n // Not a member\n} else {\n // Member! Post as normal.\n}\n\nEdit: Security may be referring to the fact that the org in question may not be Chatter-enabled, in which case I still don't think their code is helpful -- instead, what I've done previously is perform a global describe and check for the existence of CollaborationGroup.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28868,"cells":{"text":{"kind":"string","value":"Q:\n\nAdobe Air: why SQLStatement's getResult().data is null?\n\nUsing Flash Builder 4.6, I am following http://www.flex-blog.com/adobe-air-sqlite-example (edit: link seems to be broken) as an example, and there is one part of codes that does not work:\nprivate function resault(e:SQLEvent):void\n{\n // with sqls.getResault().data we get the array of objects for each row out of our database\n var data:Array = sqls.getResult().data;\n // we pass the array of objects to our data provider to fill the datagrid\n dp = new ArrayCollection(data);\n}\n\nChecking the program during runtime gives me that sqls.getResult() returns a valid SQLResult object, but its data is null. \nAnd from my previous question Adobe Air: convert sqlite's result [object Object] to String?, it seems I am asking the wrong question.\nNevertheless, I've checked my SQLResult object with\ntrace(ObjectUtil.toString(sqls.getResult()));\n\nand I can see that I got all of my content from sqlite:\n(flash.data::SQLResult)#0\n complete = true\n data = (Array)#1\n [0] (Object)#2\n first_name = \"AAA\"\n id = 1\n last_name = \"BBB\"\n [1] (Object)#3\n first_name = \"AAA\"\n id = 2\n last_name = \"BBB\"\n [2] (Object)#4\n first_name = \"qqq\"\n id = 3\n last_name = \"qqq\"\n lastInsertRowID = 0\n rowsAffected = 0\n\nSo what's going on here? Do I really have to create my own function to parse all of my sqlite elements and then place them in the data provider myself? Yes, I can do that, but seriously, many tutorials have shown using:\nvar data:Array = sqls.getResult().data;\ndp = new ArrayCollection(data);\n\nNow, back on the question: What might be the possible causes of sqls.getResult().data becoming null? \n\nA:\n\nThat doesn't look like a very good tutorial you're following there (in my opinion). In that code, you have one event listener for all the statements that are being executed. It even has just one SQLStatement that executes different queries. I don't know exactly what is going wrong with your code, but I'm fairly certain the cause is to be found there. (And don't even get me started about that Timer used as a delay when a statement is still executing. Yuck!). I strongly suggest you look for a better source for learning Flex/AIR/SQLite.\nYou should simply create a new SQLStatement, or at least discrete event handlers for each Statement execution. A better way to do this, would be to use the Responder class, like this:\nvar stmt:SQLStatement = new SQLStatement();\nstmt.sqlConnection = connection;\nstmt.text = query;\n\nvar token:Responder = new Responder(onResult, onFail);\nstmt.execute(-1, token);\n\nThe SQLConnection can be shared though, if you don't mind keeping the connection to your database open all the time.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28869,"cells":{"text":{"kind":"string","value":"Q:\n\nDifference between CRON tab 0/5 and */5?\n\nIs there any difference between creating a CRON tab using 0/5 and */5?\nFor example:\n0/5 * * * *\n\nvs\n*/5 * * * *\n\nA:\n\nThis IBM support article explains how stepping works. In the case of */5, it would occur every 5 minutes (0, 5, 10, etc). That is the same as 0-59/5. In the case of 0/5, I just tested it and it will never run.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28870,"cells":{"text":{"kind":"string","value":"Q:\n\nStatic content return error 500 after upgrade to MVC 4\n\nWe've been running a .Net 4 MVC 3 application without any problems and decided to upgrade to MVC 4 today. The MVC 4 version works great when I run it locally on my computer, but when published to the server (running IIS 7) it returns error code 500 for all css files and js files.\nNo other changes have been made to the application.\nMVC 4 is not installed on the server (neither was MVC 3) so instead we deploy the necessary dlls using a _bin_deployableAssemblies folder.\nDoes anyone have a solution to this problem?\nThank you!\n\nA:\n\nTurns out the problem was related to compression of the static files.\nWe'd added httpCompression (gzip) and urlCompression to our web.config some time ago (when we were still using MVC 3) but for some reason it didn't kick in until today I guess.\nI tried publishing the application with MVC 3 again and got the same error which led to me finding the problem.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28871,"cells":{"text":{"kind":"string","value":"Q:\n\nWhat is the code behind for datagridtemplatecolumn, and how to use it?\n\nI have a DataGrid in WPF. And I am trying to add Buttons to certain cells of the grid, after it is bound to a particular ItemsSource. I have tried to do this in the xaml like this:\n \n \n \n \n \n \n\n\nHowever, I want to know as to how I can do this in the code behind. I need this so that I can place Buttons whenever a particular click even takes place. Any help will be highly appreciated.\n\nA:\n\nuse this:\nDataGridTemplateColumn col1 = new DataGridTemplateColumn();\ncol1.Header = \"MyHeader\";\nFrameworkElementFactory factory1 = new FrameworkElementFactory(typeof(CheckBox));\nBinding b1 = new Binding(\"IsSelected\");\nb1.Mode = BindingMode.TwoWay;\nfactory1.SetValue(CheckBox.IsCheckedProperty, b1);\nfactory1.AddHandler(CheckBox.CheckedEvent, new RoutedEventHandler(chkSelect_Checked));\nDataTemplate cellTemplate1 = new DataTemplate();\ncellTemplate1.VisualTree = factory1;\ncol1.CellTemplate = cellTemplate1;\ndgTransportReqsts.DataGrid.Columns.Add(col1);\n\nI used this to add CheckBox in my DataGridTemplateColumn at runtime.\nHope this helps!!\n\nA:\n\nAnurag's answer will work very well for you if you want to add the buttons before the grid is instantiated, specifically before you add the column to the grid.\nIf you want to add the button to the grid cell after the grid is already built, you can do it by making changes to the DataGridCell object. First you have to find it:\n\nFind the DataGridCell by using DataGridColumn.GetCellContent\nUse VisualTreeHelper to scan up the visual tree to the DataGridCell\n\nOnce this is done, there are several ways to add a button to the DataGridCell, depending on what you're trying to achieve:\n\nSet DataGridCell.Template to a ControlTemplate containing the buttons and other styling you desire, -OR-\nSet DataGridCell.ContentTemplate to a DataTemplate containing the buttons and other items you desire, -OR- \nHave your column's DataTemplate include a placeholder panel to hold new buttons, search down the visual tree for this panel by Name, and add your button to it.\n\nAn alternative approach that doesn't require finding the cell is to:\n\nInclude an ObservableCollection property in your view model that supplies the information to create the buttons\nIn your DataTemplate include an ItemsControl that reference this property and has a DataTemplate that can create the correct button out of type T\nWhen you want to add a button, just add an item to the ObservableCollection property\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28872,"cells":{"text":{"kind":"string","value":"Q:\n\nHow to replace specific strings between two strings in php\n\nI would like to generate sql from this template : \nselect * from event where \nstatus_id = 'TOREPLACE_1' \nor status_id = 'TOREPLACE_2'\n....\n\nto have this result : \nselect * from event where \nstatus_id = (select id from name = 'TOREPLACE_1' limit 1)\nor status_id = (select id from name = 'TOREPLACE_2' limit 1)\n.....\n\nthe question is how to select the expression between '' after every status_id =\nThanks\n\nA:\n\nUse the following regexp:\n/status_id\\s*=\\s*\\'([^\\']+)\\'/\n\nThe whole solution would require something like that: \npreg_match_all($regexp, $string, $matches); \n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28873,"cells":{"text":{"kind":"string","value":"Q:\n\n¿Por qué se denomina \"luca\" a mil pesos?\n\nEn su respuesta a ¿Se usa “kilo” como “millón” en Hispanoamérica?, pablodf76 comenta que:\n\n(...) en Argentina (y creo que en Chile) mil unidades monetarias locales (pesos o lo que fuera) se llaman coloquialmente una luca.\n\nMirando en el DRAE constato el hecho:\n\nluca\n 1. f. coloq. Arg., Col. y Ur. Mil pesos.\n\nY lo mismo con el Diccionario de americanismos:\n\nluca.\n I. 1. Ar, Ur, pop; Ch, pop + cult → espon. Cantidad de dinero equivalente a mil pesos.\n 2. f. pl. Co. Dinero. pop.\na. ǁ de a ~.\n i. loc. adj. Ec, Bo. Referido a cosa material, barata o de mala calidad. pop.\n ii. Ec, Bo. Referido a precio, bajo. pop.\n iii. Ec. juv. Referido a persona o cosa, que no sirve.\n\nSin embargo, no encuentro el origen etimológico de la palabra. ¿Alguien sabe de dónde viene su uso?\n\nA:\n\nHay unas cuantas páginas que dan fe de su origen. Por ejemplo en 24horas.cl se comenta en ¿Por qué le decimos \"luca\" al billete de mil pesos?:\n\nEl origen de la historia cuenta que, en el siglo XVIII., en España le llamaban a unas monedas las \"peluconas\", debido a la presencia de un personaje que usaba este atuendo típico para aquel entonces.\nNuestro país, en su condición de colonia hispánica, inevitablemente comenzó a adoptar el modismo y así vincularlo al dinero criollo.\nSin embargo, el paso de los años permitió que el nombre se fuera acortando lentamente, pasando a \"peluca\" hasta quedar como la conocemos hoy: luca.\nPero la evolución del término fue transversal de nuestro país, porque en Uruguay, Argentina y Colombia también lo usan para denominar a las divisas locales.\n\nLo cual enlaza con el uso de peluco para nombrar un reloj ostentoso, por la presencia de la peluca del rey en las monedas:\n\ncomo la moda en el siglo XVIII, entre la alta nobleza, era de llevar peluca, al rey se le representaba con una peluca.\n\nA:\n\nA pesar de que la versión de las \"pelucas\" -indicada por fedorqui- me parece la más convincente, existe la posibilidad de que su origen esté en el caló (la lengua de los gitanos españoles). En realidad ambas versiones no tendrían por qué ser excluyentes. La expongo acá porque me parece entretenida, principalmente a partir de \"Apuntaciones sobre el caló bogotano\" (Max Leopold Wagner, 1950) y de un googleo rápido.\nEn caló de fines del siglo XIX, \"peseta\" se decía lúa, palabra cuyo origen no remite a las \"pelucas\", sino al argot antiguo francés, a la palabra luque, ya detectada en 1628, 150 años antes de la onza pelucona con el perfil de Carlos III. Hay que aclarar que estas \"lúas\" corresponden a las pesetas, no a las onzas peluconas.\nLuque significaba \"certificado falso\", y probablemente derivaba de la villa de Lucques, una localidad francesa en la que se comerciaba la seda. Posteriormente luque pasó a significar también \"naipes\" en la germanía (o sea en el lenguaje de los delincuentes), y de ahí pasó como \"lúa\" al caló y a la jergas española, portuguesa y americana, donde también podía significar \"luz\" y \"prostituta\" (aunque toda esta confusión está poco clara, y se mezcla con la de la palabra española lea).\nA partir de lúas, en un juego de palabras típico de \"los bajos fondos\", a la baraja se le dijo \"masselucas\" (el Maese Lucas), palabra que aparentemente permaneció en el lunfardo rioplatense.\nEl paso de \"los naipes\" a \"las monedas\" no parece disparatado, sobre todo considerando que en la jerga popular es muy fácil saltar de un significado a otro por mero sentido del humor.\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28874,"cells":{"text":{"kind":"string","value":"Q:\n\nGPL 3 and \"webapps\"\n\nI am working on a \"webapp\" (no content by me, all user driven) and want to license it with the GPL 3. I do plan on having a tarball with the php, html, css, javascript, etc as well as an installer to set up a mysql database for it and some other small stuff so someone else can host a personalized one if they want (like phpbb). The GPL requires that the user be allowed to modify and run the modified software. I obviously cannot allow that on my server, but am not sure if that stopping the user like that violates the terms of the GPL. \nAlso, I do plan on an easy, readable (probably csv) export/import option so the user can move their data around if they want.\nIs that enough to placate the GPL? \n\nA:\n\nOffering the source code for download is enough. You're not required to give users the ability to modify the source code in your hosted version.\nThis has always been the case. The 'freedom to modify and run' does not signify a freedom to modify and run source code on a machine the user neither owns nor has admin access to.\nThere's some clarification of the rules for installed software in the GPLv3 FAQ:\n\nCompanies distributing devices that\n include software under GPLv3 are at\n most required to provide the source\n and Installation Information for the\n software...\n\nIn short, give users access to the source code and instructions to install it, and that's enough to satisfy the licence. (e.g. Like Automattic does with WordPress.)\n\n"},"meta":{"kind":"string","value":"{\n \"pile_set_name\": \"StackExchange\"\n}"}}},{"rowIdx":28875,"cells":{"text":{"kind":"string","value":"Q:\n\nHow to disable HTML/JavaScript form if JavaScript is disabled in browser\n\nFirst off the bat I am new to this an really trying my best to understand how this works. I have the following simple login form that leads to a homepage if the right login credentials are submitted. However when run in Firefox with JavaScript disabled the login credentials are ignored and my homepage is displayed anyway no matter what login details I provide. I have created a message in between which fires when JavaScript is disabled. What I would like to achieve is that the warning message displays only and that the form etc. is disabled and not displayed until the login page is reloaded with JavaScript enabled. Can someone please help me with this? It is much appreciated!! My code is\n\n\n\n\n\n\n\n

Login details

\n\n\n\n
\n
\n
\n
\n
\n

\n \n
\n
\n\n\n\n\n\nA:\n\nYou can achieve this without adding extra JavaScript. You can use a