{ // 获取包含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"}}},{"rowIdx":1092632,"cells":{"text":{"kind":"string","value":"import { Form, json, useNavigation, useSearchParams, Link, useActionData } from \"react-router-dom\";\nimport classes from './AuthForm.module.css'\nconst AuthForm = () => {\n\n const navigation = useNavigation();\n const data = useActionData();\n const [serchParams] = useSearchParams();\n const isLogin = serchParams.get('mode') === 'login';\n\n const isSubmitting = navigation.state === 'submitting';\n\n \n\n return (\n
\n

{isLogin ? 'Login' : 'Create new user'}

\n\n {\n data && data.error && (\n
    \n {Object.values(data.error).map((err) => (\n
  • {err}
  • ))}\n
\n )\n }\n\n {!isLogin &&

\n \n \n

}\n

\n \n \n

\n

\n \n \n

\n
\n \n {isLogin ? 'Create new user' : 'Login'}\n \n \n
\n\n
\n )\n}\n\nexport default AuthForm;"}}},{"rowIdx":1092633,"cells":{"text":{"kind":"string","value":"# Start time: 2024-04-10 14:59:27.347537\n\n'''\nPrompt:\nThe prompt describes the relationship between the inputs and outputs. Given that the prompt is: Summary for Input Column Data:\n- The input column data consists of URLs in the format of protocol=//domain/path.\n- Each URL in the input column data follows a similar structure with variations in the domain and path.\n\nSummary for Output Column Data:\n- The output column data consists of URLs with the protocol and domain extracted from the corresponding input URLs.\n- The output URLs retain the protocol and domain from the input URLs while removing the path component.\n\nRelationship between Input and Output:\n- The relationship between the input and output is that the output URLs are derived from the input URLs by extracting the protocol and domain components while excluding the path component.\n- The output URLs serve as a simplified version of the input URLs, focusing on the essential protocol and domain information.\n- This process of extracting and simplifying the URLs helps in creating a more concise and structured representation of the original URLs., and input as ['https=//abc.com/def'] output is https=//abc.com/, input as ['http=//www.abc.com/def/cef'] output is http=//www.abc.com, input as ['http=//chandoo.org/wp/def-def'] output is http=//chandoo.org/, , generate a python function that matches the given input and output above, treating the input and output as strings, not lists. If the input has multiple list elements, that means there are separate inputs that should be passed as separate arguments to the python function. Include the above input in test cases. Do not include the output of the test code in the python program. The generated python code should have only executable statements and comments. The function should return the output, not print it. Do not include assert statements. Name the generated python function as generated_function. Make sure to generate a python function as defined above.\n'''\n\ndef generated_function(input_str):\n # Split the input string into protocol, domain, and path components\n protocol, domain_path = input_str.split('=')\n domain, path = domain_path.split('/', 1)\n \n # Construct the output URL with protocol and domain only\n output_str = f\"{protocol}={domain}/\"\n \n return output_str\n\n# Test cases\nprint(generated_function('https=//abc.com/def')) # Output: https=//abc.com/\nprint(generated_function('http=//www.abc.com/def/cef')) # Output: http=//www.abc.com\nprint(generated_function('http=//chandoo.org/wp/def-def')) # Output: http=//chandoo.org/\nprint(generated_function(\"https=//abc.com/def\")) ## Output: https=//abc.com/\nprint(generated_function(\"http=//www.abc.com/def/cef\")) ## Output: http=//www.abc.com\nprint(generated_function(\"http=//chandoo.org/wp/def-def\")) ## Output: http=//chandoo.org/\n\n# End time: 2024-04-10 14:59:29.658058\n# Elapsed time in seconds: 2.310453730000063\n\n\n# APPEND TEST SCRIPTS...\nprint(generated_function(\"https=//abc.com/def\")) ## Output: https=//abc.com/\nprint(generated_function(\"http=//www.abc.com/def/cef\")) ## Output: http=//www.abc.com\nprint(generated_function(\"http=//chandoo.org/wp/def-def\")) ## Output: http=//chandoo.org/\n\n\nprint(generated_function(\"https=//abc.com/home\")) ### Output: https=//abc.com/\nprint(generated_function(\"http=//www.abc.com/home/category\")) ### Output: http=//www.abc.com\nprint(generated_function(\"http=//chandoo.org/wp/home-home\")) ### Output: http=//chandoo.org/\n\n# TEST SCRIPTS APPENDED!"}}},{"rowIdx":1092634,"cells":{"text":{"kind":"string","value":"using Abp.Dependency;\nusing Castle.MicroKernel.Registration;\nusing Castle.Windsor.MsDependencyInjection;\nusing Microsoft.Data.Sqlite;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.Extensions.DependencyInjection;\nusing FintrakERPIMSDemo.EntityFrameworkCore;\nusing FintrakERPIMSDemo.Identity;\n\nnamespace FintrakERPIMSDemo.Test.Base.DependencyInjection\n{\n public static class ServiceCollectionRegistrar\n {\n public static void Register(IIocManager iocManager)\n {\n RegisterIdentity(iocManager);\n\n var builder = new DbContextOptionsBuilder();\n\n var inMemorySqlite = new SqliteConnection(\"Data Source=:memory:\");\n builder.UseSqlite(inMemorySqlite);\n\n iocManager.IocContainer.Register(\n Component\n .For>()\n .Instance(builder.Options)\n .LifestyleSingleton()\n );\n\n inMemorySqlite.Open();\n\n new FintrakERPIMSDemoDbContext(builder.Options).Database.EnsureCreated();\n }\n\n private static void RegisterIdentity(IIocManager iocManager)\n {\n var services = new ServiceCollection();\n\n IdentityRegistrar.Register(services);\n\n WindsorRegistrationHelper.CreateServiceProvider(iocManager.IocContainer, services);\n }\n }\n}"}}},{"rowIdx":1092635,"cells":{"text":{"kind":"string","value":"import React, { Fragment } from 'react';\nimport '../../../components/styles/Demo.css';\nimport Tabs from '../../../tabs/Tabs.js';\nimport {Link} from 'react-router-dom';\nimport Fade from 'react-reveal/Fade';\nimport Quiz from '../../../components/quiz/Quiz.js';\n\nimport fire from '../../../config/Fire';\nimport Login from '../../../components/Login.js';\n\nclass Unit6Lesson6 extends React.Component {\n constructor(props) {\n super(props);\n this.logout = this.logout.bind(this);\n this.state = ({\n user: null,\n });\n this.authListener = this.authListener.bind(this);\n }\n logout(){\n fire.auth().signOut();\n }\n componentDidMount(){\n this.authListener();\n }\n \n authListener() {\n fire.auth().onAuthStateChanged((user) => {\n //login\n if (user) {\n this.setState({user});\n localStorage.setItem('user', user.uid);\n } \n //logout\n else {\n this.setState({ user:null});\n localStorage.removeItem('user');\n }\n });\n }\n render() {\n return (\n
\n {this.state.user ? () : ()}\n
\n )\n }\n}\nclass Lesson extends React.Component {\n render() {\n return (\n
\n\n
\n
\n \n
\n
\n
\n
\n
Special Methods
\n
\n \n \n
\n
Let’s go over special methods in Python. Why use them? Well, we use special methods because we can’t have certain methods available to us such as the print method. If we tried to print out an instance of a class we wouldn’t be able to. Let’s look at an example.
\n
\n
def
name_of_function
(arg1,arg2):
\n
\n
In this supplemental, you’ll learn about how to create an Object type such as a list. Let’s begin by exploring some Objects within Python.As you can see, when we tried to print out an instance of our class we weren’t able to do so. Instead, Python gave us the memory location of our instance game1. To resolve this and have Python return something that is useful for us, what we can use are special methods. These methods allow us to perform actions such as printing out instances of our class. Now, why would we want to do this? Well, there might be scenarios where there’s another programmer who needs to create the exact same instance of a class as you created. So with the same object name, arguments, etc. To provide that type of information, what we can do is use the __repr__() method. You should note that all special methods have double underscores surrounding the method name followed by open and closed parentheses. You’ve already been working with a special method which was __init__ it’s just that you weren’t aware of it. So now that you can identify special methods, let’s go ahead and see them in action.
\n
\n
def
name_of_function
(arg1,arg2):
\n
\n
To use a special method, go into your class and do double underscores surrounding the method name which in our case is repr. Then place your parentheses and inside of the parentheses type in self. The reason as to why we do this is because we want our method to take in all of the arguments of our instance. By passing in self, we now have access to whatever instance we want to perform our action on. Inside of the method, you can go ahead and type in the code you want executed when you eventually print out the instance of your class and because we wanted other programmers to be able to create a perfect copy of our own instance, we want our print statement to return the name attribute for our instance. By using __repr__() we were able to successfully use the print function to call our instance game1.
\n
Another special method that can be used to print out instance of a class is the str method. The str special method is used just like the repr method, however, programmer use it for when we want to output something to a user rather than another programmer. So we use str when we want the outputted information to be more readable. Let’s look at an example.
\n
\n
def
name_of_function
(arg1,arg2):
\n
\n
As you can see, the formatting of the special method str is the exact same as repr but with a different method name. When we do print(game1) rather than giving us a memory location, we have a readable statement printed out on our screen. So we use the special method str for when we want to print out instances of our class and have them return readable statements.
\n
We also have a special method to find the length of an object. Let’s say you had an instance of a class with the number of movies showing at a theatre and you wanted to see how long the movies were. Let’s look at an example:
\n
\n
def
name_of_function
(arg1,arg2):
\n
\n
So you can see that we have an instance of the class movies called movie1 with the name Star Wars and a run time of 125 minutes. But when we tried to find the length of our object, we get back an error. To resolve this we can use the special method for length. Do the following:
\n
\n
def
name_of_function
(arg1,arg2):
\n
\n
By having the special method len return the run_time of our object, whenever we call the len of our object movie1, instead of running into errors we now get back how long the movie is.
\n
These are the basics of special methods. They allow you to execute method calls on your instances that would have otherwise been impossible to do.
\n
\n\n
\n \n \n \n \n \n
\n\n
\n
Task
\n
Create a program that has a class and multiple instances of that class. Utilize special methods so that when you print out the instance of your class, you’ll receive all the information about the object so that if another programmer wished to create an instance with the exact same attributes, they would be able to do so by looking at the output of the print statement.
\n \n
\n \n
\n
\n
\n
\n\n
\n
\n
\n\n
\n )\n }\n}\n\nexport default Unit6Lesson6;"}}},{"rowIdx":1092636,"cells":{"text":{"kind":"string","value":"import { Button, Divider, TextField, Typography } from \"@mui/material\";\nimport { Box } from \"@mui/system\";\nimport React, { useEffect } from \"react\";\nimport { useNavigate } from \"react-router-dom\";\nimport DeleteOutlinedIcon from \"@mui/icons-material/DeleteOutlined\";\nimport { useCart } from \"../../Context/CartContextProvaider\";\n\nconst Cart = () => {\n const navigate = useNavigate();\n\n const { getCart, cart, changeProductCount, deleteCartProduct } = useCart();\n\n useEffect(() => {\n getCart();\n }, []);\n const cartCleaner = () => {\n localStorage.removeItem(\"cart\");\n getCart();\n };\n if (!cart) return;\n return (\n <>\n \n Корзина\n \n {cart.products.length == 0 ? (\n \n \n Ваша корзина пуста\n \n\n navigate(\"/product\")}\n sx={{\n backgroundColor: \"#fbb3db\",\n color: \"white\",\n borderRadius: 0,\n fontWeight: 500,\n mt: \"2%\",\n }}\n >\n Перейти к выбору\n \n \n ) : (\n <>\n \n {cart.products.map((product, index) => (\n \n \n \n {product.item.title}\n \n \n \n changeProductCount(\n e.target.value,\n product.item.id\n )\n }\n sx={{\n width: {\n xs: \"35%\",\n sm: \"30%\",\n md: \"25%\",\n lg: \"25%\",\n xl: \"25%\",\n },\n }}\n />\n \n \n {product.subPrice} $\n \n \n \n \n \n deleteCartProduct(\n product.item.id\n )\n }\n />\n \n \n \n ))}\n \n \n {\" \"}\n \n \n ИТОГ:\n \n \n \n {cart.totalPrice} $\n \n \n \n \n \n \n \n \n \n navigate(\"/payment\")}\n >\n Оформить заказ\n \n \n \n \n )}\n \n );\n};\n\nexport default Cart;"}}},{"rowIdx":1092637,"cells":{"text":{"kind":"string","value":"'''\n @Author Jared Scott ☯\n This script will open a socket connection at the specified port number hosted from localhost (127.0.0.1)\n This socket when conntacted will generate a random data value and return this data over the socket.\n'''\n\nimport socket\nimport random\n\ndef main():\n port = 10150 #Port where the sensor data will be 'Served'\n sckt = socket.socket()\n sckt.bind(('localhost', port)) # Creates the port binding for 127.0.0.1:10150\n sckt.listen() #Socket object will now listen for activity on the specified port\n sckt.settimeout(3)\n print('Serving Belfort 6200 Data at 127.0.0.1:' + str(port) + '\\nListening....')\n while True:\n conn = None\n try:\n #Outer try is watching for a keyboard interrupt coming from the inner try when it throws a timeout exception \n try:\n '''\n KeyboardInterrupt does not reach main call stack until process is complete. \n The timeout will complete the process and exit with a timeout exception.\n If the user has entered a keyboard interrupt, the timeout will allow that exception to be caught\n '''\n conn, address = sckt.accept() # Establish connection with client.\n print('Incoming connection from address: ', str(address[0]) + \":\" + str(address[1]))\n simulateSensor(conn)\n except socket.timeout:\n print(\"Listening....\")\n continue\n except KeyboardInterrupt:\n print(\"Shutting down sensor sim. . .\")\n if conn:\n conn.close()\n break\n\ndef genBelfortData():\n randomValue = random.uniform(12,14)\n dataString = \"\\x01\\x02\\x0DVP\" + str(randomValue)[:5] + \"DE4\" + \"\\r\\n\"\n return dataString\n\ndef simulateSensor(conn):\n data = conn.recv(1024)\n print('Incoming Poll Message:', data.decode())\n dataString = genBelfortData() #Generating simulated data\n byt = dataString.encode()\n conn.send(byt)\n \nif __name__ == '__main__':\n main()"}}},{"rowIdx":1092638,"cells":{"text":{"kind":"string","value":"
\n\t<%@user ||=current_user %> \n\t<%= simple_form_for(@car, class:\"form-horizontal\") do |f| %>\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t<%= car_image(@car,:normal, class:\"img-rounded img-responsitive\") %>\n\t\t\t
\n\t\t\t

<%=t(\".upload_text\")%>

\n\n\t\t\t<%= f.simple_fields_for :image, f.object.image || f.object.build_image do |i| %>\n\t\t\t<%=i.input :img, label: false, input_html:{class:\"form-control\"}%>\n\t\t\t<%= i.input :_destroy, as: :boolean, label:t(\".img_destroy_txt\"), hint:t(\".img_destroy_hint\") %>\n\t\t\t<%end%>\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\t<%= f.input(:title) %>\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t<%=f.input :color, as: :select do\n\t\t\t\t\tf.select :color, Color.select_array\n\t\t\t\t\tend%>\n\t\t\t\t
\t\n\t\t\t\t
\n\t\t\t\t\t<%= f.input :priority%>\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t<%= f.input :description, as: :text, input_html: {rows: 5, \n\t\t\t\t\t:onkeyup =>\"length_check(#{Car::DescriptionLength}, 'car_description', 'counter')\",\n\t\t\t\t\t:onclick =>\"length_check(#{Car::DescriptionLength}, 'car_description', 'counter')\" }%>\n\t\t\t\t <%= 180-((@car.description.nil?)? 0 : @car.description.length) %> / <%= Car::DescriptionLength %>\n\t\t\t
\n\t\t\t
\n\t\t\t\t<%= f.button :submit, t('save_but'),class:\"btn btn-primary\" %>\n\t\t\t
\n\t\t<% end %>\n\t
\n
\n\n<%= javascript_tag do%>\n\t$(\"#car_priority\").slider();\n<%end%>"}}},{"rowIdx":1092639,"cells":{"text":{"kind":"string","value":"import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';\nimport { SchemaTypes, Types } from 'mongoose';\nimport { AgeGroup } from 'src/common/staticSchema/ageGroup.schema';\nimport { Gender } from 'src/common/staticSchema/gender.schema';\nimport { v4 as uuidv4 } from 'uuid';\nimport { ExitSurveyForm } from './exitSurveyForm.schema';\n\n@Schema()\nexport class ExitSurveyResponse {\n @Prop({ default: uuidv4() })\n exitSurveyResponseId: string;\n\n @Prop({ type: SchemaTypes.ObjectId, ref: ExitSurveyForm.name })\n exitSurveyFormId: Types.ObjectId;\n\n @Prop({ required: true })\n email: string;\n\n @Prop({ required: true })\n firstName: string;\n\n @Prop({ required: true })\n lastName: string;\n\n @Prop({ type: SchemaTypes.ObjectId, ref: Gender.name, required: true })\n genderId: Types.ObjectId;\n\n @Prop({ type: SchemaTypes.ObjectId, ref: AgeGroup.name, required: true })\n ageGroupId: Types.ObjectId;\n\n @Prop()\n activityCompletedInEntirety: string;\n\n @Prop()\n beneficiality: string;\n\n @Prop()\n relevance: string;\n\n @Prop()\n expectations: string;\n\n @Prop()\n degreeOfKnowledge: string;\n\n @Prop()\n applicationOfKnowledge: string;\n\n @Prop()\n valuableConcept: string;\n\n @Prop()\n topicsInGreaterDepth: string;\n\n @Prop()\n interactionWithFellowParticipants: string;\n\n @Prop()\n feedback: string;\n}\n\nexport const ExitSurveyResponseSchema =\n SchemaFactory.createForClass(ExitSurveyResponse);"}}},{"rowIdx":1092640,"cells":{"text":{"kind":"string","value":"import { useEffect, useState } from 'react'\nimport { useFormik, FormikHelpers } from 'formik';\nimport useCheckWeb3 from '../../hooks/useWeb3.hook';\nimport { EChainIds } from '../../interfaces/useCheckWeb3.interface';\nimport { HomePage } from './home.page';\nimport { getContractValidSchema } from '../../validations/getContractValid.schema';\nimport { IValues, IValuesTransfer } from '../../interfaces/homePage.interface';\nimport { ITokenContract } from '../../interfaces/tokenContract';\nimport TokenService from '../../services/token.service';\nimport { Msgs } from '../../utils/msgs';\nimport { sendSchema } from '../../validations/send.schema';\nimport { ITsx } from '../../interfaces/tsx.interface';\n\nconst initialValues = {\n address: '',\n}\n\nconst HomeContainer = (): JSX.Element => {\n // check network & existing metamsk\n const { error } = useCheckWeb3({ network: EChainIds.ROPSTEN });\n\n const [errorData, setErrorData] = useState(\"\");\n const [recentTsxs, setRecentTsxs] = useState([]);\n const [isLoading, setIsLoading] = useState(false);\n const [myBalance, setMyBalance] = useState>({\n address: \"-\",\n value: \"-\"\n })\n const [tokensContract, setTokensContract] = useState({\n address: \"-\",\n name: \"-\",\n symbol: \"-\",\n value: \"-\"\n });\n\n const cleanError = () => setTimeout(() => setErrorData(\"\"), 5000);\n\n // form for get balance of contract\n const formGetContract = useFormik({\n initialValues,\n validationSchema: getContractValidSchema,\n onSubmit: getTokenInfo,\n });\n\n // func for submiting balance of contract\n async function getTokenInfo(\n { address }: IValues,\n { setSubmitting }: FormikHelpers\n ) {\n setIsLoading(true);\n const contract = new TokenService(address);\n\n try {\n const { name, symbol, value } = await contract.getTokenInfo();\n setTokensContract({\n address,\n name,\n symbol,\n value\n });\n setMyBalance({\n address: \"-\",\n value: \"-\"\n });\n } catch(_) {\n setErrorData(Msgs.error.common);\n cleanError();\n } finally {\n setSubmitting(false);\n setIsLoading(false);\n }\n };\n\n // form for get balance of contract\n const formTransferTokens = useFormik({\n initialValues: {\n to: \"\",\n amount: 0\n },\n validationSchema: sendSchema,\n onSubmit: sendTokens,\n });\n // 0x48064A4c359A829D4724F60BD8643D5a6532feE8\n // func for submiting balance of contract\n async function sendTokens(\n { to, amount }: IValuesTransfer,\n { setSubmitting }: FormikHelpers\n ) {\n setIsLoading(true);\n const contract = new TokenService(tokensContract.address);\n\n try {\n await contract.transferToken({ to, amount });\n } catch(_) {\n setErrorData(Msgs.error.common);\n cleanError();\n } finally {\n setSubmitting(false);\n setIsLoading(false);\n }\n };\n\n // func for submiting balance of contract\n async function getMyBalance() {\n setIsLoading(true);\n const contract = new TokenService(tokensContract.address);\n\n try {\n const { address, value } = await contract.getMyBalance();\n setMyBalance({\n address,\n value\n })\n } catch(_) {\n setErrorData(Msgs.error.common);\n cleanError();\n } finally {\n setIsLoading(false);\n }\n };\n\n useEffect(() => {\n if(tokensContract.address !== \"-\") {\n const contract = new TokenService(tokensContract.address);\n const erc20 = contract.initCotract;\n \n erc20.on(\"Transfer\", (from, to, value) => {\n const newTsx = {\n from,\n to,\n value,\n symbol: tokensContract.symbol\n }\n setRecentTsxs(state => [newTsx, ...state]);\n });\n }\n }, [tokensContract]);\n\n return ;\n}\n\nexport default HomeContainer;"}}},{"rowIdx":1092641,"cells":{"text":{"kind":"string","value":"// @ts-nocheck\n\"use client\";\n\nimport { useSession } from \"next-auth/react\";\nimport { useEffect, useState } from \"react\";\nimport { useRouter } from \"next/navigation\";\nimport ProfilePage from \"components/profilepage/ProfilePage\";\n\n/**\n * This function fetches the user details from the database and displays them.\n *\n * @constructor - The user page\n * @returns - The user page\n */\nconst MyProfile = () => {\n useRouter();\n const { data: session } = useSession();\n const [myUserProfile, setMyUserProfile] = useState();\n\n const fetchMyDetails = async () => {\n const response = await fetch(`/api/user/${session?.user.id}`);\n const data = await response.json();\n setMyUserProfile(data);\n };\n\n useEffect(() => {\n if (session?.user.id) fetchMyDetails();\n }, [session?.user.id]);\n\n const handleEdit = () => {\n fetchMyDetails();\n };\n\n return ;\n};\n\nexport default MyProfile;"}}},{"rowIdx":1092642,"cells":{"text":{"kind":"string","value":"import { Navbar, TextInput, Button } from 'flowbite-react';\nimport { Link, useLocation } from 'react-router-dom';\nimport { AiOutlineSearch } from 'react-icons/ai';\nimport { FaMoon } from 'react-icons/fa';\n\nexport default function Header() {\n const path = useLocation().pathname;\n return (\n \n \n Bloggy\n \n
\n \n \n \n
\n \n \n \n \n \n
\n \n \n Home\n \n \n About\n \n \n Dashboard\n \n \n
\n )\n}"}}},{"rowIdx":1092643,"cells":{"text":{"kind":"string","value":"import React from \"react\";\nimport \"./content-wrapper.css\";\n\ninterface ContentWrapperProps {\n contentSpacing?: \"p0\" | \"p1\" | \"p2\" | \"p3\" | \"p4\";\n horizontalOnly?: boolean;\n children: React.ReactNode;\n}\n\nconst spacingPropToClassName = ({\n contentSpacing,\n horizontalOnly,\n}: Pick) =>\n contentSpacing\n ? `content-wrapper--u-spacing-${contentSpacing}${\n horizontalOnly ? \"-h\" : \"\"\n }`\n : \"\";\n\nexport const ContentWrapper = ({\n contentSpacing,\n horizontalOnly,\n children,\n}: ContentWrapperProps) => (\n
\n \n {children}\n
\n
\n);"}}},{"rowIdx":1092644,"cells":{"text":{"kind":"string","value":"//\n// MapsViewController.swift\n// Map App\n//\n// Created by Mutlu Çalkan on 20.06.2022.\n//\n\nimport UIKit\nimport MapKit\nimport CoreLocation\nimport CoreData\n\nclass MapsViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {\n @IBOutlet weak var placeNameTF: UITextField!\n @IBOutlet weak var noteTF: UITextField!\n @IBOutlet weak var mapView: MKMapView!\n \n let locationManager = CLLocationManager()\n var longitude = Double()\n var latitude = Double()\n \n var chosenPlaceName = \"\"\n var chosenID : UUID?\n \n var annotationTitle = \"\"\n var annotationSubtitle = \"\"\n var annotationLongitude = Double()\n var annotationLatitude = Double()\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n mapView.delegate = self\n locationManager.delegate = self\n \n locationManager.desiredAccuracy = kCLLocationAccuracyBest\n locationManager.requestWhenInUseAuthorization()\n locationManager.startUpdatingLocation()\n \n let gestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(locationPicker(gestureRecognizer:)))\n mapView.addGestureRecognizer(gestureRecognizer)\n gestureRecognizer.minimumPressDuration = 1.3\n\n fetchData()\n \n }\n \n @objc func locationPicker(gestureRecognizer: UILongPressGestureRecognizer){\n if gestureRecognizer.state == .began {\n let chosenPoint = gestureRecognizer.location(in: mapView)\n let chosenLocation = mapView.convert(chosenPoint, toCoordinateFrom: mapView)\n \n longitude = chosenLocation.longitude\n latitude = chosenLocation.latitude\n \n let annotation = MKPointAnnotation()\n annotation.coordinate = chosenLocation\n annotation.title = placeNameTF.text\n annotation.subtitle = noteTF.text\n mapView.addAnnotation(annotation)\n }\n }\n \n func fetchData(){\n if chosenPlaceName != \"\" {\n //Fetch data from Core Data\n if let uuidString = chosenID?.uuidString{\n let appDelegate = UIApplication.shared.delegate as! AppDelegate\n let context = appDelegate.persistentContainer.viewContext\n \n let fetchRequest = NSFetchRequest(entityName: \"Location\")\n fetchRequest.returnsObjectsAsFaults = false\n fetchRequest.predicate = NSPredicate(format: \"id = %@\", uuidString)\n \n do{\n let results = try context.fetch(fetchRequest)\n if results.count > 0{\n for result in results as! [NSManagedObject] {\n if let name = result.value(forKey: \"placeName\") as? String {\n annotationTitle = name\n if let note = result.value(forKey: \"note\") as? String {\n annotationSubtitle = note\n if let latitude = result.value(forKey: \"latitude\") as? Double {\n annotationLatitude = latitude\n if let longitude = result.value(forKey: \"longitude\") as? Double {\n annotationLongitude = longitude\n \n let annotation = MKPointAnnotation()\n annotation.title = annotationTitle\n annotation.subtitle = annotationSubtitle\n let coordinate = CLLocationCoordinate2D(latitude: annotationLatitude, longitude: annotationLongitude)\n annotation.coordinate = coordinate\n \n mapView.addAnnotation(annotation)\n placeNameTF.text = annotationTitle\n noteTF.text = annotationSubtitle\n \n locationManager.stopUpdatingLocation()\n \n let span = MKCoordinateSpan(latitudeDelta: 0.03, longitudeDelta: 0.03)\n let region = MKCoordinateRegion(center: coordinate, span: span)\n mapView.setRegion(region, animated: true)\n \n }\n }\n }\n }\n }\n }\n }catch{\n print(\"Error!\")\n }\n }\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\n if chosenPlaceName == \"\"{\n let location = CLLocationCoordinate2D(latitude: locations[0].coordinate.latitude, longitude: locations[0].coordinate.longitude)\n let span = MKCoordinateSpan(latitudeDelta: 0.03, longitudeDelta: 0.03)\n let region = MKCoordinateRegion(center: location, span: span)\n mapView.setRegion(region, animated: true)\n }\n }\n \n // Customize the pin\n func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {\n if annotation is MKUserLocation{\n return nil\n }\n let pinViewID = \"annotationID\"\n var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: pinViewID)\n \n if pinView == nil {\n pinView = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: pinViewID)\n pinView?.canShowCallout = true\n pinView?.tintColor = .blue\n \n let button = UIButton(type: .detailDisclosure)\n pinView?.rightCalloutAccessoryView = button\n }else{\n pinView?.annotation = annotation\n }\n return pinView\n }\n \n // The action when pressing on callout\n func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {\n if chosenPlaceName != \"\" {\n \n let requestLocation = CLLocation(latitude: annotationLatitude, longitude: annotationLongitude)\n \n CLGeocoder().reverseGeocodeLocation(requestLocation) { placemarkArray, error in\n if let placemarks = placemarkArray {\n if placemarks.count > 0 {\n let newPlacemark = MKPlacemark(placemark: placemarks[0])\n let item = MKMapItem(placemark: newPlacemark)\n item.name = self.annotationTitle\n \n // Set the transport option\n let launchOptions = [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving]\n // Openning apple map\n item.openInMaps(launchOptions: launchOptions)\n \n }\n }\n }\n }\n }\n \n\n @IBAction func didSaveButtonPressed(_ sender: Any) {\n let appDelegate = UIApplication.shared.delegate as! AppDelegate\n let context = appDelegate.persistentContainer.viewContext\n \n let newLocation = NSEntityDescription.insertNewObject(forEntityName: \"Location\", into: context)\n \n newLocation.setValue(placeNameTF.text, forKey: \"placeName\")\n newLocation.setValue(noteTF.text, forKey: \"note\")\n newLocation.setValue(longitude, forKey: \"longitude\")\n newLocation.setValue(latitude, forKey: \"latitude\")\n newLocation.setValue(UUID(), forKey: \"id\")\n \n do{\n try context.save()\n // Alert Pop-up\n let okAction = UIAlertAction(title: \"OK\", style: .default)\n let alert = UIAlertController(title: \"Saved\", message: \"Location has been succesfully saved\", preferredStyle: .alert)\n present(alert, animated: true, completion: nil)\n alert.addAction(okAction)\n \n }catch{\n print(\"Error\")\n let alert = UIAlertController(title: \"Something went wrong\", message: \"Fatal Error\", preferredStyle: .alert)\n present(alert, animated: true, completion: nil)\n let okAction = UIAlertAction(title: \"OK\", style: .default)\n alert.addAction(okAction)\n }\n \n NotificationCenter.default.post(name: NSNotification.Name(\"newLocationAdded\"), object: nil)\n navigationController?.popViewController(animated: true)\n }\n}"}}},{"rowIdx":1092645,"cells":{"text":{"kind":"string","value":"import { Application } from 'express';\nimport express from 'express';\nimport simpleGit from 'simple-git';\nimport { promises as fs } from 'fs';\nimport path from 'path';\nimport { v4 as uuid } from 'uuid';\n\nconst app: Application = express();\n\napp.post('/diff', async (req, res) => {\n const { old: oldContent, new: newContent } = req.body ?? {};\n\n if (!oldContent || !newContent) {\n return res.status(400).json({ error: 'invalid parameters' }).end();\n }\n\n const tempDir = await fs.mkdtemp(uuid());\n\n const oldPath = path.join(tempDir, 'old.txt');\n const newPath = path.join(tempDir, 'new.txt');\n\n await Promise.all([\n fs.writeFile(oldPath, oldContent),\n fs.writeFile(newPath, newContent)\n ]);\n\n const diff = await simpleGit().diff(['-U1', oldPath, newPath]);\n\n res.json({ data: diff }).end();\n\n await fs.rmdir(tempDir);\n});\n\nexport { app as api };"}}},{"rowIdx":1092646,"cells":{"text":{"kind":"string","value":"\n\n"}}},{"rowIdx":1092647,"cells":{"text":{"kind":"string","value":"//\n// CategoryTableViewController.swift\n// Restaurant\n//\n// Created by Ahmad Nader on 8/08/23.\n\n\nimport UIKit\nimport UserNotifications\n\nclass CategoryTableViewController: UITableViewController {\n \n \n var categories = [String]()\n\n override func viewDidLoad() {\n super.viewDidLoad()\n MenuController.shared.fetchCategories{ (categories) in\n if let categories = categories {\n self.updateUI(with: categories)\n }\n }\n // getting the user's permission for notification\n initNotificationSetupCheck()\n }\n \n \n\n \n\n // MARK: - Table view data source\n\n override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n return categories.count\n }\n\n \n override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n let cell = tableView.dequeueReusableCell(withIdentifier: \"CategoryCellIdentifier\", for: indexPath)\n cell.textLabel?.text = categories[indexPath.row].capitalized\n\n return cell\n }\n\n override func prepare(for segue: UIStoryboardSegue, sender: Any?) {\n if segue.identifier == \"MenuSegue\"{\n let menuTableViewController = segue.destination as! MenuTableViewController\n let index = tableView.indexPathForSelectedRow!.row\n menuTableViewController.category = categories[index]\n }\n }\n func updateUI(with categories: [String]){\n DispatchQueue.main.async {\n self.categories = categories\n self.tableView.reloadData()\n }\n }\n // Notification Implimentation\n func initNotificationSetupCheck() {\n UNUserNotificationCenter.current().requestAuthorization(options: [.alert])\n { (success, error) in\n if success {\n print(\"Permission Accepted\")\n } else {\n print(\"No Notification\")\n }\n }\n }\n \n\n}"}}},{"rowIdx":1092648,"cells":{"text":{"kind":"string","value":"import { spawn } from \"node:child_process\";\nimport path from \"node:path\";\nimport os from \"node:os\";\nimport fs from \"node:fs\";\nimport net from \"node:net\";\n\nimport _ from \"lodash\";\nimport { Reader } from \"gocsv\";\nimport {\n randEmail,\n randFullName,\n randHexaDecimal,\n randPastDate,\n randText,\n} from \"@ngneat/falso\";\n\nimport { version } from \"../package.json\";\nimport { Readable } from \"node:stream\";\nimport { Commit, CommitTree } from \"./commit\";\n\nconst plat = os.platform();\nlet arch = os.arch();\narch = arch === \"x64\" ? \"amd64\" : arch;\n\nexport const sleep = (ms: number) =>\n new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n\nexport const wrgl = (repoDir: string, args: string[]) =>\n new Promise((resolve, reject) => {\n const proc = spawn(\n path.join(\n \"__testcache__\",\n version,\n `wrgl-${plat}-${arch}`,\n \"bin\",\n \"wrgl\"\n ),\n args.concat([\"--wrgl-dir\", repoDir])\n );\n const stdout: string[] = [];\n const stderr: string[] = [];\n proc.stdout.on(\"data\", (data) => {\n stdout.push(data);\n });\n proc.stderr.on(\"data\", (data) => {\n stderr.push(data);\n });\n proc.on(\"close\", (code) => {\n if (code !== 0) {\n reject(\n new Error(\n `wrgl exited with code ${code}:\\n stdout: ${stdout.join(\n \"\"\n )}\\n stderr: ${stderr.join(\"\")}`\n )\n );\n } else {\n resolve(null);\n }\n });\n });\n\nexport const freePort = (): Promise =>\n new Promise((resolve, reject) => {\n const srv = net.createServer(function (sock) {\n sock.end(\"\");\n });\n let port: number;\n srv.listen(0, function () {\n port = (srv.address() as net.AddressInfo).port;\n srv.close();\n });\n srv.on(\"error\", (err) => {\n reject(err);\n });\n srv.on(\"close\", () => {\n resolve(port);\n });\n });\n\nexport const startWrgld = async (\n repoDir: string,\n callback: (url: string) => Promise\n) => {\n const port: number = await freePort();\n const proc = spawn(\n path.join(\n \"__testcache__\",\n version,\n `wrgld-${plat}-${arch}`,\n \"bin\",\n \"wrgld\"\n ),\n [repoDir, \"-p\", port + \"\"]\n );\n await sleep(1000);\n try {\n await callback(`http://localhost:${port}`);\n } catch (e) {\n throw e;\n } finally {\n proc.kill();\n }\n};\n\nexport const commit = async (\n repoDir: string,\n branch: string,\n message: string,\n primaryKey: string[],\n rows: string[][]\n) => {\n const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), \"wrgl-javascript-sdk\"));\n const filePath = path.join(tmpDir, \"data.csv\");\n fs.writeFileSync(filePath, rows.map((row) => row.join(\",\")).join(\"\\n\"));\n await wrgl(repoDir, [\n \"commit\",\n branch,\n filePath,\n message,\n \"-p\",\n primaryKey.join(\",\"),\n ]);\n fs.rmSync(tmpDir, { recursive: true, force: true });\n};\n\nexport const readAll = async (reader: Reader) => {\n const result: string[][] = [];\n await reader.readAll((row) => {\n result.push(row);\n });\n return result;\n};\n\nexport const initRepo = async (\n email: string,\n name: string,\n password: string\n) => {\n const repoDir = fs.mkdtempSync(path.join(os.tmpdir(), \"wrgl-javascript-sdk\"));\n await wrgl(repoDir, [\"init\"]);\n await wrgl(repoDir, [\"config\", \"set\", \"receive.denyNonFastForwards\", \"true\"]);\n await wrgl(repoDir, [\"config\", \"set\", \"user.email\", email]);\n await wrgl(repoDir, [\"config\", \"set\", \"user.name\", name]);\n await wrgl(repoDir, [\n \"auth\",\n \"add-user\",\n email,\n \"--name\",\n name,\n \"--password\",\n password,\n ]);\n await wrgl(repoDir, [\"auth\", \"add-scope\", email, \"--all\"]);\n await wrgl(repoDir, [\"config\", \"set\", \"auth.type\", \"legacy\"]);\n return repoDir;\n};\n\nexport const csvStream = (rows: string[][]) =>\n Readable.from(rows.map((row) => row.join(\",\")).join(\"\\n\"));\n\nexport const exhaustAsyncIterable = async (\n iterable: AsyncIterable\n): Promise => {\n const result: T[] = [];\n for await (const value of iterable) {\n result.push(value);\n }\n return result;\n};\n\nexport const randCommit = (): Commit => ({\n sum: randHexaDecimal({ length: 32 }).join(\"\"),\n authorEmail: randEmail(),\n authorName: randFullName(),\n message: randText(),\n table: {\n sum: randHexaDecimal({ length: 32 }).join(\"\"),\n },\n time: randPastDate(),\n});\n\nexport const randCommitTree = (depth: number): CommitTree => {\n const root = randCommit();\n let commit = root;\n for (let i = 0; i < depth; i++) {\n const node = randCommit();\n commit.parentCommits = { [node.sum]: node };\n commit.parents = [node.sum];\n commit = node;\n }\n return new CommitTree({\n sum: root.sum,\n root,\n });\n};"}}},{"rowIdx":1092649,"cells":{"text":{"kind":"string","value":"# Exercício 1\na) \n* VARCHAR: serve para qualquer caracteres de até 255;\n* PRIMARY KEY como id única;\n* NOT NULL para mostar que é um parametro necessário;\n* DATE para data.\n\nb) \n* SHOW DATABASES: mostra as informações do meu banco de dados;\n* SHOW TABLES: mostra minhas tables criadas.\n\nc) mostra os detalhes da table.\n\n# Exercício 2\na) \n``` sql\nINSERT INTO Actor (id, name, salary, birth_date, gender)\nVALUES(\n \"002\", \n \"Glória Pires\",\n 1200000,\n \"1963-08-23\", \n \"female\"\n);\n```\n\nb) Entrada duplicada \"002\" na key \"PRIMARY\". Tentou criar uma primary key com valor que já existe.\n\nc) Coluna não bate com os valores que foram passados no insert. Falta alguns parametros para que passe corretamente em todos os values da table.\n\nd) Campo 'name' nao tem nenhum valor. O nome é um campo obrigatório\n\ne) Value incorreto, falta por \"\" no valor do date.\n\n# Exercício 3\na)\n``` sql\nSELECT * FROM Actor;\n```\n\nb) \n``` sql\nSELECT salary FROM Actor WHERE name = \"Tony Ramos\";\n```\n\nc)\n``` sql\nSELECT * from Actor WHERE gender = \"invalid\";\n```\nvoltou vazio pois todos os dados tem o gender com male ou female;\n\nd) \n``` sql\nSELECT id, name, salary FROM Actor WHERE salary <= 500000;\n```\n\ne) Coluna 'nome' desconhecida. correção:\n``` sql\nSELECT id, name from Actor WHERE id = \"002\"\n```\n\n# Exercício 4\na) Busca os atores que comecem com A ou J no nome e depois filtra os que recebem mais de 300.000\n\nb) \n``` sql\nSELECT * FROM Actor\nWHERE (name NOT LIKE \"A%\") AND salary > 350000;\n```\nc) \n``` sql\nSELECT * FROM Actor WHERE name LIKE \"%g%\";\n```\n\n# Exercício 5\na) bem similar ao VARCHAR mas com menos limitações de caracteres.\n\n# Exercício 6\na) \n``` sql\nSELECT id, title, rating from Movie WHERE id =\"003\";\n```\nb) \n``` sql\nSELECT * FROM Movie WHERE title = \"Dona Flor e Seus Dois Maridos\";\n```\nc) \n``` sql\nSELECT id, title, synopsis FROM Movie WHERE rating <= 7;\n```\n# Exercício 7\na) \n``` sql\nSELECT * FROM Movie WHERE title LIKE \"%vida%\";\n```\nb) \n``` sql\nSELECT * FROM Movie WHERE title LIKE \"%termo de busca%\" OR synopsis LIKE \"%termo de busca\";\n```\nc) \n``` sql\nSELECT * FROM Movie WHERE release_date < \"2021-11-22\";\n```\nd) \n``` sql\nSELECT * FROM Movie WHERE release_date < \"2021-11-22\" AND (title LIKE \"%termo de busca%\" OR synopsis LIKE \"%termo de busca\") AND rating <= 7;\n```"}}},{"rowIdx":1092650,"cells":{"text":{"kind":"string","value":"import React from 'react';\nimport {\n View,\n Text,\n Alert,\n TextInput,\n StyleSheet,\n Image,\n ImageBackground,\n} from 'react-native';\nconst moment = require(\"moment\");\nimport { Toast } from '../util/Toast';\nimport { login } from '../Server/login';\nimport { getRule } from '../Server/getRule';\nimport AuthorizationScreen from './AuthorizationScreen';\nimport AsyncStorage from '@react-native-community/async-storage';\n\nexport default class SignInScreen extends React.Component {\n static navigationOptions = {\n title: null,\n header: null\n };\n state = {\n userid: 'bwcsuser',\n PhoneNum: '13552739927',\n password: '1',\n focus: ''\n }\n\n componentDidMount() { }\n _login = () => {\n const { userid, password, PhoneNum } = this.state;\n login(userid, password, PhoneNum).then((res) => {\n if (res.Code == 200) {\n this._signInAsync()\n } else {\n Alert.alert(\n '登录失败!',\n res.Message,\n [{ text: '关闭' }],\n { cancelable: false }\n );\n }\n }).catch((error) => {\n alert(JSON.stringify(error));\n });\n }\n render() {\n const { focus } = this.state;\n return (\n \n {/* \n \n \n \n \n \n \n \n \n \n \n this.setState({ focus: 1 })}\n maxLength={20}\n placeholder=\"请输入您的账号\"\n value={this.state.userid}\n placeholderTextColor='#c5c5c5'\n onChangeText={(userid) => this.setState({ userid })}\n />\n \n \n \n \n \n \n \n this.setState({ focus: 2 })}\n onChangeText={(PhoneNum) => this.setState({ PhoneNum })}\n />\n \n \n \n \n \n \n \n this.setState({ focus: 3 })}\n onChangeText={(password) => this.setState({ password })}\n />\n \n \n \n \n 立即登录\n {/* \n
\n \n {headerMenus?.length ? (\n
\n {headerMenus?.map((menu) => (\n \n \n {menu?.node?.label}\n \n \n ))}\n
\n ) : null}\n
\n \n Contact\n \n
\n \n \n );\n};\n\nexport default Nav;"}}},{"rowIdx":1092657,"cells":{"text":{"kind":"string","value":"# Display art\n# Generate random account\n# format account data\n# ask user to guess\n# check if user is correct\n## get follower \n## use if statement to check if user is correct\n# give user feedback on their guess\n# make game repeatable\n# swap b to a and generate new random b\n\nfrom art import logo, vs\nimport game_data import data\nimport random\nimport os\n\n# Function to clear the screen\ndef clear_screen():\n os.system('cls' if os.name == 'nt' else 'clear')\n\ndef format_data(account):\n \"\"\"Format the account data into printable format\"\"\"\n account_name = account[\"name\"]\n account_descr = account[\"description\"]\n account_country = account[\"country\"]\n return f\"{account_name}, a {account_descr}, from {account_country}\"\n\ndef check_answer(guess, a_follower_count, b_follower_count):\n \"\"\"Take the user guess and follower counts and returns if they got it right\"\"\"\n if a_follower_count > b_follower_count:\n return guess == \"a\"\n else:\n return guess == \"b\"\n\nprint(logo)\nscore = 0\ngame_should_continue = True\naccount_b = random.choice(data) # reason to put outside, so this wont be used when the game continue, it stuck in the while loop until the game end\n\nwhile game_should_continue:\n account_a = account_b\n account_b = random.choice(data)\n\n if account_a == account_b:\n account_b = random.choice(data)\n\n print(f\"Compare A: {format_data(account_a)}\")\n print(vs)\n print(f\"Compare B: {format_data(account_b)}\")\n\n # ask user for a guess\n guess = input(\"Who has more followers? Type 'a' or 'b': \").lower()\n\n # check follower number\n a_follower_count = account_a[\"follower_count\"]\n b_follower_count = account_b[\"follower_count\"]\n\n is_correct = check_answer(guess, a_follower_count, b_follower_count)\n\n clear_screen()\n\n if is_correct:\n score += 1\n print(f\"You are right! Current score: {score}\")\n else:\n game_should_continue = False\n print(f\"Sorry, that's wrong. Final Score: {score}\")"}}},{"rowIdx":1092658,"cells":{"text":{"kind":"string","value":"/**\n * Basic tool library\n * Copyright (C) 2014 kunyang kunyang.yk@gmail.com\n *\n * @file ky_flags.h\n * @brief 装配枚举类型为旗语标志\n *\n * @author kunyang\n * @email kunyang.yk@gmail.com\n * @version 1.0.1.1\n * @date 2018/08/01\n * @license GNU General Public License (GPL)\n *\n * Change History :\n * Date | Version | Author | Description\n * 2018/08/01 | 1.0.0.1 | kunyang | 创建文件\n *\n */\n#ifndef KY_FLAGS_H\n#define KY_FLAGS_H\n\n#include \"ky_define.h\"\n\n#define kyDeclareFlags(T, N) \\\n typedef ky_flags N\n\n//!\n//! \\brief The ky_flag class 将枚举类型包装\n//!\ntemplate\nclass ky_flags\n{\n kyCompilerAssert(sizeof(Enum) <= sizeof(int));\n kyCompilerAssert(is_enum());\npublic:\n ky_flags(){flags = 0;}\n ky_flags(Enum e){flags = e;}\n ky_flags(int e){flags = e;}\n\n inline ky_flags &operator &= (int mask) {flags &= mask; return *this;}\n inline ky_flags &operator &= (Enum mask) {flags &= (int)mask; return *this;}\n inline ky_flags &operator |= (ky_flags f) {flags |= f.flags; return *this;}\n inline ky_flags &operator |= (Enum f) {flags |= (int)f; return *this;}\n inline ky_flags &operator ^= (ky_flags f) {flags ^= f.flags; return *this;}\n inline ky_flags &operator ^= (Enum f) {flags ^= (int)f; return *this;}\n\n inline operator int() const {return flags;}\n\n inline ky_flags operator |(ky_flags f) const {return ky_flags(flags | f.flags);}\n inline ky_flags operator |(Enum f) const {return ky_flags(flags | (int)f);}\n inline ky_flags operator ^(ky_flags f) const {return ky_flags(flags ^ f.i);}\n inline ky_flags operator ^(Enum f) const {return ky_flags(flags ^ (int)f);}\n inline ky_flags operator &(int mask) const {return ky_flags(flags & mask);}\n inline ky_flags operator &(Enum f) const {return ky_flags(flags & (int)f);}\n inline ky_flags operator ~() const {return ky_flags(~flags);}\n\n inline bool operator !() const {return !flags;}\n\n inline bool operator == (Enum f) const\n {\n return ((flags & (int)f) == (int)f) &&\n ((int)f != 0 || flags == (int)f);\n }\n inline bool operator == (ky_flags f) const\n {\n return flags == f.flags;\n }\n\n inline ky_flags &set(Enum f, bool on = true)\n {\n return on ? (*this |= f) : (*this &= ~f);\n }\n inline bool is(Enum f)\n {\n return (*this & f) == f;\n }\n\nprivate:\n int flags;\n};\n\n#endif // KY_FLAG_H"}}},{"rowIdx":1092659,"cells":{"text":{"kind":"string","value":"import { useState } from 'react'\nimport { BsHash } from 'react-icons/bs'\nimport { FaChevronDown, FaChevronRight, FaPlus } from 'react-icons/fa'\n\n\n\nconst topics = [\"tailwind-css\", \"react-js\"]\nconst questions = [\"jit-compilation\", \"purging files\", \"dark/light mode\"]\nconst random = [\"npm packages\", \"plugins\", \"memes\"]\nconst ChannelBar = () => {\n\n const loop = Array.from(Array(6).keys())\n\n return (\n\n
\n \n \n
\n \n \n {loop.map((key) => {\n \n return \n })}\n \n\n
\n
\n\n\n )\n\n}\n\nconst Dropdown = ({ header, selections }) => {\n const [expanded, setExpanded] = useState(true);\n\n\n return (\n\n
\n\n
setExpanded(!expanded)} className=\"dropdown-header\">\n \n \n {header}\n \n \n
\n\n\n {expanded &&\n selections &&\n selections?.map((selection) => )}\n\n
\n\n )\n\n}\n\nconst ChevronIcon = ({ expanded }) => {\n\n const chevClass = \"text-accent text-opacity-80 my-auto mr-1\";\n return expanded ? (\n\n \n\n ) : (\n \n );\n\n}\n\n\nconst TopicSelection = ({ selection }) => (\n\n
\n \n
{selection}
\n
\n)\n\nconst ChannelBlock = () => (\n
\n
Discord Server
\n
\n)\nconst Divider = () =>
\nexport default ChannelBar"}}},{"rowIdx":1092660,"cells":{"text":{"kind":"string","value":"\n\n\n\n \n \n Portfolio\n \n \n\n\n\n \n
\n
\n \n
\n
\n\n \n\n \n
\n
\n
\n
\n
Hi!! Ajay Vishwakarma\n
\n
\n I am a \n
\n
\n I am a software developer and here is my portfolio website. here\n you will learn about my journey as a software developer.\n
\n \n
Contact Me
\n
\n
\n
\n\n
\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n
\n
Ajay
\n
\n
\n \n\n \n
\n

Projects

\n
\n
\n
\n
\n \"...\"\n
\n
Travel The World
\n

\n It is a website where you can explore places.\n

\n Tecnology Used : HTML-5 ,CSS-3 , Bootstrap-5.\n\n \n
\n
\n
\n
\n
\n \"...\"\n
\n
Amazon Clone
\n

\n An Amazon clone is a website that replicates the UI of Amazon.\n

\n Tecnology Used : HTML-5 ,CSS-3.\n \n
\n
\n
\n
\n
\n \"...\"\n
\n
JDBC CRUD Application
\n

\n Developed robust Java CRUD application using JDBC.\n

\n Tecnology Used : Java , JDBC , Swing.\n \n
\n
\n
\n
\n
\n \"...\"\n
\n
Tech Blog
\n

\n A tech blog is a website that focuses on technology-related topics, such as the latest news, reviews, and tutorials related to computer software.\n

\n Tecnology Used : HTML-5 ,CSS-3 , Bootstrap-5 , Java , JDBC ,\n JSP , Servlets.\n \n \n
\n
\n
\n
\n
\n
\n\n \n\n \n\n
\n
\n
\n

\n Me and\n
\n MyTech Stack\n

\n
\n

\n Hi, I am a final year Under-Graduate student. Currently pursuing\n Bachelor's of Technology in 'Computer Science and Engineering '\n from swami Vivekanand College of engineering.\n

\n
\n

\n I am a passionate coder as well as an innovative and creative\n thinker. Curious person who loves to explore the problem Solving\n world to gain knowledge. I am always eager to learn about about\n latest developments in the software Development world .\n

\n
\n

\n I have worked on Java and HTML CSS and have good knowledge of C++\n as well.\n

\n
\n

\n I have good knowledge of Data structures and Algorithms, OOPS, and\n DBMS.\n

\n
\n
\n
\n
\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n \"\"\n
\n
\n
\n
\n
\n
\n\n \n\n \n
\n
\n

Contact Me

\n\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n \n
\n
\n
\n
\n \n\n \n \n\n \n\n \n \n \n \n\n\n"}}},{"rowIdx":1092661,"cells":{"text":{"kind":"string","value":"from __future__ import annotations\n\n# coding: utf-8\n# graph.py\n\nfrom abc import ABC, abstractmethod\nfrom typing import TypeVar, NewType, Tuple, Iterator, Union\n\nfrom UnionFind import *\n\n\n#################### Type ####################\n\nEdge = Tuple[Node, Node]\nWeight = Union[int, float]\nWeightedEdge = Tuple[Node, Node, Weight]\n\n\n#################### GraphBase ####################\n\nclass GraphBase(ABC):\n\tdef __init__(self):\n\t\tpass\n\t\n\t@abstractmethod\n\tdef generate_nodes(self) -> Iterator[Node]:\n\t\tpass\n\t\n\t@abstractmethod\n\tdef neighbors(self, v0: Node) -> list[Node]:\n\t\tpass\n\t\n\tdef generate_edges(self) -> Iterator[Edge]:\n\t\tfor u in self.generate_nodes():\n\t\t\tfor v in self.neighbors(u):\n\t\t\t\tyield (u, v)\n\t\n\tdef divide_nodes_into_connected(self) -> list[list[Node]]:\n\t\tnodes = list(self.generate_nodes())\n\t\tuf = UnionFind(nodes)\n\t\tfor u, v in self.generate_edges():\n\t\t\tuf.join(u, v)\n\t\t\n\t\tgroups: dict[Node, int] = uf.divide_into_trees()\n\t\tnum_groups = max(groups.values()) + 1\n\t\tvs: list[list[Node]] = [ [] for _ in range(num_groups) ]\n\t\tfor v, group_index in groups.items():\n\t\t\tvs[group_index].append(v)\n\t\treturn vs\n\n\n#################### WeightedGraphBase ####################\n\nclass WeightedGraphBase(GraphBase):\n\tdef __init__(self):\n\t\tpass\n\t\n\t@abstractmethod\n\tdef generate_weighted_edges(self) -> Iterator[WeightedEdge]:\n\t\tpass\n\n__all__ = ['GraphBase', 'WeightedGraphBase', 'Node']"}}},{"rowIdx":1092662,"cells":{"text":{"kind":"string","value":"increments('id');\n $table->integer('user_id')->foreign()->references('id')->on('users')->onDelete('cascade');\n $table->boolean('type')->comment('1 => \"Current Address\" || 0 => \"Permanent Address\"');\n $table->string('line_one');\n $table->string('line_two')->nullable();\n $table->integer('city_id')->foreign()->references('id')->on('cities');\n $table->integer('state_id')->foreign()->references('id')->on('states');\n $table->integer('country_id')->foreign()->references('id')->on('countries');\n $table->timestamps();\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::dropIfExists('addresses');\n }\n}"}}},{"rowIdx":1092663,"cells":{"text":{"kind":"string","value":"import {\n Button,\n Checkbox,\n FormControl,\n FormLabel,\n Input,\n InputGroup,\n InputLeftAddon,\n InputRightElement,\n Textarea,\n useToast\n} from \"@chakra-ui/react\";\nimport React, { useContext, useEffect, useState } from \"react\";\nimport { FiCheck, FiChevronLeft, FiChevronRight, FiX } from \"react-icons/fi\";\nimport { request } from \"../../utility/utils\";\nimport { AuthContext } from \"../../utility/userAuthContext\";\nimport { useDispatch } from \"react-redux\";\nimport { setLivePolls, setRecentPolls } from \"../../redux/actions/pollsDataAction\";\n\n\nconst Page1 = (props) => {\n const options = props.options;\n const optionElement = props.optionElement;\n const statement = props.statement;\n const title = props.title\n return
\n \n Title:\n props.setTitle(e.target.value)}\n className=\"text-white\" rounded=\"xl\" />\n \n \n Statement:\n
Subsets and Splits

No community queries yet

The top public SQL queries from the community will appear here once available.